| OLD | NEW |
| 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 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 # Use the HostFileSystemIterator created above to change global stat values | 316 # Use the HostFileSystemIterator created above to change global stat values |
| 317 # for the TestFileSystems that it creates. | 317 # for the TestFileSystems that it creates. |
| 318 self._node_fs_iterator.Ascending( | 318 self._node_fs_iterator.Ascending( |
| 319 # The earliest version represented with the tabs' test data is 13. | 319 # The earliest version represented with the tabs' test data is 13. |
| 320 self._branch_utility.GetStableChannelInfo(13), | 320 self._branch_utility.GetStableChannelInfo(13), |
| 321 stat_paths) | 321 stat_paths) |
| 322 | 322 |
| 323 def testGetAPINodeAvailability(self): | 323 def testGetAPINodeAvailability(self): |
| 324 def assertEquals(node, actual): | 324 def assertEquals(node, actual): |
| 325 node_availabilities = { | 325 node_availabilities = { |
| 326 'tabs.Tab': None, |
| 327 'tabs.fakeTabsProperty1': None, |
| 326 'tabs.get': None, | 328 'tabs.get': None, |
| 327 'tabs.getCurrent': 19 | 329 'tabs.onUpdated': None, |
| 330 'tabs.InjectDetails': 25, |
| 331 'tabs.fakeTabsProperty2': 15, |
| 332 'tabs.getCurrent': 19, |
| 333 'tabs.onActivated': 27 |
| 328 } | 334 } |
| 329 self.assertEquals(node_availabilities[node], actual) | 335 self.assertEquals(node_availabilities[node], actual) |
| 330 | 336 |
| 331 model_dict = _JSCModel( | 337 model_dict = _JSCModel( |
| 332 self._api_models.GetModel('tabs').Get(), | 338 self._api_models.GetModel('tabs').Get(), |
| 333 self._avail_finder, | 339 self._avail_finder, |
| 334 self._json_cache, | 340 self._json_cache, |
| 335 _FakeTemplateCache(), | 341 _FakeTemplateCache(), |
| 336 _FakeFeaturesBundle(), | 342 _FakeFeaturesBundle(), |
| 337 None).ToDict() | 343 None).ToDict() |
| 338 | 344 |
| 339 # Test nodes that have the same availability as their parent. | 345 # Test nodes that have the same availability as their parent. |
| 346 |
| 347 # Test type. |
| 348 assertEquals('tabs.Tab', model_dict['types'][0]['availability']) |
| 349 # Test property. |
| 350 assertEquals('tabs.fakeTabsProperty1', |
| 351 model_dict['properties'][0]['availability']) |
| 352 # Test function. |
| 340 assertEquals('tabs.get', model_dict['functions'][1]['availability']) | 353 assertEquals('tabs.get', model_dict['functions'][1]['availability']) |
| 354 # Test event. |
| 355 assertEquals('tabs.onUpdated', model_dict['events'][1]['availability']) |
| 356 |
| 341 # Test nodes with varying availabilities. | 357 # Test nodes with varying availabilities. |
| 358 |
| 359 # Test type. |
| 360 assertEquals('tabs.InjectDetails', |
| 361 model_dict['types'][1]['availability']['version']) |
| 362 # Test property. |
| 363 assertEquals('tabs.fakeTabsProperty2', |
| 364 model_dict['properties'][2]['availability']['version']) |
| 365 # Test function. |
| 342 assertEquals('tabs.getCurrent', | 366 assertEquals('tabs.getCurrent', |
| 343 model_dict['functions'][0]['availability']['version']) | 367 model_dict['functions'][0]['availability']['version']) |
| 368 # Test event. |
| 369 assertEquals('tabs.onActivated', |
| 370 model_dict['events'][0]['availability']['version']) |
| 344 | 371 |
| 345 | 372 |
| 346 if __name__ == '__main__': | 373 if __name__ == '__main__': |
| 347 unittest.main() | 374 unittest.main() |
| OLD | NEW |