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

Unified Diff: tools/json_schema_compiler/idl_schema_test.py

Issue 11827026: Overhaul JSON Schema Compiler to support a number of features required to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/json_schema.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/idl_schema_test.py
diff --git a/tools/json_schema_compiler/idl_schema_test.py b/tools/json_schema_compiler/idl_schema_test.py
index a4fd0d859aca3e1c490b3bfeecde0a27effe3343..873333b03a5b18724704810f76b230b0591c8a70 100755
--- a/tools/json_schema_compiler/idl_schema_test.py
+++ b/tools/json_schema_compiler/idl_schema_test.py
@@ -38,14 +38,14 @@ class IdlSchemaTest(unittest.TestCase):
self.assertEquals(expected, getParams(schema, 'function5'))
expected = [{'type':'function', 'name':'cb',
- 'parameters':[{'name':'arg', '$ref':'idl_basics.MyType1'}]}]
+ 'parameters':[{'name':'arg', '$ref':'MyType1'}]}]
self.assertEquals(expected, getParams(schema, 'function6'))
def testCallbackWithArrayArgument(self):
schema = self.idl_basics
expected = [{'type':'function', 'name':'cb',
'parameters':[{'name':'arg', 'type':'array',
- 'items':{'$ref':'idl_basics.MyType2'}}]}]
+ 'items':{'$ref':'MyType2'}}]}]
self.assertEquals(expected, getParams(schema, 'function12'))
@@ -61,20 +61,20 @@ class IdlSchemaTest(unittest.TestCase):
'x': {'name': 'x', 'type': 'integer', 'enum': [1,2],
'description': 'This comment tests "double-quotes".'},
'y': {'name': 'y', 'type': 'string'}},
- getType(self.idl_basics, 'idl_basics.MyType1')['properties'])
+ getType(self.idl_basics, 'MyType1')['properties'])
def testEnum(self):
schema = self.idl_basics
expected = {'enum': ['name1', 'name2'], 'description': 'Enum description',
- 'type': 'string', 'id': 'idl_basics.EnumType'}
+ 'type': 'string', 'id': 'EnumType'}
self.assertEquals(expected, getType(schema, expected['id']))
- expected = [{'name':'type', '$ref':'idl_basics.EnumType'},
+ expected = [{'name':'type', '$ref':'EnumType'},
{'type':'function', 'name':'cb',
- 'parameters':[{'name':'type', '$ref':'idl_basics.EnumType'}]}]
+ 'parameters':[{'name':'type', '$ref':'EnumType'}]}]
self.assertEquals(expected, getParams(schema, 'function13'))
- expected = [{'items': {'$ref': 'idl_basics.EnumType'}, 'name': 'types',
+ expected = [{'items': {'$ref': 'EnumType'}, 'name': 'types',
'type': 'array'}]
self.assertEquals(expected, getParams(schema, 'function14'))
@@ -114,7 +114,7 @@ class IdlSchemaTest(unittest.TestCase):
[{'description': ('So should this comment about the argument. '
'<em>HTML</em> is fine too.'),
'name': 'arg',
- '$ref': 'idl_basics.MyType1'}],
+ '$ref': 'MyType1'}],
func['parameters'])
func = getFunction(schema, 'function4')
self.assertEquals(('This tests if "double-quotes" are escaped correctly.'
@@ -124,21 +124,21 @@ class IdlSchemaTest(unittest.TestCase):
def testReservedWords(self):
schema = idl_schema.Load('test/idl_reserved_words.idl')[0]
- foo_type = getType(schema, 'reserved_words.Foo')
+ foo_type = getType(schema, 'Foo')
self.assertEquals(['float', 'DOMString'], foo_type['enum'])
- enum_type = getType(schema, 'reserved_words.enum')
+ enum_type = getType(schema, 'enum')
self.assertEquals(['callback', 'namespace'], enum_type['enum'])
- dictionary = getType(schema, 'reserved_words.dictionary');
+ dictionary = getType(schema, 'dictionary');
self.assertEquals('integer', dictionary['properties']['long']['type'])
- mytype = getType(schema, 'reserved_words.MyType')
+ mytype = getType(schema, 'MyType')
self.assertEquals('string', mytype['properties']['interface']['type'])
params = getParams(schema, 'static')
- self.assertEquals('reserved_words.Foo', params[0]['$ref'])
- self.assertEquals('reserved_words.enum', params[1]['$ref'])
+ self.assertEquals('Foo', params[0]['$ref'])
+ self.assertEquals('enum', params[1]['$ref'])
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/json_schema.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698