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

Unified Diff: tools/json_schema_compiler/idl_schema_test.py

Issue 11342033: Allow IDL schemas to have comments on callback functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
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 bca451b4eb254888b16f08a5f8f37c849491323c..79906bd2952a848ebe67d7bab746319208f819df 100755
--- a/tools/json_schema_compiler/idl_schema_test.py
+++ b/tools/json_schema_compiler/idl_schema_test.py
@@ -30,20 +30,20 @@ class IdlSchemaTest(unittest.TestCase):
def testSimpleCallbacks(self):
schema = self.idl_basics
- expected = [{'type':'function', 'name':'Callback1', 'parameters':[]}]
+ expected = [{'type':'function', 'name':'cb', 'parameters':[]}]
self.assertEquals(expected, getParams(schema, 'function4'))
- expected = [{'type':'function', 'name':'Callback2',
+ expected = [{'type':'function', 'name':'cb',
'parameters':[{'name':'x', 'type':'integer'}]}]
self.assertEquals(expected, getParams(schema, 'function5'))
- expected = [{'type':'function', 'name':'Callback3',
+ expected = [{'type':'function', 'name':'cb',
'parameters':[{'name':'arg', '$ref':'idl_basics.MyType1'}]}]
self.assertEquals(expected, getParams(schema, 'function6'))
def testCallbackWithArrayArgument(self):
schema = self.idl_basics
- expected = [{'type':'function', 'name':'Callback4',
+ expected = [{'type':'function', 'name':'cb',
'parameters':[{'name':'arg', 'type':'array',
'items':{'$ref':'idl_basics.MyType2'}}]}]
self.assertEquals(expected, getParams(schema, 'function12'))
@@ -70,7 +70,7 @@ class IdlSchemaTest(unittest.TestCase):
self.assertEquals(expected, getType(schema, expected['id']))
expected = [{'name':'type', '$ref':'idl_basics.EnumType'},
- {'type':'function', 'name':'Callback5',
+ {'type':'function', 'name':'cb',
'parameters':[{'name':'type', '$ref':'idl_basics.EnumType'}]}]
self.assertEquals(expected, getParams(schema, 'function13'))
@@ -90,6 +90,20 @@ class IdlSchemaTest(unittest.TestCase):
self.assertTrue(idl_basics['internal'])
self.assertFalse(idl_basics['nodoc'])
+ def testCallbackComment(self):
+ schema = self.idl_basics
+ self.assertEquals('A comment on a callback.',
+ getParams(schema, 'function16')[0]['description'])
+ self.assertEquals(
+ 'A parameter.',
+ getParams(schema, 'function16')[0]['parameters'][0]['description'])
+ self.assertEquals(
+ 'A parameter with no parent callback.',
+ getParams(schema, 'function17')[0]['parameters'][0]['description'])
+ self.assertEquals(
+ 'Override callback comment.',
+ getParams(schema, 'function18')[0]['description'])
+
def testFunctionComment(self):
schema = self.idl_basics
func = getFunction(schema, 'function3')

Powered by Google App Engine
This is Rietveld 408576698