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

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

Issue 10367002: Make all extension api types fully qualified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix webrequest tests 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(['Tab'], self.tabs.types.keys()) 35 self.assertEquals(['tabs.Tab'], self.tabs.types.keys())
36 self.assertEquals(['Permissions'], self.permissions.types.keys()) 36 self.assertEquals(['permissions.Permissions'],
37 self.assertEquals(['Window'], self.windows.types.keys()) 37 self.permissions.types.keys())
38 self.assertEquals(['windows.Window'], self.windows.types.keys())
38 39
39 def testHasProperties(self): 40 def testHasProperties(self):
40 self.assertEquals(["active", "favIconUrl", "highlighted", "id", 41 self.assertEquals(["active", "favIconUrl", "highlighted", "id",
41 "incognito", "index", "pinned", "selected", "status", "title", "url", 42 "incognito", "index", "pinned", "selected", "status", "title", "url",
42 "windowId"], 43 "windowId"],
43 sorted(self.tabs.types['Tab'].properties.keys())) 44 sorted(self.tabs.types['tabs.Tab'].properties.keys()))
44 45
45 def testProperties(self): 46 def testProperties(self):
46 string_prop = self.tabs.types['Tab'].properties['status'] 47 string_prop = self.tabs.types['tabs.Tab'].properties['status']
47 self.assertEquals(model.PropertyType.STRING, string_prop.type_) 48 self.assertEquals(model.PropertyType.STRING, string_prop.type_)
48 integer_prop = self.tabs.types['Tab'].properties['id'] 49 integer_prop = self.tabs.types['tabs.Tab'].properties['id']
49 self.assertEquals(model.PropertyType.INTEGER, integer_prop.type_) 50 self.assertEquals(model.PropertyType.INTEGER, integer_prop.type_)
50 array_prop = self.windows.types['Window'].properties['tabs'] 51 array_prop = self.windows.types['windows.Window'].properties['tabs']
51 self.assertEquals(model.PropertyType.ARRAY, array_prop.type_) 52 self.assertEquals(model.PropertyType.ARRAY, array_prop.type_)
52 self.assertEquals(model.PropertyType.REF, array_prop.item_type.type_) 53 self.assertEquals(model.PropertyType.REF, array_prop.item_type.type_)
53 self.assertEquals('Tab', array_prop.item_type.ref_type) 54 self.assertEquals('tabs.Tab', array_prop.item_type.ref_type)
54 object_prop = self.tabs.functions['query'].params[0] 55 object_prop = self.tabs.functions['query'].params[0]
55 self.assertEquals(model.PropertyType.OBJECT, object_prop.type_) 56 self.assertEquals(model.PropertyType.OBJECT, object_prop.type_)
56 self.assertEquals( 57 self.assertEquals(
57 ["active", "highlighted", "pinned", "status", "title", "url", 58 ["active", "highlighted", "pinned", "status", "title", "url",
58 "windowId", "windowType"], 59 "windowId", "windowType"],
59 sorted(object_prop.properties.keys())) 60 sorted(object_prop.properties.keys()))
60 61
61 def testChoices(self): 62 def testChoices(self):
62 self.assertEquals(model.PropertyType.CHOICES, 63 self.assertEquals(model.PropertyType.CHOICES,
63 self.tabs.functions['move'].params[0].type_) 64 self.tabs.functions['move'].params[0].type_)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 'FOOBar': 'foo_bar', 98 'FOOBar': 'foo_bar',
98 'foo.bar': 'foo_bar', 99 'foo.bar': 'foo_bar',
99 'foo.BAR': 'foo_bar', 100 'foo.BAR': 'foo_bar',
100 'foo.barBAZ': 'foo_bar_baz' 101 'foo.barBAZ': 'foo_bar_baz'
101 } 102 }
102 for name in expectations: 103 for name in expectations:
103 self.assertEquals(expectations[name], model._UnixName(name)); 104 self.assertEquals(expectations[name], model._UnixName(name));
104 105
105 if __name__ == '__main__': 106 if __name__ == '__main__':
106 unittest.main() 107 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