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

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

Issue 386443003: Docserver: Add 'deprecated since' message for API nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 6 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 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
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 # Check for differing availability across apps|extensions 182 # Check for differing availability across apps|extensions
183 assertGet(ChannelInfo('stable', CANNED_BRANCHES[26], 26), 183 assertGet(ChannelInfo('stable', CANNED_BRANCHES[26], 26),
184 'appsFirst', 184 'appsFirst',
185 only_on='extensions') 185 only_on='extensions')
186 assertGet(ChannelInfo('stable', CANNED_BRANCHES[25], 25), 186 assertGet(ChannelInfo('stable', CANNED_BRANCHES[25], 25),
187 'appsFirst', 187 'appsFirst',
188 only_on='apps') 188 only_on='apps')
189 189
190 def testGetAPINodeAvailability(self): 190 def testGetAPINodeAvailability(self):
191 def assertEquals(found, channel_info, actual, scheduled=None):
192 lookup_result = api_schema_graph.LookupResult
193 if channel_info is None:
194 self.assertEquals(lookup_result(found, None), actual)
195 else:
196 self.assertEquals(lookup_result(found, AvailabilityInfo(channel_info,
197 scheduled=scheduled)), actual)
198
191 for platform in GetPlatforms(): 199 for platform in GetPlatforms():
192 # Allow the LookupResult constructions below to take just one line. 200 # Allow the LookupResult constructions below to take just one line.
193 lookup_result = api_schema_graph.LookupResult
194 avail_finder = self._create_availability_finder( 201 avail_finder = self._create_availability_finder(
195 self._node_fs_creator, 202 self._node_fs_creator,
196 self._node_fs_iterator, 203 self._node_fs_iterator,
197 platform) 204 platform)
198 tabs_graph = avail_finder.GetAPINodeAvailability('tabs') 205 tabs_graph = avail_finder.GetAPINodeAvailability('tabs')
199 fake_tabs_graph = avail_finder.GetAPINodeAvailability('fakeTabs') 206 fake_tabs_graph = avail_finder.GetAPINodeAvailability('fakeTabs')
200 207
201 self.assertEquals( 208 assertEquals(True, self._branch_utility.GetChannelInfo('trunk'),
202 lookup_result(True, self._branch_utility.GetChannelInfo('trunk')), 209 tabs_graph.Lookup('tabs', 'properties', 'fakeTabsProperty3'))
203 tabs_graph.Lookup('tabs', 'properties', 210 assertEquals(True, self._branch_utility.GetChannelInfo('dev'),
204 'fakeTabsProperty3')) 211 tabs_graph.Lookup('tabs', 'events', 'onActivated', 'parameters',
205 self.assertEquals( 212 'activeInfo', 'properties', 'windowId'))
206 lookup_result(True, self._branch_utility.GetChannelInfo('dev')), 213 assertEquals(True, self._branch_utility.GetChannelInfo('dev'),
207 tabs_graph.Lookup('tabs', 'events', 'onActivated', 214 tabs_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters', 'tab'))
208 'parameters', 'activeInfo', 'properties', 215 assertEquals(True, self._branch_utility.GetChannelInfo('beta'),
209 'windowId')) 216 tabs_graph.Lookup('tabs', 'events', 'onActivated'))
210 self.assertEquals( 217 assertEquals(True, self._branch_utility.GetChannelInfo('beta'),
211 lookup_result(True, self._branch_utility.GetChannelInfo('dev')), 218 tabs_graph.Lookup('tabs', 'functions', 'get', 'parameters', 'tabId'))
212 tabs_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters', 219 assertEquals(True, self._branch_utility.GetChannelInfo('stable'),
213 'tab')) 220 tabs_graph.Lookup('tabs', 'types', 'InjectDetails', 'properties',
214 self.assertEquals( 221 'code'))
215 lookup_result(True, self._branch_utility.GetChannelInfo('beta')), 222 assertEquals(True, self._branch_utility.GetChannelInfo('stable'),
216 tabs_graph.Lookup('tabs', 'events','onActivated')) 223 tabs_graph.Lookup('tabs', 'types', 'InjectDetails', 'properties',
217 self.assertEquals( 224 'file'))
218 lookup_result(True, self._branch_utility.GetChannelInfo('beta')), 225 assertEquals(True, self._branch_utility.GetStableChannelInfo(25),
219 tabs_graph.Lookup('tabs', 'functions', 'get', 'parameters',
220 'tabId'))
221 self.assertEquals(
222 lookup_result(True, self._branch_utility.GetChannelInfo('stable')),
223 tabs_graph.Lookup('tabs', 'types', 'InjectDetails',
224 'properties', 'code'))
225 self.assertEquals(
226 lookup_result(True, self._branch_utility.GetChannelInfo('stable')),
227 tabs_graph.Lookup('tabs', 'types', 'InjectDetails',
228 'properties', 'file'))
229 self.assertEquals(
230 lookup_result(True, self._branch_utility.GetStableChannelInfo(25)),
231 tabs_graph.Lookup('tabs', 'types', 'InjectDetails')) 226 tabs_graph.Lookup('tabs', 'types', 'InjectDetails'))
232 227
233 # Test inlined type. 228 # Test inlined type.
234 self.assertEquals( 229 assertEquals(True, self._branch_utility.GetChannelInfo('trunk'),
235 lookup_result(True, self._branch_utility.GetChannelInfo('trunk')),
236 tabs_graph.Lookup('tabs', 'types', 'InlinedType')) 230 tabs_graph.Lookup('tabs', 'types', 'InlinedType'))
237 231
238 # Test implicitly inlined type. 232 # Test implicitly inlined type.
239 self.assertEquals( 233 assertEquals(True, self._branch_utility.GetStableChannelInfo(25),
240 lookup_result(True, self._branch_utility.GetStableChannelInfo(25)),
241 fake_tabs_graph.Lookup('fakeTabs', 'types', 234 fake_tabs_graph.Lookup('fakeTabs', 'types',
242 'WasImplicitlyInlinedType')) 235 'WasImplicitlyInlinedType'))
243 236
244 # Nothing new in version 24 or 23. 237 # Nothing new in version 24 or 23.
245 238
246 self.assertEquals( 239 assertEquals(True, self._branch_utility.GetStableChannelInfo(22),
247 lookup_result(True, self._branch_utility.GetStableChannelInfo(22)), 240 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'windowId'))
248 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 241 assertEquals(True, self._branch_utility.GetStableChannelInfo(21),
249 'windowId')) 242 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'selected'))
250 self.assertEquals(
251 lookup_result(True, self._branch_utility.GetStableChannelInfo(21)),
252 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties',
253 'selected'))
254 243
255 # Nothing new in version 20. 244 # Nothing new in version 20.
256 245
257 self.assertEquals( 246 assertEquals(True, self._branch_utility.GetStableChannelInfo(19),
258 lookup_result(True, self._branch_utility.GetStableChannelInfo(19)),
259 tabs_graph.Lookup('tabs', 'functions', 'getCurrent')) 247 tabs_graph.Lookup('tabs', 'functions', 'getCurrent'))
260 self.assertEquals( 248 assertEquals(True, self._branch_utility.GetStableChannelInfo(18),
261 lookup_result(True, self._branch_utility.GetStableChannelInfo(18)), 249 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'index'))
262 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 250 assertEquals(True, self._branch_utility.GetStableChannelInfo(17),
263 'index'))
264 self.assertEquals(
265 lookup_result(True, self._branch_utility.GetStableChannelInfo(17)),
266 tabs_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters', 251 tabs_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters',
267 'changeInfo')) 252 'changeInfo'))
268 253
269 # Nothing new in version 16. 254 # Nothing new in version 16.
270 255
271 self.assertEquals( 256 assertEquals(True, self._branch_utility.GetStableChannelInfo(15),
272 lookup_result(True, self._branch_utility.GetStableChannelInfo(15)), 257 tabs_graph.Lookup('tabs', 'properties', 'fakeTabsProperty2'))
273 tabs_graph.Lookup('tabs', 'properties',
274 'fakeTabsProperty2'))
275 258
276 # Everything else is available at the API's release, version 14 here. 259 # Everything else is available at the API's release, version 14 here.
277 self.assertEquals( 260 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
278 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
279 tabs_graph.Lookup('tabs', 'types', 'Tab')) 261 tabs_graph.Lookup('tabs', 'types', 'Tab'))
280 self.assertEquals( 262 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
281 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 263 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'url'))
282 tabs_graph.Lookup('tabs', 'types', 'Tab', 264 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
283 'properties', 'url')) 265 tabs_graph.Lookup('tabs', 'properties', 'fakeTabsProperty1'))
284 self.assertEquals( 266 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
285 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
286 tabs_graph.Lookup('tabs', 'properties',
287 'fakeTabsProperty1'))
288 self.assertEquals(
289 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
290 tabs_graph.Lookup('tabs', 'functions', 'get', 'parameters', 267 tabs_graph.Lookup('tabs', 'functions', 'get', 'parameters',
291 'callback')) 268 'callback'))
292 self.assertEquals( 269 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
293 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
294 tabs_graph.Lookup('tabs', 'events', 'onUpdated')) 270 tabs_graph.Lookup('tabs', 'events', 'onUpdated'))
295 271
296 # Test things that aren't available. 272 # Test things that aren't available.
297 self.assertEqual(lookup_result(False, None), 273 assertEquals(False, None, tabs_graph.Lookup('tabs', 'types',
298 tabs_graph.Lookup('tabs', 'types', 274 'UpdateInfo'))
299 'UpdateInfo')) 275 assertEquals(False, None, tabs_graph.Lookup('tabs', 'functions', 'get',
300 self.assertEqual(lookup_result(False, None), 276 'parameters', 'callback', 'parameters', 'tab', 'id'))
301 tabs_graph.Lookup('tabs', 'functions', 'get', 277 assertEquals(False, None, tabs_graph.Lookup('functions'))
302 'parameters', 'callback', 278 assertEquals(False, None, tabs_graph.Lookup('events', 'onActivated',
303 'parameters', 'tab', 'id')) 279 'parameters', 'activeInfo', 'tabId'))
304 self.assertEqual(lookup_result(False, None),
305 tabs_graph.Lookup('functions'))
306 self.assertEqual(lookup_result(False, None),
307 tabs_graph.Lookup('events', 'onActivated',
308 'parameters', 'activeInfo',
309 'tabId'))
310 280
311 281
312 if __name__ == '__main__': 282 if __name__ == '__main__':
313 unittest.main() 283 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/availability_finder.py ('k') | chrome/common/extensions/docs/server2/cron.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698