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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 private static String testStaticMethodWithNoParam(); | 987 private static String testStaticMethodWithNoParam(); |
988 } | 988 } |
989 """ | 989 """ |
990 options = TestOptions() | 990 options = TestOptions() |
991 options.jni_init_native_name = 'nativeInitNativeClass' | 991 options.jni_init_native_name = 'nativeInitNativeClass' |
992 options.eager_called_by_natives = True | 992 options.eager_called_by_natives = True |
993 jni_from_java = jni_generator.JNIFromJavaSource( | 993 jni_from_java = jni_generator.JNIFromJavaSource( |
994 test_data, 'org/chromium/example/jni_generator/Test', options) | 994 test_data, 'org/chromium/example/jni_generator/Test', options) |
995 self.assertGoldenTextEquals(jni_from_java.GetContent()) | 995 self.assertGoldenTextEquals(jni_from_java.GetContent()) |
996 | 996 |
| 997 def testOuterInnerRaises(self): |
| 998 test_data = """ |
| 999 package org.chromium.media; |
| 1000 |
| 1001 @CalledByNative |
| 1002 static int getCaptureFormatWidth(VideoCapture.CaptureFormat format) { |
| 1003 return format.getWidth(); |
| 1004 } |
| 1005 """ |
| 1006 def willRaise(): |
| 1007 jni_generator.JNIFromJavaSource( |
| 1008 test_data, |
| 1009 'org/chromium/media/VideoCaptureFactory', |
| 1010 TestOptions()) |
| 1011 self.assertRaises(SyntaxError, willRaise) |
| 1012 |
| 1013 |
997 if __name__ == '__main__': | 1014 if __name__ == '__main__': |
998 unittest.main() | 1015 unittest.main() |
OLD | NEW |