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

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

Issue 2361353002: Link stack frames of JNI stubs to JNI callbacks. (Closed)
Patch Set: git cl format Created 4 years, 1 month 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 23 matching lines...) Expand all
34 """The mock options object which is passed to the jni_generator.py script.""" 34 """The mock options object which is passed to the jni_generator.py script."""
35 35
36 def __init__(self): 36 def __init__(self):
37 self.namespace = None 37 self.namespace = None
38 self.script_name = SCRIPT_NAME 38 self.script_name = SCRIPT_NAME
39 self.includes = INCLUDES 39 self.includes = INCLUDES
40 self.ptr_type = 'long' 40 self.ptr_type = 'long'
41 self.cpp = 'cpp' 41 self.cpp = 'cpp'
42 self.javap = 'javap' 42 self.javap = 'javap'
43 self.native_exports_optional = True 43 self.native_exports_optional = True
44 self.enable_profiling = False
44 45
45 class TestGenerator(unittest.TestCase): 46 class TestGenerator(unittest.TestCase):
46 def assertObjEquals(self, first, second): 47 def assertObjEquals(self, first, second):
47 dict_first = first.__dict__ 48 dict_first = first.__dict__
48 dict_second = second.__dict__ 49 dict_second = second.__dict__
49 self.assertEquals(dict_first.keys(), dict_second.keys()) 50 self.assertEquals(dict_first.keys(), dict_second.keys())
50 for key, value in dict_first.iteritems(): 51 for key, value in dict_first.iteritems():
51 if (type(value) is list and len(value) and 52 if (type(value) is list and len(value) and
52 isinstance(type(value[0]), object)): 53 isinstance(type(value[0]), object)):
53 self.assertListEquals(value, second.__getattribute__(key)) 54 self.assertListEquals(value, second.__getattribute__(key))
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 test_result = unittest.main(argv=argv[0:1], exit=False) 1061 test_result = unittest.main(argv=argv[0:1], exit=False)
1061 1062
1062 if test_result.result.wasSuccessful() and options.stamp: 1063 if test_result.result.wasSuccessful() and options.stamp:
1063 TouchStamp(options.stamp) 1064 TouchStamp(options.stamp)
1064 1065
1065 return not test_result.result.wasSuccessful() 1066 return not test_result.result.wasSuccessful()
1066 1067
1067 1068
1068 if __name__ == '__main__': 1069 if __name__ == '__main__':
1069 sys.exit(main(sys.argv)) 1070 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | base/android/jni_generator/testCalledByNatives.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698