OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import collections | 5 import collections |
6 | 6 |
7 from testing_utils import testing | 7 from testing_utils import testing |
8 | 8 |
9 from common import chromium_deps | 9 from common import chromium_deps |
10 from common import deps_parser | 10 from common import deps_parser |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 expected_dependency_dict[root_dep.path] = root_dep | 100 expected_dependency_dict[root_dep.path] = root_dep |
101 child1_dep.SetParent(root_dep) | 101 child1_dep.SetParent(root_dep) |
102 child2_dep.SetParent(root_dep) | 102 child2_dep.SetParent(root_dep) |
103 grand_child1.SetParent(child1_dep) | 103 grand_child1.SetParent(child1_dep) |
104 | 104 |
105 self.mock(deps_parser, 'UpdateDependencyTree', DummyUpdateDependencyTree) | 105 self.mock(deps_parser, 'UpdateDependencyTree', DummyUpdateDependencyTree) |
106 | 106 |
107 dependency_dict = chromium_deps.GetChromeDependency( | 107 dependency_dict = chromium_deps.GetChromeDependency( |
108 src_revision, os_platform) | 108 src_revision, os_platform) |
109 self.assertEqual(expected_dependency_dict, dependency_dict) | 109 self.assertEqual(expected_dependency_dict, dependency_dict) |
| 110 |
| 111 def testGetChromiumDEPSRolls(self): |
| 112 def MockGetChromeDependency(revision, os_platform): |
| 113 self.assertEqual('unix', os_platform) |
| 114 if revision == 'rev2': |
| 115 return { |
| 116 'src/': Dependency('src/', 'https://url_src', 'rev2', 'DEPS'), |
| 117 'src/dep1': Dependency('src/dep1', 'https://url_dep1', '9', 'DEPS'), |
| 118 'src/dep2': Dependency('src/dep2', 'https://url_dep2', '5', 'DEPS'), |
| 119 'src/dep3': Dependency('src/dep3', 'https://url_dep3', '1', 'DEPS'), |
| 120 } |
| 121 else: |
| 122 self.assertEqual('rev1', revision) |
| 123 return { |
| 124 'src/': Dependency('src/', 'https://url_src', 'rev1', 'DEPS'), |
| 125 'src/dep1': Dependency('src/dep1', 'https://url_dep1', '7', 'DEPS'), |
| 126 'src/dep2': Dependency('src/dep2', 'https://url_dep2', '5', 'DEPS'), |
| 127 } |
| 128 |
| 129 self.mock(chromium_deps, 'GetChromeDependency', MockGetChromeDependency) |
| 130 |
| 131 expected_deps_rolls = [ |
| 132 { |
| 133 'path': 'src/dep1', |
| 134 'repo_url': 'https://url_dep1', |
| 135 'old_revision': '7', |
| 136 'new_revision': '9', |
| 137 }, |
| 138 { |
| 139 'path': 'src/dep3', |
| 140 'repo_url': 'https://url_dep3', |
| 141 'old_revision': None, |
| 142 'new_revision': '1', |
| 143 }, |
| 144 ] |
| 145 |
| 146 deps_rolls = chromium_deps.GetChromiumDEPSRolls('rev1', 'rev2', 'unix') |
| 147 self.assertEqual(expected_deps_rolls, |
| 148 [roll.ToDict() for roll in deps_rolls]) |
OLD | NEW |