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

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: 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
228 # Test a scheduled node.
229 assertEquals(True, self._branch_utility.GetChannelInfo('dev'),
230 tabs_graph.Lookup('tabs', 'functions', 'scheduledFunc'),
231 scheduled=28)
232
233 # Test inlined type. 233 # Test inlined type.
234 self.assertEquals( 234 assertEquals(True, self._branch_utility.GetChannelInfo('trunk'),
235 lookup_result(True, self._branch_utility.GetChannelInfo('trunk')),
236 tabs_graph.Lookup('tabs', 'types', 'InlinedType')) 235 tabs_graph.Lookup('tabs', 'types', 'InlinedType'))
237 236
238 # Test implicitly inlined type. 237 # Test implicitly inlined type.
239 self.assertEquals( 238 assertEquals(True, self._branch_utility.GetStableChannelInfo(25),
240 lookup_result(True, self._branch_utility.GetStableChannelInfo(25)),
241 fake_tabs_graph.Lookup('fakeTabs', 'types', 239 fake_tabs_graph.Lookup('fakeTabs', 'types',
242 'WasImplicitlyInlinedType')) 240 'WasImplicitlyInlinedType'))
243 241
244 # Nothing new in version 24 or 23. 242 # Nothing new in version 24 or 23.
245 243
246 self.assertEquals( 244 assertEquals(True, self._branch_utility.GetStableChannelInfo(22),
247 lookup_result(True, self._branch_utility.GetStableChannelInfo(22)), 245 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'windowId'))
248 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 246 assertEquals(True, self._branch_utility.GetStableChannelInfo(21),
249 'windowId')) 247 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 248
255 # Nothing new in version 20. 249 # Nothing new in version 20.
256 250
257 self.assertEquals( 251 assertEquals(True, self._branch_utility.GetStableChannelInfo(19),
258 lookup_result(True, self._branch_utility.GetStableChannelInfo(19)),
259 tabs_graph.Lookup('tabs', 'functions', 'getCurrent')) 252 tabs_graph.Lookup('tabs', 'functions', 'getCurrent'))
260 self.assertEquals( 253 assertEquals(True, self._branch_utility.GetStableChannelInfo(18),
261 lookup_result(True, self._branch_utility.GetStableChannelInfo(18)), 254 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'index'))
262 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 255 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', 256 tabs_graph.Lookup('tabs', 'events', 'onUpdated', 'parameters',
267 'changeInfo')) 257 'changeInfo'))
268 258
269 # Nothing new in version 16. 259 # Nothing new in version 16.
270 260
271 self.assertEquals( 261 assertEquals(True, self._branch_utility.GetStableChannelInfo(15),
272 lookup_result(True, self._branch_utility.GetStableChannelInfo(15)), 262 tabs_graph.Lookup('tabs', 'properties', 'fakeTabsProperty2'))
273 tabs_graph.Lookup('tabs', 'properties',
274 'fakeTabsProperty2'))
275 263
276 # Everything else is available at the API's release, version 14 here. 264 # Everything else is available at the API's release, version 14 here.
277 self.assertEquals( 265 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
278 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
279 tabs_graph.Lookup('tabs', 'types', 'Tab')) 266 tabs_graph.Lookup('tabs', 'types', 'Tab'))
280 self.assertEquals( 267 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
281 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)), 268 tabs_graph.Lookup('tabs', 'types', 'Tab', 'properties', 'url'))
282 tabs_graph.Lookup('tabs', 'types', 'Tab', 269 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
283 'properties', 'url')) 270 tabs_graph.Lookup('tabs', 'properties', 'fakeTabsProperty1'))
284 self.assertEquals( 271 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', 272 tabs_graph.Lookup('tabs', 'functions', 'get', 'parameters',
291 'callback')) 273 'callback'))
292 self.assertEquals( 274 assertEquals(True, self._branch_utility.GetStableChannelInfo(14),
293 lookup_result(True, self._branch_utility.GetStableChannelInfo(14)),
294 tabs_graph.Lookup('tabs', 'events', 'onUpdated')) 275 tabs_graph.Lookup('tabs', 'events', 'onUpdated'))
295 276
296 # Test things that aren't available. 277 # Test things that aren't available.
297 self.assertEqual(lookup_result(False, None), 278 assertEquals(False, None, tabs_graph.Lookup('tabs', 'types',
298 tabs_graph.Lookup('tabs', 'types', 279 'UpdateInfo'))
299 'UpdateInfo')) 280 assertEquals(False, None, tabs_graph.Lookup('tabs', 'functions', 'get',
300 self.assertEqual(lookup_result(False, None), 281 'parameters', 'callback', 'parameters', 'tab', 'id'))
301 tabs_graph.Lookup('tabs', 'functions', 'get', 282 assertEquals(False, None, tabs_graph.Lookup('functions'))
302 'parameters', 'callback', 283 assertEquals(False, None, tabs_graph.Lookup('events', 'onActivated',
303 'parameters', 'tab', 'id')) 284 '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 285
311 286
312 if __name__ == '__main__': 287 if __name__ == '__main__':
313 unittest.main() 288 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698