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

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

Issue 10850030: Do not wrap preprocessor lines in the generated JNI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit test. Created 8 years, 4 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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 1484
1485 def testJniSelfDocumentingExample(self): 1485 def testJniSelfDocumentingExample(self):
1486 script_dir = os.path.dirname(sys.argv[0]) 1486 script_dir = os.path.dirname(sys.argv[0])
1487 content = file(os.path.join(script_dir, 'SampleForTests.java')).read() 1487 content = file(os.path.join(script_dir, 'SampleForTests.java')).read()
1488 golden_content = file(os.path.join(script_dir, 1488 golden_content = file(os.path.join(script_dir,
1489 'golden_sample_for_tests_jni.h')).read() 1489 'golden_sample_for_tests_jni.h')).read()
1490 jni_from_java = jni_generator.JNIFromJavaSource( 1490 jni_from_java = jni_generator.JNIFromJavaSource(
1491 content, 'org/chromium/example/jni_generator/SampleForTests') 1491 content, 'org/chromium/example/jni_generator/SampleForTests')
1492 self.assertTextEquals(golden_content, jni_from_java.GetContent()) 1492 self.assertTextEquals(golden_content, jni_from_java.GetContent())
1493 1493
1494 def testNoWrappingPreprocessorLines(self):
1495 test_data = """
1496 package com.google.lookhowextremelylongiam.snarf.icankeepthisupallday;
1497
1498 class ReallyLongClassNamesAreAllTheRage {
1499 private static native int nativeTest();
1500 }
1501 """
1502 jni_from_java = jni_generator.JNIFromJavaSource(
1503 test_data, ('com/google/lookhowextremelylongiam/snarf/'
1504 'icankeepthisupallday/ReallyLongClassNamesAreAllTheRage'))
1505 jni_lines = jni_from_java.GetContent().split('\n')
1506 line = filter(lambda line: line.lstrip().startswith('#ifndef'),
1507 jni_lines)[0]
1508 self.assertTrue(len(line) > 80,
1509 ('Expected #ifndef line to be > 80 chars: ', line))
1510
1494 if __name__ == '__main__': 1511 if __name__ == '__main__':
1495 unittest.main() 1512 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