Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Tests for jni_generator.py. | 6 """Tests for jni_generator.py. |
| 7 | 7 |
| 8 This test suite contains various tests for the JNI generator. | 8 This test suite contains various tests for the JNI generator. |
| 9 It exercises the low-level parser all the way up to the | 9 It exercises the low-level parser all the way up to the |
| 10 code generator and ensures the output matches a golden | 10 code generator and ensures the output matches a golden |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1039 | 1039 |
| 1040 @JNIAdditionalImport(Bar.class) | 1040 @JNIAdditionalImport(Bar.class) |
| 1041 class Foo { | 1041 class Foo { |
| 1042 | 1042 |
| 1043 @CalledByNative | 1043 @CalledByNative |
| 1044 private static void calledByNative(Bar.Callback callback) { | 1044 private static void calledByNative(Bar.Callback callback) { |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 private static native void nativeDoSomething(Bar.Callback callback); | 1047 private static native void nativeDoSomething(Bar.Callback callback); |
| 1048 } | 1048 } |
| 1049 | |
| 1050 @JNIAdditionalImport({Bar2.class, Bar3.class}) | |
|
bulach
2014/05/22 17:13:45
probably best to split into a separate file..
the
qsr
2014/05/23 08:11:38
Done.
| |
| 1051 class Foo2 { | |
| 1052 | |
| 1053 @CalledByNative | |
| 1054 private static void calledByNative(Bar2.Callback callback1, | |
| 1055 Bar3.Callback callback2) { | |
| 1056 } | |
| 1057 | |
| 1058 private static native void nativeDoSomething(Bar2.Callback callback1, | |
| 1059 Bar3.Callback callback2); | |
| 1060 } | |
| 1061 | |
| 1049 """ | 1062 """ |
| 1050 jni_from_java = jni_generator.JNIFromJavaSource(test_data, | 1063 jni_from_java = jni_generator.JNIFromJavaSource(test_data, |
| 1051 'org/chromium/foo/Foo', | 1064 'org/chromium/foo/Foo', |
| 1052 TestOptions()) | 1065 TestOptions()) |
| 1053 self.assertGoldenTextEquals(jni_from_java.GetContent()) | 1066 self.assertGoldenTextEquals(jni_from_java.GetContent()) |
| 1054 | 1067 |
| 1055 | 1068 |
| 1056 if __name__ == '__main__': | 1069 if __name__ == '__main__': |
| 1057 unittest.main() | 1070 unittest.main() |
| OLD | NEW |