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

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

Issue 255613003: Move ui and content resources into one location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing headers Created 6 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 | Annotate | Revision Log
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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 jni_lines)[0] 830 jni_lines)[0]
831 self.assertTrue(len(line) > 80, 831 self.assertTrue(len(line) > 80,
832 ('Expected #ifndef line to be > 80 chars: ', line)) 832 ('Expected #ifndef line to be > 80 chars: ', line))
833 833
834 def testJarJarRemapping(self): 834 def testJarJarRemapping(self):
835 test_data = """ 835 test_data = """
836 package org.chromium.example.jni_generator; 836 package org.chromium.example.jni_generator;
837 837
838 import org.chromium.example2.Test; 838 import org.chromium.example2.Test;
839 839
840 import org.chromium.example3.PrefixFoo;
841 import org.chromium.example3.Prefix;
842 import org.chromium.example3.Bar$Inner;
843
840 class Example { 844 class Example {
841 private static native void nativeTest(Test t); 845 private static native void nativeTest(Test t);
846 private static native void nativeTest2(PrefixFoo t);
847 private static native void nativeTest3(Prefix t);
848 private static native void nativeTest4(Bar$Inner t);
842 } 849 }
843 """ 850 """
844 jni_generator.JniParams.SetJarJarMappings( 851 jni_generator.JniParams.SetJarJarMappings(
845 """rule org.chromium.example.** com.test.@1 852 """rule org.chromium.example.** com.test.@1
846 rule org.chromium.example2.** org.test2.@0""") 853 rule org.chromium.example2.** org.test2.@1
854 rule org.chromium.example3.Prefix org.test3.Test
855 rule org.chromium.example3.Bar$** org.test3.TestBar$@1""")
847 jni_from_java = jni_generator.JNIFromJavaSource( 856 jni_from_java = jni_generator.JNIFromJavaSource(
848 test_data, 'org/chromium/example/jni_generator/Example', TestOptions()) 857 test_data, 'org/chromium/example/jni_generator/Example', TestOptions())
849 jni_generator.JniParams.SetJarJarMappings('') 858 jni_generator.JniParams.SetJarJarMappings('')
850 self.assertGoldenTextEquals(jni_from_java.GetContent()) 859 self.assertGoldenTextEquals(jni_from_java.GetContent())
851 860
852 def testImports(self): 861 def testImports(self):
853 import_header = """ 862 import_header = """
854 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 863 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
855 // Use of this source code is governed by a BSD-style license that can be 864 // Use of this source code is governed by a BSD-style license that can be
856 // found in the LICENSE file. 865 // found in the LICENSE file.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1080 }
1072 """ 1081 """
1073 jni_from_java = jni_generator.JNIFromJavaSource(test_data, 1082 jni_from_java = jni_generator.JNIFromJavaSource(test_data,
1074 'org/chromium/foo/Foo', 1083 'org/chromium/foo/Foo',
1075 TestOptions()) 1084 TestOptions())
1076 self.assertGoldenTextEquals(jni_from_java.GetContent()) 1085 self.assertGoldenTextEquals(jni_from_java.GetContent())
1077 1086
1078 1087
1079 if __name__ == '__main__': 1088 if __name__ == '__main__':
1080 unittest.main() 1089 unittest.main()
OLDNEW
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | base/android/jni_generator/testJarJarRemapping.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698