diff options
author | mek@chromium.org <mek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 03:40:31 +0000 |
---|---|---|
committer | mek@chromium.org <mek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 03:40:31 +0000 |
commit | c1e5fb151ec29af7c95f2a5d8712c6f8d879ef3a (patch) | |
tree | e2c0ceabd09bc415734825ba16d473cc689ab952 /tools/json_schema_compiler | |
parent | 1e2420662fae0f8046ecbc7dd1aa458cd7b56e2d (diff) | |
download | chromium_src-c1e5fb151ec29af7c95f2a5d8712c6f8d879ef3a.zip chromium_src-c1e5fb151ec29af7c95f2a5d8712c6f8d879ef3a.tar.gz chromium_src-c1e5fb151ec29af7c95f2a5d8712c6f8d879ef3a.tar.bz2 |
Implement app.window.get() and app.window.getAll().
Also fixes the idl parser and schema compiler to support arrays as return types.
BUG=179737
Review URL: https://codereview.chromium.org/57913004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234730 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler')
-rw-r--r-- | tools/json_schema_compiler/idl_schema.py | 2 | ||||
-rwxr-xr-x | tools/json_schema_compiler/idl_schema_test.py | 22 | ||||
-rw-r--r-- | tools/json_schema_compiler/test/idl_basics.idl | 6 |
3 files changed, 29 insertions, 1 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py index c8c1c8a..b056603 100644 --- a/tools/json_schema_compiler/idl_schema.py +++ b/tools/json_schema_compiler/idl_schema.py @@ -100,7 +100,7 @@ class Callspec(object): return_type = None if self.node.GetProperty('TYPEREF') not in ('void', None): return_type = Typeref(self.node.GetProperty('TYPEREF'), - self.node, + self.node.parent, {'name': self.node.GetName()}).process(callbacks) # The IDL parser doesn't allow specifying return types as optional. # Instead we infer any object return values to be optional. diff --git a/tools/json_schema_compiler/idl_schema_test.py b/tools/json_schema_compiler/idl_schema_test.py index ca9b6e0..212efdc 100755 --- a/tools/json_schema_compiler/idl_schema_test.py +++ b/tools/json_schema_compiler/idl_schema_test.py @@ -18,6 +18,11 @@ def getParams(schema, name): return function['parameters'] +def getReturns(schema, name): + function = getFunction(schema, name) + return function['returns'] + + def getType(schema, id): for item in schema['types']: if item['id'] == id: @@ -110,6 +115,23 @@ class IdlSchemaTest(unittest.TestCase): self.assertTrue(idl_basics['internal']) self.assertFalse(idl_basics['nodoc']) + def testReturnTypes(self): + schema = self.idl_basics + self.assertEquals({'name': 'function19', 'type': 'integer'}, + getReturns(schema, 'function19')) + self.assertEquals({'name': 'function20', '$ref': 'MyType1', + 'optional': True}, + getReturns(schema, 'function20')) + self.assertEquals({'name': 'function21', 'type': 'array', + 'items': {'$ref': 'MyType1'}}, + getReturns(schema, 'function21')) + self.assertEquals({'name': 'function22', '$ref': 'EnumType', + 'optional': True}, + getReturns(schema, 'function22')) + self.assertEquals({'name': 'function23', 'type': 'array', + 'items': {'$ref': 'EnumType'}}, + getReturns(schema, 'function23')) + def testChromeOSPlatformsNamespace(self): schema = idl_schema.Load('test/idl_namespace_chromeos.idl')[0] self.assertEquals('idl_namespace_chromeos', schema['namespace']) diff --git a/tools/json_schema_compiler/test/idl_basics.idl b/tools/json_schema_compiler/test/idl_basics.idl index 05b09c5..c6f9920 100644 --- a/tools/json_schema_compiler/test/idl_basics.idl +++ b/tools/json_schema_compiler/test/idl_basics.idl @@ -80,6 +80,12 @@ static void function17(Callback7 cb); // |cb|: Override callback comment. static void function18(Callback7 cb); + + static long function19(); + static MyType1 function20(); + static MyType1[] function21(); + static EnumType function22(); + static EnumType[] function23(); }; interface Events { |