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()