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

Side by Side Diff: chrome/common/extensions/docs/server2/availability_finder_test.py

Issue 344453003: Docserver: separate models for apps and extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test to availability_finder_test.py Created 6 years, 6 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 import os 5 import os
6 import sys 6 import sys
7 import unittest 7 import unittest
8 8
9 import api_schema_graph 9 import api_schema_graph
10 from availability_finder import AvailabilityFinder, AvailabilityInfo 10 from availability_finder import AvailabilityFinder, AvailabilityInfo
11 from branch_utility import BranchUtility, ChannelInfo 11 from branch_utility import BranchUtility, ChannelInfo
12 from compiled_file_system import CompiledFileSystem 12 from compiled_file_system import CompiledFileSystem
13 from fake_host_file_system_provider import FakeHostFileSystemProvider 13 from fake_host_file_system_provider import FakeHostFileSystemProvider
14 from fake_url_fetcher import FakeUrlFetcher 14 from fake_url_fetcher import FakeUrlFetcher
15 from host_file_system_iterator import HostFileSystemIterator 15 from host_file_system_iterator import HostFileSystemIterator
16 from mock_function import MockFunction 16 from mock_function import MockFunction
17 from object_store_creator import ObjectStoreCreator 17 from object_store_creator import ObjectStoreCreator
18 from platform_util import GetPlatforms
18 from test_data.canned_data import (CANNED_API_FILE_SYSTEM_DATA, CANNED_BRANCHES) 19 from test_data.canned_data import (CANNED_API_FILE_SYSTEM_DATA, CANNED_BRANCHES)
19 from test_data.object_level_availability.tabs import TABS_SCHEMA_BRANCHES 20 from test_data.object_level_availability.tabs import TABS_SCHEMA_BRANCHES
20 from test_util import Server2Path 21 from test_util import Server2Path
21 22
22 23
23 TABS_UNMODIFIED_VERSIONS = (16, 20, 23, 24) 24 TABS_UNMODIFIED_VERSIONS = (16, 20, 23, 24)
24 25
25 class AvailabilityFinderTest(unittest.TestCase): 26 class AvailabilityFinderTest(unittest.TestCase):
26 27
28 def _create_availability_finder(self,
29 host_fs_creator,
30 host_fs_iterator,
31 platform):
32 test_object_store = ObjectStoreCreator.ForTest()
33 return AvailabilityFinder(
34 self._branch_utility,
35 CompiledFileSystem.Factory(test_object_store),
36 host_fs_iterator,
37 host_fs_creator.GetTrunk(),
38 test_object_store,
39 platform)
40
27 def setUp(self): 41 def setUp(self):
28 self._branch_utility = BranchUtility( 42 self._branch_utility = BranchUtility(
29 os.path.join('branch_utility', 'first.json'), 43 os.path.join('branch_utility', 'first.json'),
30 os.path.join('branch_utility', 'second.json'), 44 os.path.join('branch_utility', 'second.json'),
31 FakeUrlFetcher(Server2Path('test_data')), 45 FakeUrlFetcher(Server2Path('test_data')),
32 ObjectStoreCreator.ForTest()) 46 ObjectStoreCreator.ForTest())
33 api_fs_creator = FakeHostFileSystemProvider(CANNED_API_FILE_SYSTEM_DATA) 47 self._api_fs_creator = FakeHostFileSystemProvider(
48 CANNED_API_FILE_SYSTEM_DATA)
34 self._node_fs_creator = FakeHostFileSystemProvider(TABS_SCHEMA_BRANCHES) 49 self._node_fs_creator = FakeHostFileSystemProvider(TABS_SCHEMA_BRANCHES)
35 50 self._api_fs_iterator = HostFileSystemIterator(self._api_fs_creator,
36 def create_availability_finder(host_fs_creator): 51 self._branch_utility)
37 test_object_store = ObjectStoreCreator.ForTest() 52 self._node_fs_iterator = HostFileSystemIterator(self._node_fs_creator,
38 return AvailabilityFinder( 53 self._branch_utility)
39 self._branch_utility,
40 CompiledFileSystem.Factory(test_object_store),
41 HostFileSystemIterator(host_fs_creator,
42 self._branch_utility),
43 host_fs_creator.GetTrunk(),
44 test_object_store)
45
46 self._avail_finder = create_availability_finder(api_fs_creator)
47 self._node_avail_finder = create_availability_finder(self._node_fs_creator)
48 54
49 # Imitate the actual SVN file system by incrementing the stats for paths 55 # Imitate the actual SVN file system by incrementing the stats for paths
50 # where an API schema has changed. 56 # where an API schema has changed.
51 last_stat = type('last_stat', (object,), {'val': 0}) 57 last_stat = type('last_stat', (object,), {'val': 0})
52 58
53 def stat_paths(file_system, channel_info): 59 def stat_paths(file_system, channel_info):
54 if channel_info.version not in TABS_UNMODIFIED_VERSIONS: 60 if channel_info.version not in TABS_UNMODIFIED_VERSIONS:
55 last_stat.val += 1 61 last_stat.val += 1
56 # HACK: |file_system| is a MockFileSystem backed by a TestFileSystem. 62 # HACK: |file_system| is a MockFileSystem backed by a TestFileSystem.
57 # Increment the TestFileSystem stat count. 63 # Increment the TestFileSystem stat count.
58 file_system._file_system.IncrementStat(by=last_stat.val) 64 file_system._file_system.IncrementStat(by=last_stat.val)
59 # Continue looping. The iterator will stop after 'trunk' automatically. 65 # Continue looping. The iterator will stop after 'trunk' automatically.
60 return True 66 return True
61 67
62 # Use the HostFileSystemIterator created above to change global stat values 68 # Use the HostFileSystemIterator created above to change global stat values
63 # for the TestFileSystems that it creates. 69 # for the TestFileSystems that it creates.
64 self._node_avail_finder._file_system_iterator.Ascending( 70 self._node_fs_iterator.Ascending(
65 # The earliest version represented with the tabs' test data is 13. 71 # The earliest version represented with the tabs' test data is 13.
66 self._branch_utility.GetStableChannelInfo(13), 72 self._branch_utility.GetStableChannelInfo(13),
67 stat_paths) 73 stat_paths)
68 74
69 def testGraphOptimization(self): 75 def testGraphOptimization(self):
70 # Keep track of how many times the APISchemaGraph constructor is called. 76 for platform in GetPlatforms():
71 original_constructor = api_schema_graph.APISchemaGraph 77 # Keep track of how many times the APISchemaGraph constructor is called.
72 mock_constructor = MockFunction(original_constructor) 78 original_constructor = api_schema_graph.APISchemaGraph
73 api_schema_graph.APISchemaGraph = mock_constructor 79 mock_constructor = MockFunction(original_constructor)
80 api_schema_graph.APISchemaGraph = mock_constructor
74 81
75 try: 82 node_avail_finder = self._create_availability_finder(
76 # The test data includes an extra branch where the API does not exist. 83 self._node_fs_creator, self._node_fs_iterator, platform)
77 num_versions = len(TABS_SCHEMA_BRANCHES) - 1 84 try:
78 # We expect an APISchemaGraph to be created only when an API schema file 85 # The test data includes an extra branch where the API does not exist.
79 # has different stat data from the previous version's schema file. 86 num_versions = len(TABS_SCHEMA_BRANCHES) - 1
80 num_graphs_created = num_versions - len(TABS_UNMODIFIED_VERSIONS) 87 # We expect an APISchemaGraph to be created only when an API schema file
88 # has different stat data from the previous version's schema file.
89 num_graphs_created = num_versions - len(TABS_UNMODIFIED_VERSIONS)
81 90
82 # Run the logic for object-level availability for an API. 91 # Run the logic for object-level availability for an API.
83 self._node_avail_finder.GetApiNodeAvailability('tabs') 92 node_avail_finder.GetApiNodeAvailability('tabs')
84 93
85 self.assertTrue(*api_schema_graph.APISchemaGraph.CheckAndReset( 94 self.assertTrue(*api_schema_graph.APISchemaGraph.CheckAndReset(
86 num_graphs_created)) 95 num_graphs_created))
87 finally: 96 finally:
88 # Ensure that the APISchemaGraph constructor is reset to be the original 97 # Ensure that the APISchemaGraph constructor is reset to be the original
89 # constructor. 98 # constructor.
90 api_schema_graph.APISchemaGraph = original_constructor 99 api_schema_graph.APISchemaGraph = original_constructor
91 100
92 def testGetApiAvailability(self): 101 def testGetApiAvailability(self):
93 # Key: Using 'channel' (i.e. 'beta') to represent an availability listing 102 # Key: Using 'channel' (i.e. 'beta') to represent an availability listing
94 # for an API in a _features.json file, and using |channel| (i.e. |dev|) to 103 # for an API in a _features.json file, and using |channel| (i.e. |dev|) to
95 # represent the development channel, or phase of development, where an API's 104 # represent the development channel, or phase of development, where an API's
96 # availability is being checked. 105 # availability is being checked.
97 106
107 def assertGet(ch_info, api, only_on=None, scheduled=None):
108 for platform in GetPlatforms():
109 get_availability = self._create_availability_finder(
110 self._api_fs_creator,
111 self._api_fs_iterator,
112 platform if only_on is None else only_on).GetApiAvailability
113 self.assertEqual(AvailabilityInfo(ch_info, scheduled=scheduled),
114 get_availability(api))
115
98 # Testing APIs with predetermined availability. 116 # Testing APIs with predetermined availability.
99 self.assertEqual( 117 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'jsonTrunkAPI')
100 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')), 118 assertGet(ChannelInfo('dev', CANNED_BRANCHES[28], 28), 'jsonDevAPI')
101 self._avail_finder.GetApiAvailability('jsonTrunkAPI')) 119 assertGet(ChannelInfo('beta', CANNED_BRANCHES[27], 27), 'jsonBetaAPI')
102 self.assertEqual( 120 assertGet(ChannelInfo('stable', CANNED_BRANCHES[20], 20), 'jsonStableAPI')
103 AvailabilityInfo(ChannelInfo('dev', CANNED_BRANCHES[28], 28)),
104 self._avail_finder.GetApiAvailability('jsonDevAPI'))
105 self.assertEqual(
106 AvailabilityInfo(ChannelInfo('beta', CANNED_BRANCHES[27], 27)),
107 self._avail_finder.GetApiAvailability('jsonBetaAPI'))
108 self.assertEqual(
109 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[20], 20)),
110 self._avail_finder.GetApiAvailability('jsonStableAPI'))
111 121
112 # Testing a whitelisted API. 122 # Testing a whitelisted API.
113 self.assertEquals( 123 assertGet(ChannelInfo('beta', CANNED_BRANCHES[27], 27),
114 AvailabilityInfo(ChannelInfo('beta', CANNED_BRANCHES[27], 27)), 124 'declarativeWebRequest')
115 self._avail_finder.GetApiAvailability('declarativeWebRequest'))
116 125
117 # Testing APIs found only by checking file system existence. 126 # Testing APIs found only by checking file system existence.
118 self.assertEquals( 127 assertGet(ChannelInfo('stable', CANNED_BRANCHES[23], 23), 'windows')
119 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[23], 23)), 128 assertGet(ChannelInfo('stable', CANNED_BRANCHES[18], 18), 'tabs')
120 self._avail_finder.GetApiAvailability('windows')) 129 assertGet(ChannelInfo('stable', CANNED_BRANCHES[18], 18), 'input.ime')
121 self.assertEquals(
122 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[18], 18)),
123 self._avail_finder.GetApiAvailability('tabs'))
124 self.assertEquals(
125 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[18], 18)),
126 self._avail_finder.GetApiAvailability('input.ime'))
127 130
128 # Testing API channel existence for _api_features.json. 131 # Testing API channel existence for _api_features.json.
129 # Listed as 'dev' on |beta|, 'dev' on |dev|. 132 # Listed as 'dev' on |beta|, 'dev' on |dev|.
130 self.assertEquals( 133 assertGet(ChannelInfo('dev', CANNED_BRANCHES[28], 28), 'systemInfo.stuff')
131 AvailabilityInfo(ChannelInfo('dev', CANNED_BRANCHES[28], 28)),
132 self._avail_finder.GetApiAvailability('systemInfo.stuff'))
133 # Listed as 'stable' on |beta|. 134 # Listed as 'stable' on |beta|.
134 self.assertEquals( 135 assertGet(ChannelInfo('beta', CANNED_BRANCHES[27], 27),
135 AvailabilityInfo( 136 'systemInfo.cpu',
136 ChannelInfo('beta', CANNED_BRANCHES[27], 27), 137 scheduled=28)
137 scheduled=28),
138 self._avail_finder.GetApiAvailability('systemInfo.cpu'))
139 138
140 # Testing API channel existence for _manifest_features.json. 139 # Testing API channel existence for _manifest_features.json.
141 # Listed as 'trunk' on all channels. 140 # Listed as 'trunk' on all channels.
142 self.assertEquals( 141 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'sync')
143 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')),
144 self._avail_finder.GetApiAvailability('sync'))
145 # No records of API until |trunk|. 142 # No records of API until |trunk|.
146 self.assertEquals( 143 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'history')
147 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')),
148 self._avail_finder.GetApiAvailability('history'))
149 # Listed as 'dev' on |dev|. 144 # Listed as 'dev' on |dev|.
150 self.assertEquals( 145 assertGet(ChannelInfo('dev', CANNED_BRANCHES[28], 28), 'storage')
151 AvailabilityInfo(ChannelInfo('dev', CANNED_BRANCHES[28], 28)),
152 self._avail_finder.GetApiAvailability('storage'))
153 # Stable in _manifest_features and into pre-18 versions. 146 # Stable in _manifest_features and into pre-18 versions.
154 self.assertEquals( 147 assertGet(ChannelInfo('stable', CANNED_BRANCHES[8], 8), 'pageAction')
155 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[8], 8)),
156 self._avail_finder.GetApiAvailability('pageAction'))
157 148
158 # Testing API channel existence for _permission_features.json. 149 # Testing API channel existence for _permission_features.json.
159 # Listed as 'beta' on |trunk|. 150 # Listed as 'beta' on |trunk|.
160 self.assertEquals( 151 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'falseBetaAPI')
161 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')),
162 self._avail_finder.GetApiAvailability('falseBetaAPI'))
163 # Listed as 'trunk' on |trunk|. 152 # Listed as 'trunk' on |trunk|.
164 self.assertEquals( 153 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'trunkAPI')
165 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')),
166 self._avail_finder.GetApiAvailability('trunkAPI'))
167 # Listed as 'trunk' on all development channels. 154 # Listed as 'trunk' on all development channels.
168 self.assertEquals( 155 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'declarativeContent')
169 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')),
170 self._avail_finder.GetApiAvailability('declarativeContent'))
171 # Listed as 'dev' on all development channels. 156 # Listed as 'dev' on all development channels.
172 self.assertEquals( 157 assertGet(ChannelInfo('dev', CANNED_BRANCHES[28], 28), 'bluetooth')
173 AvailabilityInfo(ChannelInfo('dev', CANNED_BRANCHES[28], 28)),
174 self._avail_finder.GetApiAvailability('bluetooth'))
175 # Listed as 'dev' on |dev|. 158 # Listed as 'dev' on |dev|.
176 self.assertEquals( 159 assertGet(ChannelInfo('dev', CANNED_BRANCHES[28], 28), 'cookies')
177 AvailabilityInfo(ChannelInfo('dev', CANNED_BRANCHES[28], 28)),
178 self._avail_finder.GetApiAvailability('cookies'))
179 # Treated as 'stable' APIs. 160 # Treated as 'stable' APIs.
180 self.assertEquals( 161 assertGet(ChannelInfo('stable', CANNED_BRANCHES[24], 24), 'alarms')
181 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[24], 24)), 162 assertGet(ChannelInfo('stable', CANNED_BRANCHES[21], 21), 'bookmarks')
182 self._avail_finder.GetApiAvailability('alarms'))
183 self.assertEquals(
184 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[21], 21)),
185 self._avail_finder.GetApiAvailability('bookmarks'))
186 163
187 # Testing older API existence using extension_api.json. 164 # Testing older API existence using extension_api.json.
188 self.assertEquals( 165 assertGet(ChannelInfo('stable', CANNED_BRANCHES[6], 6), 'menus')
189 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[6], 6)), 166 assertGet(ChannelInfo('stable', CANNED_BRANCHES[5], 5), 'idle')
190 self._avail_finder.GetApiAvailability('menus'))
191 self.assertEquals(
192 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[5], 5)),
193 self._avail_finder.GetApiAvailability('idle'))
194 167
195 # Switches between _features.json files across branches. 168 # Switches between _features.json files across branches.
196 # Listed as 'trunk' on all channels, in _api, _permission, or _manifest. 169 # Listed as 'trunk' on all channels, in _api, _permission, or _manifest.
197 self.assertEquals( 170 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'contextMenus')
198 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')),
199 self._avail_finder.GetApiAvailability('contextMenus'))
200 # Moves between _permission and _manifest as file system is traversed. 171 # Moves between _permission and _manifest as file system is traversed.
201 self.assertEquals( 172 assertGet(ChannelInfo('stable', CANNED_BRANCHES[23], 23),
202 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[23], 23)), 173 'systemInfo.display')
203 self._avail_finder.GetApiAvailability('systemInfo.display')) 174 assertGet(ChannelInfo('stable', CANNED_BRANCHES[17], 17), 'webRequest')
204 self.assertEquals(
205 AvailabilityInfo(ChannelInfo('stable', CANNED_BRANCHES[17], 17)),
206 self._avail_finder.GetApiAvailability('webRequest'))
207 175
208 # Mid-upgrade cases: 176 # Mid-upgrade cases:
209 # Listed as 'dev' on |beta| and 'beta' on |dev|. 177 # Listed as 'dev' on |beta| and 'beta' on |dev|.
210 self.assertEquals( 178 assertGet(ChannelInfo('dev', CANNED_BRANCHES[28], 28), 'notifications')
211 AvailabilityInfo(ChannelInfo('dev', CANNED_BRANCHES[28], 28)), 179 # Listed as 'beta' on |stable|, 'dev' on |beta|...until |stable| on trunk.
212 self._avail_finder.GetApiAvailability('notifications')) 180 assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'events')
213 # Listed as 'beta' on |stable|, 'dev' on |beta| ... until |stable| on trunk. 181
214 self.assertEquals( 182 # Check for differing availability across apps|extensions
ahernandez 2014/06/18 21:57:53 Here's the new test. I added a new "appsFirst" API
215 AvailabilityInfo(ChannelInfo('trunk', 'trunk', 'trunk')), 183 assertGet(ChannelInfo('stable', CANNED_BRANCHES[26], 26),
216 self._avail_finder.GetApiAvailability('events')) 184 'appsFirst',
185 only_on='extensions')
186 assertGet(ChannelInfo('stable', CANNED_BRANCHES[25], 25),
187 'appsFirst',
188 only_on='apps')
217 189
218 def testGetApiNodeAvailability(self): 190 def testGetApiNodeAvailability(self):
219 # Allow the LookupResult constructions below to take just one line. 191 # Allow the LookupResult constructions below to take just one line.
220 lookup_result = api_schema_graph.LookupResult 192 for platform in GetPlatforms():
221 availability_graph = self._node_avail_finder.GetApiNodeAvailability('tabs') 193 lookup_result = api_schema_graph.LookupResult
194 availability_graph = self._create_availability_finder(
195 self._node_fs_creator,
196 self._node_fs_iterator,
197 platform).GetApiNodeAvailability('tabs')
222 198
223 self.assertEquals( 199 self.assertEquals(
224 lookup_result(True, self._branch_utility.GetChannelInfo('trunk')), 200 lookup_result(True, self._branch_utility.GetChannelInfo('trunk')),
225 availability_graph.Lookup('tabs', 'properties', 201 availability_graph.Lookup('tabs', 'properties',
226 'fakeTabsProperty3')) 202 'fakeTabsProperty3'))
227 self.assertEquals( 203 self.assertEquals(
228 lookup_result(True, self._branch_utility.GetChannelInfo('dev')), 204 lookup_result(True, self._branch_utility.GetChannelInfo('dev')),
229 availability_graph.Lookup('tabs', 'events', 'onActivated', 205 availability_graph.Lookup('tabs', 'events', 'onActivated',
230 'parameters', 'activeInfo', 'properties', 206 'parameters', 'activeInfo', 'properties',
231 'windowId')) 207 'windowId'))
232 self.assertEquals( 208 self.assertEquals(
233 lookup_result(True, self._branch_utility.GetChannelInfo('dev')), 209 lookup_result(True, self._branch_utility.GetChannelInfo('dev')),
234 availability_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters', 210 availability_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters',
235 'tab')) 211 'tab'))
236 self.assertEquals( 212 self.assertEquals(
237 lookup_result(True, self._branch_utility.GetChannelInfo('beta')), 213 lookup_result(True, self._branch_utility.GetChannelInfo('beta')),
238 availability_graph.Lookup('tabs', 'events','onActivated')) 214 availability_graph.Lookup('tabs', 'events','onActivated'))
239 self.assertEquals( 215 self.assertEquals(
240 lookup_result(True, self._branch_utility.GetChannelInfo('beta')), 216 lookup_result(True, self._branch_utility.GetChannelInfo('beta')),
241 availability_graph.Lookup('tabs', 'functions', 'get', 'parameters', 217 availability_graph.Lookup('tabs', 'functions', 'get', 'parameters',
242 'tabId')) 218 'tabId'))
243 self.assertEquals( 219 self.assertEquals(
244 lookup_result(True, self._branch_utility.GetChannelInfo('stable')), 220 lookup_result(True, self._branch_utility.GetChannelInfo('stable')),
245 availability_graph.Lookup('tabs', 'types', 'InjectDetails', 221 availability_graph.Lookup('tabs', 'types', 'InjectDetails',
246 'properties', 'code')) 222 'properties', 'code'))
247 self.assertEquals( 223 self.assertEquals(
248 lookup_result(True, self._branch_utility.GetChannelInfo('stable')), 224 lookup_result(True, self._branch_utility.GetChannelInfo('stable')),
249 availability_graph.Lookup('tabs', 'types', 'InjectDetails', 225 availability_graph.Lookup('tabs', 'types', 'InjectDetails',
250 'properties', 'file')) 226 'properties', 'file'))
251 self.assertEquals( 227 self.assertEquals(
252 lookup_result(True, self._branch_utility.GetStableChannelInfo(25)), 228 lookup_result(True, self._branch_utility.GetStableChannelInfo(25)),
253 availability_graph.Lookup('tabs', 'types', 'InjectDetails')) 229 availability_graph.Lookup('tabs', 'types', 'InjectDetails'))
254 230
255 # Nothing new in version 24 or 23. 231 # Nothing new in version 24 or 23.
256 232
257 self.assertEquals( 233 self.assertEquals(
258 lookup_result(True, self._branch_utility.GetStableChannelInfo(22)), 234 lookup_result(True, self._branch_utility.GetStableChannelInfo(22)),
259 availability_graph.Lookup('tabs', 'types', 'Tab', 'properties', 235 availability_graph.Lookup('tabs', 'types', 'Tab', 'properties',
260 'windowId')) 236 'windowId'))
261 self.assertEquals( 237 self.assertEquals(
262 lookup_result(True, self._branch_utility.GetStableChannelInfo(21)), 238 lookup_result(True, self._branch_utility.GetStableChannelInfo(21)),
263 availability_graph.Lookup('tabs', 'types', 'Tab', 'properties', 239 availability_graph.Lookup('tabs', 'types', 'Tab', 'properties',
264 'selected')) 240 'selected'))
265 241
266 # Nothing new in version 20. 242 # Nothing new in version 20.
267 243
268 self.assertEquals( 244 self.assertEquals(
269 lookup_result(True, self._branch_utility.GetStableChannelInfo(19)), 245 lookup_result(True, self._branch_utility.GetStableChannelInfo(19)),
270 availability_graph.Lookup('tabs', 'functions', 'getCurrent')) 246 availability_graph.Lookup('tabs', 'functions', 'getCurrent'))
271 self.assertEquals( 247 self.assertEquals(
272 lookup_result(True, self._branch_utility.GetStableChannelInfo(18)), 248 lookup_result(True, self._branch_utility.GetStableChannelInfo(18)),
273 availability_graph.Lookup('tabs', 'types', 'Tab', 'properties', 249 availability_graph.Lookup('tabs', 'types', 'Tab', 'properties',
274 'index')) 250 'index'))
275 self.assertEquals( 251 self.assertEquals(
276 lookup_result(True, self._branch_utility.GetStableChannelInfo(17)), 252 lookup_result(True, self._branch_utility.GetStableChannelInfo(17)),
277 availability_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters', 253 availability_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters',
278 'changeInfo')) 254 'changeInfo'))
279 255
280 # Nothing new in version 16. 256 # Nothing new in version 16.
281 257
282 self.assertEquals( 258 self.assertEquals(
283 lookup_result(True, self._branch_utility.GetStableChannelInfo(15)), 259 lookup_result(True, self._branch_utility.GetStableChannelInfo(15)),
284 availability_graph.Lookup('tabs', 'properties', 260 availability_graph.Lookup('tabs', 'properties',
285 'fakeTabsProperty2')) 261 'fakeTabsProperty2'))
286 262
287 # Everything else is available at the API's release, version 14 here. 263 # Everything else is available at the API's release, version 14 here.
288 self.assertEquals( 264 self.assertEquals(
289 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 265 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
290 availability_graph.Lookup('tabs', 'types', 'Tab')) 266 availability_graph.Lookup('tabs', 'types', 'Tab'))
291 self.assertEquals( 267 self.assertEquals(
292 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 268 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
293 availability_graph.Lookup('tabs', 'types', 'Tab', 269 availability_graph.Lookup('tabs', 'types', 'Tab',
294 'properties', 'url')) 270 'properties', 'url'))
295 self.assertEquals( 271 self.assertEquals(
296 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 272 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
297 availability_graph.Lookup('tabs', 'properties', 273 availability_graph.Lookup('tabs', 'properties',
298 'fakeTabsProperty1')) 274 'fakeTabsProperty1'))
299 self.assertEquals( 275 self.assertEquals(
300 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 276 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
301 availability_graph.Lookup('tabs', 'functions', 'get', 'parameters', 277 availability_graph.Lookup('tabs', 'functions', 'get', 'parameters',
302 'callback')) 278 'callback'))
303 self.assertEquals( 279 self.assertEquals(
304 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 280 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
305 availability_graph.Lookup('tabs', 'events', 'onUpdated')) 281 availability_graph.Lookup('tabs', 'events', 'onUpdated'))
306 282
307 # Test things that aren't available. 283 # Test things that aren't available.
308 self.assertEqual(lookup_result(False, None), 284 self.assertEqual(lookup_result(False, None),
309 availability_graph.Lookup('tabs', 'types', 285 availability_graph.Lookup('tabs', 'types',
310 'UpdateInfo')) 286 'UpdateInfo'))
311 self.assertEqual(lookup_result(False, None), 287 self.assertEqual(lookup_result(False, None),
312 availability_graph.Lookup('tabs', 'functions', 'get', 288 availability_graph.Lookup('tabs', 'functions', 'get',
313 'parameters', 'callback', 289 'parameters', 'callback',
314 'parameters', 'tab', 'id')) 290 'parameters', 'tab', 'id'))
315 self.assertEqual(lookup_result(False, None), 291 self.assertEqual(lookup_result(False, None),
316 availability_graph.Lookup('functions')) 292 availability_graph.Lookup('functions'))
317 self.assertEqual(lookup_result(False, None), 293 self.assertEqual(lookup_result(False, None),
318 availability_graph.Lookup('events', 'onActivated', 294 availability_graph.Lookup('events', 'onActivated',
319 'parameters', 'activeInfo', 295 'parameters', 'activeInfo',
320 'tabId')) 296 'tabId'))
321 297
322 298
323 if __name__ == '__main__': 299 if __name__ == '__main__':
324 unittest.main() 300 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698