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

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

Issue 10381089: Revert 136296 - Make all extension api types fully qualified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « tools/json_schema_compiler/json_schema.py ('k') | tools/json_schema_compiler/schema_util.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 #!/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 from json_schema import CachedLoad 6 from json_schema import CachedLoad
7 import model 7 import model
8 import unittest 8 import unittest
9 9
10 class ModelTest(unittest.TestCase): 10 class ModelTest(unittest.TestCase):
(...skipping 14 matching lines...) Expand all
25 25
26 def testNamespaces(self): 26 def testNamespaces(self):
27 self.assertEquals(3, len(self.model.namespaces)) 27 self.assertEquals(3, len(self.model.namespaces))
28 self.assertTrue(self.permissions) 28 self.assertTrue(self.permissions)
29 29
30 def testHasFunctions(self): 30 def testHasFunctions(self):
31 self.assertEquals(["contains", "getAll", "remove", "request"], 31 self.assertEquals(["contains", "getAll", "remove", "request"],
32 sorted(self.permissions.functions.keys())) 32 sorted(self.permissions.functions.keys()))
33 33
34 def testHasTypes(self): 34 def testHasTypes(self):
35 self.assertEquals(['tabs.Tab'], self.tabs.types.keys()) 35 self.assertEquals(['Tab'], self.tabs.types.keys())
36 self.assertEquals(['permissions.Permissions'], 36 self.assertEquals(['Permissions'], self.permissions.types.keys())
37 self.permissions.types.keys()) 37 self.assertEquals(['Window'], self.windows.types.keys())
38 self.assertEquals(['windows.Window'], self.windows.types.keys())
39 38
40 def testHasProperties(self): 39 def testHasProperties(self):
41 self.assertEquals(["active", "favIconUrl", "highlighted", "id", 40 self.assertEquals(["active", "favIconUrl", "highlighted", "id",
42 "incognito", "index", "pinned", "selected", "status", "title", "url", 41 "incognito", "index", "pinned", "selected", "status", "title", "url",
43 "windowId"], 42 "windowId"],
44 sorted(self.tabs.types['tabs.Tab'].properties.keys())) 43 sorted(self.tabs.types['Tab'].properties.keys()))
45 44
46 def testProperties(self): 45 def testProperties(self):
47 string_prop = self.tabs.types['tabs.Tab'].properties['status'] 46 string_prop = self.tabs.types['Tab'].properties['status']
48 self.assertEquals(model.PropertyType.STRING, string_prop.type_) 47 self.assertEquals(model.PropertyType.STRING, string_prop.type_)
49 integer_prop = self.tabs.types['tabs.Tab'].properties['id'] 48 integer_prop = self.tabs.types['Tab'].properties['id']
50 self.assertEquals(model.PropertyType.INTEGER, integer_prop.type_) 49 self.assertEquals(model.PropertyType.INTEGER, integer_prop.type_)
51 array_prop = self.windows.types['windows.Window'].properties['tabs'] 50 array_prop = self.windows.types['Window'].properties['tabs']
52 self.assertEquals(model.PropertyType.ARRAY, array_prop.type_) 51 self.assertEquals(model.PropertyType.ARRAY, array_prop.type_)
53 self.assertEquals(model.PropertyType.REF, array_prop.item_type.type_) 52 self.assertEquals(model.PropertyType.REF, array_prop.item_type.type_)
54 self.assertEquals('tabs.Tab', array_prop.item_type.ref_type) 53 self.assertEquals('Tab', array_prop.item_type.ref_type)
55 object_prop = self.tabs.functions['query'].params[0] 54 object_prop = self.tabs.functions['query'].params[0]
56 self.assertEquals(model.PropertyType.OBJECT, object_prop.type_) 55 self.assertEquals(model.PropertyType.OBJECT, object_prop.type_)
57 self.assertEquals( 56 self.assertEquals(
58 ["active", "highlighted", "pinned", "status", "title", "url", 57 ["active", "highlighted", "pinned", "status", "title", "url",
59 "windowId", "windowType"], 58 "windowId", "windowType"],
60 sorted(object_prop.properties.keys())) 59 sorted(object_prop.properties.keys()))
61 60
62 def testChoices(self): 61 def testChoices(self):
63 self.assertEquals(model.PropertyType.CHOICES, 62 self.assertEquals(model.PropertyType.CHOICES,
64 self.tabs.functions['move'].params[0].type_) 63 self.tabs.functions['move'].params[0].type_)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 'FOOBar': 'foo_bar', 97 'FOOBar': 'foo_bar',
99 'foo.bar': 'foo_bar', 98 'foo.bar': 'foo_bar',
100 'foo.BAR': 'foo_bar', 99 'foo.BAR': 'foo_bar',
101 'foo.barBAZ': 'foo_bar_baz' 100 'foo.barBAZ': 'foo_bar_baz'
102 } 101 }
103 for name in expectations: 102 for name in expectations:
104 self.assertEquals(expectations[name], model._UnixName(name)); 103 self.assertEquals(expectations[name], model._UnixName(name));
105 104
106 if __name__ == '__main__': 105 if __name__ == '__main__':
107 unittest.main() 106 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/json_schema.py ('k') | tools/json_schema_compiler/schema_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698