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

Unified Diff: tools/json_schema_compiler/cpp_type_generator_test.py

Issue 10701012: JSON Schema Compiler: Added event compilation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. Created 8 years, 5 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/cpp_type_generator.py ('k') | tools/json_schema_compiler/h_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/cpp_type_generator_test.py
diff --git a/tools/json_schema_compiler/cpp_type_generator_test.py b/tools/json_schema_compiler/cpp_type_generator_test.py
index 7c74fad5470baf5c44a1d43c0fa466a94b9ad732..a9408fa73002e51be17bfebf38c8730f64d4ec18 100755
--- a/tools/json_schema_compiler/cpp_type_generator_test.py
+++ b/tools/json_schema_compiler/cpp_type_generator_test.py
@@ -11,6 +11,10 @@ import unittest
class CppTypeGeneratorTest(unittest.TestCase):
def setUp(self):
self.model = model.Model()
+ self.forbidden_json = CachedLoad('test/forbidden.json')
+ self.model.AddNamespace(self.forbidden_json[0],
+ 'path/to/forbidden.json')
+ self.forbidden = self.model.namespaces.get('forbidden')
self.permissions_json = CachedLoad('test/permissions.json')
self.model.AddNamespace(self.permissions_json[0],
'path/to/permissions.json')
@@ -214,15 +218,33 @@ class CppTypeGeneratorTest(unittest.TestCase):
'} // extensions',
manager.GetRootNamespaceEnd().Render())
- def testExpandChoicesInParams(self):
+ def testExpandParams(self):
manager = CppTypeGenerator('extensions', self.tabs,
self.tabs.unix_name)
props = self.tabs.functions['move'].params
self.assertEquals(2, len(props))
- self.assertEquals(3, len(manager.GetExpandedChoicesInParams(props)))
self.assertEquals(['move_properties', 'tab_ids_array', 'tab_ids_integer'],
- sorted([x.unix_name for x in manager.GetExpandedChoicesInParams(props)])
+ sorted([x.unix_name for x in manager.ExpandParams(props)])
)
+ def testGetAllPossibleParameterLists(self):
+ manager = CppTypeGenerator('extensions', self.tabs,
+ self.tabs.unix_name)
+ props = self.forbidden.functions['forbiddenParameters'].params
+ self.assertEquals(4, len(props))
+ param_lists = manager.GetAllPossibleParameterLists(props)
+ expected_lists = [
+ ['first_choice_array', 'first_string',
+ 'second_choice_array', 'second_string'],
+ ['first_choice_array', 'first_string',
+ 'second_choice_integer', 'second_string'],
+ ['first_choice_integer', 'first_string',
+ 'second_choice_array', 'second_string'],
+ ['first_choice_integer', 'first_string',
+ 'second_choice_integer', 'second_string']]
+ result_lists = sorted([[param.unix_name for param in param_list]
+ for param_list in param_lists])
+ self.assertEquals(expected_lists, result_lists)
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « tools/json_schema_compiler/cpp_type_generator.py ('k') | tools/json_schema_compiler/h_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698