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

Side by Side Diff: tools/json_schema_compiler/idl_schema_test.py

Issue 2930703003: Extensions: Support forIOThread function schema attribute for IDL files. (Closed)
Patch Set: -- Created 3 years, 6 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
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 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
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
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()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/test/idl_basics.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698