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

Unified Diff: chrome/common/extensions/docs/server2/availability_finder_test.py

Issue 12996003: Dynamically generate a heading for Extension Docs API pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments - Patch currently being broken up Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/availability_finder_test.py
diff --git a/chrome/common/extensions/docs/server2/availability_finder_test.py b/chrome/common/extensions/docs/server2/availability_finder_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..0201cc0bc0aff95eb54ebeaf465c1bcfab099f97
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/availability_finder_test.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import json
+import os
+import unittest
+
+from availability_finder import AvailabilityFinder
+from branch_utility import BranchUtility
+from compiled_file_system import CompiledFileSystem
+from fake_fetchers import ConfigureFakeFetchers
+from object_store_creator import ObjectStoreCreator
+from test_file_system import TestFileSystem
+from test_data.canned_data import (CANNED_API_FILE_SYSTEM_DATA, CANNED_BRANCHES)
+
+def _LoadJSON(name, mode='rb'):
+ return json.load(
+ open(os.path.join('test_data', 'availability_finder', name), mode))
+
+def _CreateFileSystem(version):
+ branch = _GetBranchForVersion(version)
+ return TestFileSystem(CANNED_API_FILE_SYSTEM_DATA[str(branch)])
+
+def _GetBranchForVersion(version):
+ return CANNED_BRANCHES[version]
+
+class AvailabilityFinderTest(unittest.TestCase):
+ def setUp(self):
+ ConfigureFakeFetchers()
+ self._avail_ds_factory = AvailabilityFinder.Factory(
+ ObjectStoreCreator.ForTest(),
+ CompiledFileSystem.Factory(
+ TestFileSystem(CANNED_API_FILE_SYSTEM_DATA['trunk']),
+ ObjectStoreCreator.ForTest()),
+ BranchUtility.Create(ObjectStoreCreator.ForTest()),
+ _CreateFileSystem)
+ self._avail_ds = self._avail_ds_factory.Create()
+
+ def testGetApiAvailability(self):
+ self.assertEqual('stable',
+ self._avail_ds.GetApiAvailability('earlyAPI1').channel)
+ self.assertEqual('10',
+ self._avail_ds.GetApiAvailability('earlyAPI1').version)
+ self.assertEqual('trunk',
+ self._avail_ds.GetApiAvailability('earlyAPI2').channel)
+ self.assertEqual(None,
+ self._avail_ds.GetApiAvailability('earlyAPI2').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('tabs').channel)
+ self.assertEquals(18,
+ self._avail_ds.GetApiAvailability('tabs').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('bookmarks').channel)
+ self.assertEquals(21,
+ self._avail_ds.GetApiAvailability('bookmarks').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('windows').channel)
+ self.assertEquals(23,
+ self._avail_ds.GetApiAvailability('windows').version)
+ self.assertEquals('dev',
+ self._avail_ds.GetApiAvailability('storage').channel)
+ self.assertEquals(28,
+ self._avail_ds.GetApiAvailability('storage').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('alarms').channel)
+ self.assertEquals(24,
+ self._avail_ds.GetApiAvailability('alarms').version)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('sync').channel)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('sync').version)
+ self.assertEquals('dev',
+ self._avail_ds.GetApiAvailability('cookies').channel)
+ self.assertEquals(28,
+ self._avail_ds.GetApiAvailability('cookies').version)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('notReallyBetaAPI').version)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('trunkAPI').channel)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('trunkAPI').version)
+ self.assertEquals('dev',
+ self._avail_ds.GetApiAvailability('notifications').channel)
+ self.assertEquals(28,
+ self._avail_ds.GetApiAvailability('notifications').version)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('contextMenus').channel)
+ self.assertEquals('trunk',
+ self._avail_ds.GetApiAvailability('contextMenus').version)
+ self.assertEquals('beta',
+ self._avail_ds.GetApiAvailability('systemInfo.cpu').channel)
+ self.assertEquals(27,
+ self._avail_ds.GetApiAvailability('systemInfo.cpu').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('systemInfo.display').channel)
+ self.assertEquals(23,
+ self._avail_ds.GetApiAvailability('systemInfo.display').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('menus').channel)
+ self.assertEquals(6,
+ self._avail_ds.GetApiAvailability('menus').version)
+ self.assertEquals('stable',
+ self._avail_ds.GetApiAvailability('idle').channel)
+ self.assertEquals(5,
+ self._avail_ds.GetApiAvailability('idle').version)
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « chrome/common/extensions/docs/server2/availability_finder.py ('k') | chrome/common/extensions/docs/server2/branch_utility.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698