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

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

Issue 10080014: Fix a bug in IDL parsing related to arrays of callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added in test file Created 8 years, 8 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 | Annotate | Revision Log
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 def getFunction(schema, name): 9 def getFunction(schema, name):
10 for item in schema['functions']: 10 for item in schema['functions']:
(...skipping 25 matching lines...) Expand all
36 'parameters':[{'name':'arg', '$ref':'MyType1'}]}] 36 'parameters':[{'name':'arg', '$ref':'MyType1'}]}]
37 self.assertEquals(expected, getParams(schema, 'function6')) 37 self.assertEquals(expected, getParams(schema, 'function6'))
38 38
39 def testCallbackWithArrayArgument(self): 39 def testCallbackWithArrayArgument(self):
40 schema = self.idl_basics 40 schema = self.idl_basics
41 expected = [{'type':'function', 'name':'Callback4', 41 expected = [{'type':'function', 'name':'Callback4',
42 'parameters':[{'name':'arg', 'type':'array', 42 'parameters':[{'name':'arg', 'type':'array',
43 'items':{'$ref':'MyType2'}}]}] 43 'items':{'$ref':'MyType2'}}]}]
44 self.assertEquals(expected, getParams(schema, 'function12')) 44 self.assertEquals(expected, getParams(schema, 'function12'))
45 45
46
47 def testArrayOfCallbacks(self):
48 schema = idl_schema.Load('test/idl_callback_arrays.idl')[0]
49 expected = [{'type':'array', 'name':'callbacks',
50 'items':{'type':'function', 'name':'MyCallback',
51 'parameters':[{'type':'integer', 'name':'x'}]}}]
52 self.assertEquals(expected, getParams(schema, 'whatever'))
53
46 if __name__ == '__main__': 54 if __name__ == '__main__':
47 unittest.main() 55 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/test/idl_callback_arrays.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698