OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from branch_utility import BranchUtility | 5 from branch_utility import BranchUtility |
6 | 6 |
| 7 channels = { |
| 8 'trunk': ['trunk', 'trunk'], |
| 9 'dev': [1500, 28], |
| 10 'beta': [1453, 27], |
| 11 'stable': [1410, 26] |
| 12 } |
| 13 |
| 14 branches = { |
| 15 'trunk' : 'trunk', |
| 16 28 : 1500, |
| 17 27 : 1453, |
| 18 26 : 1410, |
| 19 25 : 1364, |
| 20 24 : 1312, |
| 21 23 : 1271, |
| 22 22 : 1229, |
| 23 21 : 1180, |
| 24 20 : 1132, |
| 25 19 : 1084, |
| 26 18 : 1025, |
| 27 17 : 963, |
| 28 16 : 912, |
| 29 15 : 874, |
| 30 14 : 835, |
| 31 13 : 782, |
| 32 12 : 742, |
| 33 11 : 696, |
| 34 10 : 648, |
| 35 9 : 597, |
| 36 8 : 552, |
| 37 7 : 544, |
| 38 6 : 495, |
| 39 5 : 396 |
| 40 } |
| 41 |
7 class TestBranchUtility(object): | 42 class TestBranchUtility(object): |
8 '''Mimics BranchUtility to return valid-ish data without needing omahaproxy | 43 '''Mimics BranchUtility to return valid-ish data without needing omahaproxy |
9 data. | 44 data. |
10 ''' | 45 ''' |
11 def GetBranchForChannel(self, channel_name): | 46 def GetAllChannelInfo(self): |
12 return channel_name | 47 return [self.GetChannelInfo(channel) |
| 48 for channel in BranchUtility.GetAllChannelNames()] |
| 49 |
| 50 def GetChannelInfo(self, channel): |
| 51 class TestChannelInfo(object): |
| 52 def __init__(self, channel, branch, version): |
| 53 self.channel = channel |
| 54 self.branch = branch |
| 55 self.version = version |
| 56 |
| 57 return TestChannelInfo(channel, channels[channel][0], channels[channel][1]) |
| 58 |
| 59 def GetBranchNumberForVersion(self, version): |
| 60 return branches[version] |
OLD | NEW |