Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: base/android/jni_generator/jni_generator_tests.py

Issue 298973005: Updating JNIAdditionalImport to allow more than one import. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/jni_generator/jni_generator_tests.py
diff --git a/base/android/jni_generator/jni_generator_tests.py b/base/android/jni_generator/jni_generator_tests.py
index ab566168c1e2e8dd14dd408e19605e794b9e9ea1..6b7c0103a1fbe1f2e8e3dc4640c9ba9a6c04b92e 100755
--- a/base/android/jni_generator/jni_generator_tests.py
+++ b/base/android/jni_generator/jni_generator_tests.py
@@ -148,6 +148,8 @@ class TestGenerator(unittest.TestCase):
int nativeDataFetcherImplAndroid,
double alpha, double beta, double gamma);
"""
+ jni_generator.JniParams.SetFullyQualifiedClass(
+ 'org/chromium/example/jni_generator/SampleForTests')
qsr 2014/05/23 08:11:38 This is necessary because this test was wrong -> t
jni_generator.JniParams.ExtractImportsAndInnerClasses(test_data)
natives = jni_generator.ExtractNatives(test_data, 'int')
golden_natives = [
@@ -1033,7 +1035,7 @@ class Foo {
# Ensure it's fine with the import.
generate('import java.lang.Runnable;')
- def testJNIAdditionalImport(self):
+ def testSingleJNIAdditionalImport(self):
test_data = """
package org.chromium.foo;
@@ -1052,6 +1054,27 @@ class Foo {
TestOptions())
self.assertGoldenTextEquals(jni_from_java.GetContent())
+ def testMultipleJNIAdditionalImport(self):
+ test_data = """
+ package org.chromium.foo;
+
+ @JNIAdditionalImport({Bar1.class, Bar2.class})
+ class Foo {
+
+ @CalledByNative
+ private static void calledByNative(Bar1.Callback callback1,
+ Bar2.Callback callback2) {
+ }
+
+ private static native void nativeDoSomething(Bar1.Callback callback1,
+ Bar2.Callback callback2);
+ }
+ """
+ jni_from_java = jni_generator.JNIFromJavaSource(test_data,
+ 'org/chromium/foo/Foo',
+ TestOptions())
+ self.assertGoldenTextEquals(jni_from_java.GetContent())
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | base/android/jni_generator/testJNIAdditionalImport.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698