| 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 import idl_schema | 6 import idl_schema |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 from json_parse import OrderedDict | 9 from json_parse import OrderedDict |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 'x': {'name': 'x', 'type': 'integer', 'enum': [1,2], | 72 'x': {'name': 'x', 'type': 'integer', 'enum': [1,2], |
| 73 'description': 'This comment tests "double-quotes".', | 73 'description': 'This comment tests "double-quotes".', |
| 74 'jsexterns': None}, | 74 'jsexterns': None}, |
| 75 'y': {'name': 'y', 'type': 'string'}, | 75 'y': {'name': 'y', 'type': 'string'}, |
| 76 'z': {'name': 'z', 'type': 'string'}, | 76 'z': {'name': 'z', 'type': 'string'}, |
| 77 'a': {'name': 'a', 'type': 'string'}, | 77 'a': {'name': 'a', 'type': 'string'}, |
| 78 'b': {'name': 'b', 'type': 'string'}, | 78 'b': {'name': 'b', 'type': 'string'}, |
| 79 'c': {'name': 'c', 'type': 'string'}}, | 79 'c': {'name': 'c', 'type': 'string'}}, |
| 80 getType(self.idl_basics, 'MyType1')['properties']) | 80 getType(self.idl_basics, 'MyType1')['properties']) |
| 81 | 81 |
| 82 def testIOThreadFunc(self): |
| 83 schema = self.idl_basics |
| 84 |
| 85 func = getFunction(schema, 'function32') |
| 86 self.assertTrue(func is not None) |
| 87 self.assertTrue(func['forIOThread']) |
| 88 |
| 89 func = getFunction(schema, 'function1') |
| 90 self.assertTrue(func is not None) |
| 91 self.assertTrue('forIOThread' not in func) |
| 92 |
| 82 def testMemberOrdering(self): | 93 def testMemberOrdering(self): |
| 83 self.assertEquals( | 94 self.assertEquals( |
| 84 ['x', 'y', 'z', 'a', 'b', 'c'], | 95 ['x', 'y', 'z', 'a', 'b', 'c'], |
| 85 getType(self.idl_basics, 'MyType1')['properties'].keys()) | 96 getType(self.idl_basics, 'MyType1')['properties'].keys()) |
| 86 | 97 |
| 87 def testEnum(self): | 98 def testEnum(self): |
| 88 schema = self.idl_basics | 99 schema = self.idl_basics |
| 89 expected = {'enum': [{'name': 'name1', 'description': 'comment1'}, | 100 expected = {'enum': [{'name': 'name1', 'description': 'comment1'}, |
| 90 {'name': 'name2'}], | 101 {'name': 'name2'}], |
| 91 'description': 'Enum description', | 102 'description': 'Enum description', |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 ('fourth', OrderedDict([ | 433 ('fourth', OrderedDict([ |
| 423 ('description', 'Unvalued property.'), | 434 ('description', 'Unvalued property.'), |
| 424 ('jsexterns', None), | 435 ('jsexterns', None), |
| 425 ('type', 'integer'), | 436 ('type', 'integer'), |
| 426 ])), | 437 ])), |
| 427 ]), schema.get('properties')) | 438 ]), schema.get('properties')) |
| 428 | 439 |
| 429 | 440 |
| 430 if __name__ == '__main__': | 441 if __name__ == '__main__': |
| 431 unittest.main() | 442 unittest.main() |
| OLD | NEW |