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

Side by Side Diff: android/jni_generator/jni_generator_tests.py

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « android/jni_generator/jni_generator.py ('k') | android/jni_generator/sample_for_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 Long date, byte[] favicon, String title, Integer visits); 142 Long date, byte[] favicon, String title, Integer visits);
143 native int nativeFindAll(String find); 143 native int nativeFindAll(String find);
144 private static native OnFrameAvailableListener nativeGetInnerClass(); 144 private static native OnFrameAvailableListener nativeGetInnerClass();
145 private native Bitmap nativeQueryBitmap( 145 private native Bitmap nativeQueryBitmap(
146 int nativeChromeBrowserProvider, 146 int nativeChromeBrowserProvider,
147 String[] projection, String selection, 147 String[] projection, String selection,
148 String[] selectionArgs, String sortOrder); 148 String[] selectionArgs, String sortOrder);
149 private native void nativeGotOrientation( 149 private native void nativeGotOrientation(
150 int nativeDataFetcherImplAndroid, 150 int nativeDataFetcherImplAndroid,
151 double alpha, double beta, double gamma); 151 double alpha, double beta, double gamma);
152 private static native Throwable nativeMessWithJavaException(Throwable e);
152 """ 153 """
153 jni_generator.JniParams.SetFullyQualifiedClass( 154 jni_generator.JniParams.SetFullyQualifiedClass(
154 'org/chromium/example/jni_generator/SampleForTests') 155 'org/chromium/example/jni_generator/SampleForTests')
155 jni_generator.JniParams.ExtractImportsAndInnerClasses(test_data) 156 jni_generator.JniParams.ExtractImportsAndInnerClasses(test_data)
156 natives = jni_generator.ExtractNatives(test_data, 'int') 157 natives = jni_generator.ExtractNatives(test_data, 'int')
157 golden_natives = [ 158 golden_natives = [
158 NativeMethod(return_type='int', static=False, 159 NativeMethod(return_type='int', static=False,
159 name='Init', 160 name='Init',
160 params=[], 161 params=[],
161 java_class_name=None, 162 java_class_name=None,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 Param(datatype='double', 266 Param(datatype='double',
266 name='alpha'), 267 name='alpha'),
267 Param(datatype='double', 268 Param(datatype='double',
268 name='beta'), 269 name='beta'),
269 Param(datatype='double', 270 Param(datatype='double',
270 name='gamma'), 271 name='gamma'),
271 ], 272 ],
272 java_class_name=None, 273 java_class_name=None,
273 type='method', 274 type='method',
274 p0_type='content::DataFetcherImplAndroid'), 275 p0_type='content::DataFetcherImplAndroid'),
276 NativeMethod(return_type='Throwable', static=True,
277 name='MessWithJavaException',
278 params=[Param(datatype='Throwable', name='e')],
279 java_class_name=None,
280 type='function')
275 ] 281 ]
276 self.assertListEquals(golden_natives, natives) 282 self.assertListEquals(golden_natives, natives)
277 h = jni_generator.InlHeaderFileGenerator('', 'org/chromium/TestJni', 283 h = jni_generator.InlHeaderFileGenerator('', 'org/chromium/TestJni',
278 natives, [], [], TestOptions()) 284 natives, [], [], TestOptions())
279 self.assertGoldenTextEquals(h.GetContent()) 285 self.assertGoldenTextEquals(h.GetContent())
280 286
281 def testInnerClassNatives(self): 287 def testInnerClassNatives(self):
282 test_data = """ 288 test_data = """
283 class MyInnerClass { 289 class MyInnerClass {
284 @NativeCall("MyInnerClass") 290 @NativeCall("MyInnerClass")
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 test_result = unittest.main(argv=argv[0:1], exit=False) 1149 test_result = unittest.main(argv=argv[0:1], exit=False)
1144 1150
1145 if test_result.result.wasSuccessful() and options.stamp: 1151 if test_result.result.wasSuccessful() and options.stamp:
1146 TouchStamp(options.stamp) 1152 TouchStamp(options.stamp)
1147 1153
1148 return not test_result.result.wasSuccessful() 1154 return not test_result.result.wasSuccessful()
1149 1155
1150 1156
1151 if __name__ == '__main__': 1157 if __name__ == '__main__':
1152 sys.exit(main(sys.argv)) 1158 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « android/jni_generator/jni_generator.py ('k') | android/jni_generator/sample_for_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698