Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / base / android / jni_generator / jni_generator_tests.py
index 61d76c8..9e586f9 100755 (executable)
@@ -1010,6 +1010,29 @@ class Foo {
           TestOptions())
     self.assertRaises(SyntaxError, willRaise)
 
+  def testImplicitImport(self):
+    test_data = """
+    package org.chromium.android_webview;
+
+    %(IMPORT)s
+
+    @CalledByNative
+    private static void clientCertificatesCleared(Runnable callback) {
+        if (callbaback == null) return;
+        callback.run();
+    }
+    """
+    def generate(import_clause):
+      jni_generator.JNIFromJavaSource(
+          test_data % {'IMPORT': import_clause},
+          'org/chromium/android_webview/AwContentStatics',
+          TestOptions())
+    # Ensure it raises without the import.
+    self.assertRaises(SyntaxError, lambda: generate(''))
+
+    # Ensure it's fine with the import.
+    generate('import java.lang.Runnable;')
+
 
 if __name__ == '__main__':
   unittest.main()