| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import mojo_unittest | 5 import mojo_unittest |
| 6 from mojo.bindings import reflection | 6 from mojo_bindings import reflection |
| 7 | 7 |
| 8 | 8 |
| 9 class GenerationTest(mojo_unittest.MojoTestCase): | 9 class GenerationTest(mojo_unittest.MojoTestCase): |
| 10 | 10 |
| 11 TEST_PACKAGES = [ | 11 TEST_PACKAGES = [ |
| 12 'math_calculator_mojom', | 12 'math_calculator_mojom', |
| 13 'no_module_mojom', | 13 'no_module_mojom', |
| 14 'rect_mojom', | 14 'rect_mojom', |
| 15 'regression_tests_mojom', | 15 'regression_tests_mojom', |
| 16 'sample_factory_mojom', | 16 'sample_factory_mojom', |
| 17 'sample_import2_mojom', | 17 'sample_import2_mojom', |
| 18 'sample_import_mojom', | 18 'sample_import_mojom', |
| 19 'sample_interfaces_mojom', | 19 'sample_interfaces_mojom', |
| 20 'sample_service_mojom', | 20 'sample_service_mojom', |
| 21 'serialization_test_structs_mojom', | 21 'serialization_test_structs_mojom', |
| 22 'test_structs_mojom', | 22 'test_structs_mojom', |
| 23 'validation_test_interfaces_mojom', | 23 'validation_test_interfaces_mojom', |
| 24 ] | 24 ] |
| 25 | 25 |
| 26 @staticmethod | 26 @staticmethod |
| 27 def testGeneration(): | 27 def testGeneration(): |
| 28 buildable_types = (reflection.MojoStructType, reflection.MojoInterfaceType) | 28 buildable_types = (reflection.MojoStructType, reflection.MojoInterfaceType) |
| 29 for module_name in GenerationTest.TEST_PACKAGES: | 29 for module_name in GenerationTest.TEST_PACKAGES: |
| 30 module = __import__(module_name) | 30 module = __import__(module_name) |
| 31 for element_name in dir(module): | 31 for element_name in dir(module): |
| 32 element = getattr(module, element_name) | 32 element = getattr(module, element_name) |
| 33 if isinstance(element, buildable_types): | 33 if isinstance(element, buildable_types): |
| 34 # Check struct and interface are buildable | 34 # Check struct and interface are buildable |
| 35 element() | 35 element() |
| OLD | NEW |