1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/tests/testJNI.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +Components.utils.import("resource://gre/modules/ctypes.jsm"); 1.10 +Components.utils.import("resource://gre/modules/JNI.jsm"); 1.11 + 1.12 +add_task(function test_JNI() { 1.13 + let iconSize = -1; 1.14 + 1.15 + let jni = null; 1.16 + try { 1.17 + jni = new JNI(); 1.18 + let cls = jni.findClass("org/mozilla/gecko/GeckoAppShell"); 1.19 + let method = jni.getStaticMethodID(cls, "getPreferredIconSize", "()I"); 1.20 + iconSize = jni.callStaticIntMethod(cls, method); 1.21 + } finally { 1.22 + if (jni != null) { 1.23 + jni.close(); 1.24 + } 1.25 + } 1.26 + 1.27 + do_check_neq(iconSize, -1); 1.28 +}); 1.29 + 1.30 +run_next_test();