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 def getFunction(schema, name): | 9 def getFunction(schema, name): |
10 for item in schema['functions']: | 10 for item in schema['functions']: |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 def testReservedWords(self): | 139 def testReservedWords(self): |
140 schema = idl_schema.Load('test/idl_reserved_words.idl')[0] | 140 schema = idl_schema.Load('test/idl_reserved_words.idl')[0] |
141 | 141 |
142 foo_type = getType(schema, 'Foo') | 142 foo_type = getType(schema, 'Foo') |
143 self.assertEquals(['float', 'DOMString'], foo_type['enum']) | 143 self.assertEquals(['float', 'DOMString'], foo_type['enum']) |
144 | 144 |
145 enum_type = getType(schema, 'enum') | 145 enum_type = getType(schema, 'enum') |
146 self.assertEquals(['callback', 'namespace'], enum_type['enum']) | 146 self.assertEquals(['callback', 'namespace'], enum_type['enum']) |
147 | 147 |
148 dictionary = getType(schema, 'dictionary'); | 148 dictionary = getType(schema, 'dictionary') |
149 self.assertEquals('integer', dictionary['properties']['long']['type']) | 149 self.assertEquals('integer', dictionary['properties']['long']['type']) |
150 | 150 |
151 mytype = getType(schema, 'MyType') | 151 mytype = getType(schema, 'MyType') |
152 self.assertEquals('string', mytype['properties']['interface']['type']) | 152 self.assertEquals('string', mytype['properties']['interface']['type']) |
153 | 153 |
154 params = getParams(schema, 'static') | 154 params = getParams(schema, 'static') |
155 self.assertEquals('Foo', params[0]['$ref']) | 155 self.assertEquals('Foo', params[0]['$ref']) |
156 self.assertEquals('enum', params[1]['$ref']) | 156 self.assertEquals('enum', params[1]['$ref']) |
157 | 157 |
158 if __name__ == '__main__': | 158 if __name__ == '__main__': |
159 unittest.main() | 159 unittest.main() |
OLD | NEW |