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

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

Issue 214543002: Android: improves error message for Outer.Inner usage in JNI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | no next file » | 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()
OLDNEW
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698