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

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

Issue 2531273002: android: Realign stack pointer on JNI entry. (Closed)
Patch Set: Rename golden test file to satisfy presubmit Created 4 years 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
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 """ 827 """
828 self.assertRaises(SyntaxError, 828 self.assertRaises(SyntaxError,
829 jni_generator.JNIFromJavaSource, 829 jni_generator.JNIFromJavaSource,
830 test_data, 'foo/bar', TestOptions()) 830 test_data, 'foo/bar', TestOptions())
831 831
832 def testJniSelfDocumentingExample(self): 832 def testJniSelfDocumentingExample(self):
833 script_dir = os.path.dirname(sys.argv[0]) 833 script_dir = os.path.dirname(sys.argv[0])
834 content = file(os.path.join(script_dir, 834 content = file(os.path.join(script_dir,
835 'java/src/org/chromium/example/jni_generator/SampleForTests.java') 835 'java/src/org/chromium/example/jni_generator/SampleForTests.java')
836 ).read() 836 ).read()
837 golden_file = os.path.join(script_dir, 'golden_sample_for_tests_jni.h') 837 golden_file = os.path.join(script_dir, 'SampleForTests_jni.golden')
838 golden_content = file(golden_file).read() 838 golden_content = file(golden_file).read()
839 jni_from_java = jni_generator.JNIFromJavaSource( 839 jni_from_java = jni_generator.JNIFromJavaSource(
840 content, 'org/chromium/example/jni_generator/SampleForTests', 840 content, 'org/chromium/example/jni_generator/SampleForTests',
841 TestOptions()) 841 TestOptions())
842 generated_text = jni_from_java.GetContent() 842 generated_text = jni_from_java.GetContent()
843 if not self.compareText(golden_content, generated_text): 843 if not self.compareText(golden_content, generated_text):
844 if os.environ.get(REBASELINE_ENV): 844 if os.environ.get(REBASELINE_ENV):
845 with file(golden_file, 'w') as f: 845 with file(golden_file, 'w') as f:
846 f.write(generated_text) 846 f.write(generated_text)
847 return 847 return
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 test_result = unittest.main(argv=argv[0:1], exit=False) 1061 test_result = unittest.main(argv=argv[0:1], exit=False)
1062 1062
1063 if test_result.result.wasSuccessful() and options.stamp: 1063 if test_result.result.wasSuccessful() and options.stamp:
1064 TouchStamp(options.stamp) 1064 TouchStamp(options.stamp)
1065 1065
1066 return not test_result.result.wasSuccessful() 1066 return not test_result.result.wasSuccessful()
1067 1067
1068 1068
1069 if __name__ == '__main__': 1069 if __name__ == '__main__':
1070 sys.exit(main(sys.argv)) 1070 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « base/android/jni_generator/jni_generator_helper.h ('k') | base/android/jni_generator/testInnerClassNatives.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698