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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 name='nativeDataFetcherImplAndroid'), | 194 name='nativeDataFetcherImplAndroid'), |
195 Param(datatype='double', | 195 Param(datatype='double', |
196 name='alpha'), | 196 name='alpha'), |
197 Param(datatype='double', | 197 Param(datatype='double', |
198 name='beta'), | 198 name='beta'), |
199 Param(datatype='double', | 199 Param(datatype='double', |
200 name='gamma'), | 200 name='gamma'), |
201 ], | 201 ], |
202 java_class_name=None, | 202 java_class_name=None, |
203 type='method', | 203 type='method', |
204 p0_type='device_orientation::DataFetcherImplAndroid'), | 204 p0_type='content::DataFetcherImplAndroid'), |
205 ] | 205 ] |
206 self.assertListEquals(golden_natives, natives) | 206 self.assertListEquals(golden_natives, natives) |
207 h = jni_generator.InlHeaderFileGenerator('', 'org/chromium/TestJni', | 207 h = jni_generator.InlHeaderFileGenerator('', 'org/chromium/TestJni', |
208 natives, []) | 208 natives, []) |
209 golden_content = """\ | 209 golden_content = """\ |
210 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 210 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
211 // Use of this source code is governed by a BSD-style license that can be | 211 // Use of this source code is governed by a BSD-style license that can be |
212 // found in the LICENSE file. | 212 // found in the LICENSE file. |
213 | 213 |
214 // This file is autogenerated by | 214 // This file is autogenerated by |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 test_data, ('com/google/lookhowextremelylongiam/snarf/' | 1503 test_data, ('com/google/lookhowextremelylongiam/snarf/' |
1504 'icankeepthisupallday/ReallyLongClassNamesAreAllTheRage')) | 1504 'icankeepthisupallday/ReallyLongClassNamesAreAllTheRage')) |
1505 jni_lines = jni_from_java.GetContent().split('\n') | 1505 jni_lines = jni_from_java.GetContent().split('\n') |
1506 line = filter(lambda line: line.lstrip().startswith('#ifndef'), | 1506 line = filter(lambda line: line.lstrip().startswith('#ifndef'), |
1507 jni_lines)[0] | 1507 jni_lines)[0] |
1508 self.assertTrue(len(line) > 80, | 1508 self.assertTrue(len(line) > 80, |
1509 ('Expected #ifndef line to be > 80 chars: ', line)) | 1509 ('Expected #ifndef line to be > 80 chars: ', line)) |
1510 | 1510 |
1511 if __name__ == '__main__': | 1511 if __name__ == '__main__': |
1512 unittest.main() | 1512 unittest.main() |
OLD | NEW |