| OLD | NEW | 
|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 unittest | 5 import unittest | 
| 6 import module | 6 import module | 
| 7 | 7 | 
| 8 try: | 8 try: | 
| 9   import mojom_translator | 9   import mojom_translator | 
| 10   from generated import mojom_files_mojom | 10   from generated import mojom_files_mojom | 
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 349 | 349 | 
| 350     # Translate should create the imports. | 350     # Translate should create the imports. | 
| 351     translator = mojom_translator.FileTranslator(graph, 'a.mojom') | 351     translator = mojom_translator.FileTranslator(graph, 'a.mojom') | 
| 352     translator.Translate() | 352     translator.Translate() | 
| 353 | 353 | 
| 354     struct = translator.UserDefinedFromTypeRef( | 354     struct = translator.UserDefinedFromTypeRef( | 
| 355         mojom_types_mojom.Type( | 355         mojom_types_mojom.Type( | 
| 356           type_reference=mojom_types_mojom.TypeReference( | 356           type_reference=mojom_types_mojom.TypeReference( | 
| 357             type_key=type_key))) | 357             type_key=type_key))) | 
| 358 | 358 | 
| 359     self.assertIsNone(struct.module) | 359     self.assertEquals( | 
|  | 360         translator._imports['root/c.mojom']['module'], struct.module) | 
| 360     self.assertEquals(translator._imports['root/c.mojom'], struct.imported_from) | 361     self.assertEquals(translator._imports['root/c.mojom'], struct.imported_from) | 
| 361 | 362 | 
| 362   def test_interface(self): | 363   def test_interface(self): | 
| 363     file_name = 'a.mojom' | 364     file_name = 'a.mojom' | 
| 364     mojom_interface = mojom_types_mojom.MojomInterface( | 365     mojom_interface = mojom_types_mojom.MojomInterface( | 
| 365         decl_data=mojom_types_mojom.DeclarationData( | 366         decl_data=mojom_types_mojom.DeclarationData( | 
| 366           source_file_info=mojom_types_mojom.SourceFileInfo( | 367           source_file_info=mojom_types_mojom.SourceFileInfo( | 
| 367             file_name=file_name)), | 368             file_name=file_name)), | 
| 368         interface_name='AnInterface') | 369         interface_name='AnInterface') | 
| 369     mojom_method = mojom_types_mojom.MojomMethod( | 370     mojom_method = mojom_types_mojom.MojomMethod( | 
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 686     result2 = t.KindFromMojom(mojom_type) | 687     result2 = t.KindFromMojom(mojom_type) | 
| 687     self.assertIs(result, result2) | 688     self.assertIs(result, result2) | 
| 688 | 689 | 
| 689     # Nullable type reference | 690     # Nullable type reference | 
| 690     mojom_type.type_reference.nullable = True | 691     mojom_type.type_reference.nullable = True | 
| 691     nullable_result = t.KindFromMojom(mojom_type) | 692     nullable_result = t.KindFromMojom(mojom_type) | 
| 692     self.assertTrue(module.IsNullableKind(nullable_result)) | 693     self.assertTrue(module.IsNullableKind(nullable_result)) | 
| 693 | 694 | 
| 694 if __name__ == '__main__': | 695 if __name__ == '__main__': | 
| 695   unittest.main() | 696   unittest.main() | 
| OLD | NEW | 
|---|