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

Unified Diff: chrome/common/extensions/docs/server2/test_branch_utility.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: AvailabilityFinder Overhaul; Removing ConfigureFakeFetchers() calls Created 7 years, 7 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/test_branch_utility.py
diff --git a/chrome/common/extensions/docs/server2/test_branch_utility.py b/chrome/common/extensions/docs/server2/test_branch_utility.py
index 1c365a56869fe64d5538bf619c64fc0207b4e3a6..93a6dc54323f350ebfac8ab76d6a9743ee854903 100644
--- a/chrome/common/extensions/docs/server2/test_branch_utility.py
+++ b/chrome/common/extensions/docs/server2/test_branch_utility.py
@@ -4,9 +4,57 @@
from branch_utility import BranchUtility
+channels = {
+ 'trunk': ['trunk', 'trunk'],
+ 'dev': [1500, 28],
+ 'beta': [1453, 27],
+ 'stable': [1410, 26]
+}
+
+branches = {
+ 'trunk' : 'trunk',
+ 28 : 1500,
+ 27 : 1453,
+ 26 : 1410,
+ 25 : 1364,
+ 24 : 1312,
+ 23 : 1271,
+ 22 : 1229,
+ 21 : 1180,
+ 20 : 1132,
+ 19 : 1084,
+ 18 : 1025,
+ 17 : 963,
+ 16 : 912,
+ 15 : 874,
+ 14 : 835,
+ 13 : 782,
+ 12 : 742,
+ 11 : 696,
+ 10 : 648,
+ 9 : 597,
+ 8 : 552,
+ 7 : 544,
+ 6 : 495,
+ 5 : 396
+}
+
class TestBranchUtility(object):
'''Mimics BranchUtility to return valid-ish data without needing omahaproxy
data.
'''
- def GetBranchForChannel(self, channel_name):
- return channel_name
+ def GetAllChannelInfo(self):
+ return [self.GetChannelInfo(channel)
+ for channel in BranchUtility.GetAllChannelNames()]
+
+ def GetChannelInfo(self, channel):
+ class TestChannelInfo(object):
+ def __init__(self, channel, branch, version):
+ self.channel = channel
+ self.branch = branch
+ self.version = version
+
+ return TestChannelInfo(channel, channels[channel][0], channels[channel][1])
+
+ def GetBranchNumberForVersion(self, version):
+ return branches[version]

Powered by Google App Engine
This is Rietveld 408576698