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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 | 1549 |
1550 import java.util.ArrayList; | 1550 import java.util.ArrayList; |
1551 | 1551 |
1552 import org.chromium.base.CalledByNative; | 1552 import org.chromium.base.CalledByNative; |
1553 import org.chromium.base.JNINamespace; | 1553 import org.chromium.base.JNINamespace; |
1554 import org.chromium.content.app.ContentMain; | 1554 import org.chromium.content.app.ContentMain; |
1555 import org.chromium.content.browser.SandboxedProcessConnection; | 1555 import org.chromium.content.browser.SandboxedProcessConnection; |
1556 import org.chromium.content.common.ISandboxedProcessCallback; | 1556 import org.chromium.content.common.ISandboxedProcessCallback; |
1557 import org.chromium.content.common.ISandboxedProcessService; | 1557 import org.chromium.content.common.ISandboxedProcessService; |
1558 import org.chromium.content.common.SurfaceCallback; | 1558 import org.chromium.content.common.SurfaceCallback; |
| 1559 import org.chromium.content.common.WillNotRaise.AnException; |
| 1560 import org.chromium.content.common.WillRaise.AnException; |
1559 | 1561 |
1560 import static org.chromium.Bar.Zoo; | 1562 import static org.chromium.Bar.Zoo; |
1561 | 1563 |
1562 class Foo { | 1564 class Foo { |
1563 public static class BookmarkNode implements Parcelable { | 1565 public static class BookmarkNode implements Parcelable { |
1564 } | 1566 } |
1565 public interface PasswordListObserver { | 1567 public interface PasswordListObserver { |
1566 } | 1568 } |
1567 } | 1569 } |
1568 """ | 1570 """ |
1569 jni_generator.JniParams.SetFullyQualifiedClass( | 1571 jni_generator.JniParams.SetFullyQualifiedClass( |
1570 'org/chromium/content/app/Foo') | 1572 'org/chromium/content/app/Foo') |
1571 jni_generator.JniParams.ExtractImportsAndInnerClasses(import_header) | 1573 jni_generator.JniParams.ExtractImportsAndInnerClasses(import_header) |
1572 self.assertTrue('Lorg/chromium/content/common/ISandboxedProcessService' in | 1574 self.assertTrue('Lorg/chromium/content/common/ISandboxedProcessService' in |
1573 jni_generator.JniParams._imports) | 1575 jni_generator.JniParams._imports) |
1574 self.assertTrue('Lorg/chromium/Bar/Zoo' in | 1576 self.assertTrue('Lorg/chromium/Bar/Zoo' in |
1575 jni_generator.JniParams._imports) | 1577 jni_generator.JniParams._imports) |
1576 self.assertTrue('Lorg/chromium/content/app/Foo$BookmarkNode' in | 1578 self.assertTrue('Lorg/chromium/content/app/Foo$BookmarkNode' in |
1577 jni_generator.JniParams._inner_classes) | 1579 jni_generator.JniParams._inner_classes) |
1578 self.assertTrue('Lorg/chromium/content/app/Foo$PasswordListObserver' in | 1580 self.assertTrue('Lorg/chromium/content/app/Foo$PasswordListObserver' in |
1579 jni_generator.JniParams._inner_classes) | 1581 jni_generator.JniParams._inner_classes) |
| 1582 self.assertEquals('Lorg/chromium/content/app/ContentMain$Inner', |
| 1583 jni_generator.JniParams.JavaToJni('ContentMain.Inner')) |
| 1584 self.assertRaises(SyntaxError, |
| 1585 jni_generator.JniParams.JavaToJni, |
| 1586 'AnException') |
1580 | 1587 |
1581 | 1588 |
1582 if __name__ == '__main__': | 1589 if __name__ == '__main__': |
1583 unittest.main() | 1590 unittest.main() |
OLD | NEW |