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

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

Issue 9447090: Allow comments in extension config files. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed up license headers to pass license tests Created 8 years, 9 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
« no previous file with comments | « tools/json_schema_compiler/json_schema.py ('k') | tools/json_schema_compiler/previewserver.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 from json_schema import LoadJSON
6 import model 6 import model
7 import unittest 7 import unittest
8 8
9 class ModelTest(unittest.TestCase): 9 class ModelTest(unittest.TestCase):
10 def setUp(self): 10 def setUp(self):
11 self.model = model.Model() 11 self.model = model.Model()
12 self.permissions_json = json.loads(open('test/permissions.json').read()) 12 self.permissions_json = LoadJSON('test/permissions.json')
13 self.model.AddNamespace(self.permissions_json[0], 13 self.model.AddNamespace(self.permissions_json[0],
14 'path/to/permissions.json') 14 'path/to/permissions.json')
15 self.permissions = self.model.namespaces.get('permissions') 15 self.permissions = self.model.namespaces.get('permissions')
16 self.windows_json = json.loads(open('test/windows.json').read()) 16 self.windows_json = LoadJSON('test/windows.json')
17 self.model.AddNamespace(self.windows_json[0], 17 self.model.AddNamespace(self.windows_json[0],
18 'path/to/window.json') 18 'path/to/window.json')
19 self.windows = self.model.namespaces.get('windows') 19 self.windows = self.model.namespaces.get('windows')
20 self.tabs_json = json.loads(open('test/tabs.json').read()) 20 self.tabs_json = LoadJSON('test/tabs.json')
21 self.model.AddNamespace(self.tabs_json[0], 21 self.model.AddNamespace(self.tabs_json[0],
22 'path/to/tabs.json') 22 'path/to/tabs.json')
23 self.tabs = self.model.namespaces.get('tabs') 23 self.tabs = self.model.namespaces.get('tabs')
24 24
25 def testNamespaces(self): 25 def testNamespaces(self):
26 self.assertEquals(3, len(self.model.namespaces)) 26 self.assertEquals(3, len(self.model.namespaces))
27 self.assertTrue(self.permissions) 27 self.assertTrue(self.permissions)
28 28
29 def testNamespaceNoCompile(self): 29 def testNamespaceNoCompile(self):
30 self.permissions_json[0]['namespace'] = 'something' 30 self.permissions_json[0]['namespace'] = 'something'
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 param.choices[model.PropertyType.INTEGER].GetUnixName) 96 param.choices[model.PropertyType.INTEGER].GetUnixName)
97 param.choices[model.PropertyType.INTEGER].unix_name = 'asdf' 97 param.choices[model.PropertyType.INTEGER].unix_name = 'asdf'
98 param.choices[model.PropertyType.INTEGER].unix_name = 'tab_ids_integer' 98 param.choices[model.PropertyType.INTEGER].unix_name = 'tab_ids_integer'
99 self.assertEquals('tab_ids_integer', 99 self.assertEquals('tab_ids_integer',
100 param.choices[model.PropertyType.INTEGER].unix_name) 100 param.choices[model.PropertyType.INTEGER].unix_name)
101 self.assertRaises(AttributeError, 101 self.assertRaises(AttributeError,
102 param.choices[model.PropertyType.INTEGER].SetUnixName, 'breakage') 102 param.choices[model.PropertyType.INTEGER].SetUnixName, 'breakage')
103 103
104 if __name__ == '__main__': 104 if __name__ == '__main__':
105 unittest.main() 105 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/json_schema.py ('k') | tools/json_schema_compiler/previewserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698