OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import unittest |
| 6 |
| 7 import chromium_deps |
| 8 |
| 9 |
| 10 class ChromiumDEPSTest(unittest.TestCase): |
| 11 DEPS_TEMPLATE = """ |
| 12 vars = { |
| 13 "googlecode_url": "http://%%s.googlecode.com/svn", |
| 14 "webkit_trunk": "http://src.chromium.org/blink/trunk", |
| 15 "webkit_revision": "%s", |
| 16 "chromium_git": "https://chromium.googlesource.com", |
| 17 } |
| 18 |
| 19 deps = { |
| 20 "src/breakpad/src": |
| 21 (Var("googlecode_url") %% "google-breakpad") + "/trunk/src@%s", |
| 22 |
| 23 "src/third_party/WebKit": |
| 24 Var("webkit_trunk") + "@" + Var("webkit_revision"), |
| 25 } |
| 26 |
| 27 deps_os = { |
| 28 "unix": { |
| 29 "src/third_party/liblouis/src": |
| 30 Var("chromium_git") + |
| 31 "/external/liblouis.git@%s", |
| 32 } |
| 33 } |
| 34 """ |
| 35 |
| 36 def __init__(self, *args, **kwargs): |
| 37 super(ChromiumDEPSTest, self).__init__(*args, **kwargs) |
| 38 |
| 39 def testGetChromiumComponents(self): |
| 40 chromium_revision = '283296' |
| 41 webkit_revision = '178200' |
| 42 breakpad_revision = '1345' |
| 43 liblouis_commit_hashcode = '3c2daee56250162e5a75830871601d74328d39f5' |
| 44 |
| 45 def _GetContentOfDEPS(chromium_revision_tmp): |
| 46 self.assertEqual(chromium_revision_tmp, chromium_revision) |
| 47 return self.DEPS_TEMPLATE % (webkit_revision, breakpad_revision, |
| 48 liblouis_commit_hashcode) |
| 49 |
| 50 expected_results = { |
| 51 'src/breakpad/src/': { |
| 52 'path': 'src/breakpad/src/', |
| 53 'repository_type': 'svn', |
| 54 'name': 'breakpad', |
| 55 'repository': 'http://google-breakpad.googlecode.com/svn/trunk/src', |
| 56 'revision': breakpad_revision |
| 57 }, |
| 58 'src/third_party/liblouis/src/': { |
| 59 'path': 'src/third_party/liblouis/src/', |
| 60 'repository_type': 'git', |
| 61 'name': 'liblouis', |
| 62 'repository': |
| 63 'https://chromium.googlesource.com/external/liblouis.git', |
| 64 'revision': liblouis_commit_hashcode |
| 65 }, |
| 66 'src/': { |
| 67 'path': 'src/', |
| 68 'repository_type': 'svn', |
| 69 'name': 'chromium', |
| 70 'repository': 'https://src.chromium.org/chrome/trunk', |
| 71 'revision': chromium_revision |
| 72 }, |
| 73 'src/third_party/WebKit/': { |
| 74 'path': 'src/third_party/WebKit/', |
| 75 'repository_type': 'svn', |
| 76 'name': 'blink', |
| 77 'repository': 'http://src.chromium.org/blink/trunk', |
| 78 'revision': webkit_revision |
| 79 } |
| 80 } |
| 81 |
| 82 components = chromium_deps.GetChromiumComponents( |
| 83 chromium_revision, deps_file_downloader=_GetContentOfDEPS) |
| 84 self.assertEqual(expected_results, components) |
| 85 |
| 86 def testGetChromiumComponentRange(self): |
| 87 chromium_revision1 = '283296' |
| 88 webkit_revision1 = '178200' |
| 89 breakpad_revision1 = '1345' |
| 90 liblouis_commit_hashcode1 = '3c2daee56250162e5a75830871601d74328d39f5' |
| 91 |
| 92 chromium_revision2 = '283200' |
| 93 webkit_revision2 = '178084' |
| 94 breakpad_revision2 = '1345' |
| 95 liblouis_commit_hashcode2 = '3c2daee56250162e5a75830871601d74328d39f5' |
| 96 |
| 97 def _GetContentOfDEPS(chromium_revision): |
| 98 chromium_revision = str(chromium_revision) |
| 99 if chromium_revision == chromium_revision1: |
| 100 return self.DEPS_TEMPLATE % (webkit_revision1, breakpad_revision1, |
| 101 liblouis_commit_hashcode1) |
| 102 else: |
| 103 self.assertEqual(chromium_revision2, chromium_revision) |
| 104 return self.DEPS_TEMPLATE % (webkit_revision2, breakpad_revision2, |
| 105 liblouis_commit_hashcode2) |
| 106 |
| 107 expected_results = { |
| 108 'src/breakpad/src/': { |
| 109 'old_revision': breakpad_revision2, |
| 110 'name': 'breakpad', |
| 111 'repository': 'http://google-breakpad.googlecode.com/svn/trunk/src', |
| 112 'rolled': False, |
| 113 'new_revision': breakpad_revision1, |
| 114 'path': 'src/breakpad/src/', |
| 115 'repository_type': 'svn' |
| 116 }, |
| 117 'src/third_party/liblouis/src/': { |
| 118 'old_revision': liblouis_commit_hashcode2, |
| 119 'name': 'liblouis', |
| 120 'repository': |
| 121 'https://chromium.googlesource.com/external/liblouis.git', |
| 122 'rolled': False, |
| 123 'new_revision': liblouis_commit_hashcode1, |
| 124 'path': 'src/third_party/liblouis/src/', |
| 125 'repository_type': 'git' |
| 126 }, |
| 127 'src/': { |
| 128 'old_revision': chromium_revision2, |
| 129 'name': 'chromium', |
| 130 'repository': 'https://src.chromium.org/chrome/trunk', |
| 131 'rolled': True, |
| 132 'new_revision': chromium_revision1, |
| 133 'path': 'src/', |
| 134 'repository_type': 'svn' |
| 135 }, |
| 136 'src/third_party/WebKit/': { |
| 137 'old_revision': webkit_revision2, |
| 138 'name': 'blink', |
| 139 'repository': 'http://src.chromium.org/blink/trunk', |
| 140 'rolled': True, |
| 141 'new_revision': webkit_revision1, |
| 142 'path': 'src/third_party/WebKit/', |
| 143 'repository_type': 'svn' |
| 144 } |
| 145 } |
| 146 |
| 147 components = chromium_deps.GetChromiumComponentRange( |
| 148 chromium_revision1, chromium_revision2, |
| 149 deps_file_downloader=_GetContentOfDEPS) |
| 150 self.assertEqual(expected_results, components) |
OLD | NEW |