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): |
| 46 return self.DEPS_TEMPLATE % (webkit_revision, breakpad_revision, |
| 47 liblouis_commit_hashcode) |
| 48 |
| 49 expected_results = { |
| 50 'src/breakpad/src/': { |
| 51 'path': 'src/breakpad/src/', |
| 52 'repository_type': 'svn', |
| 53 'name': 'breakpad', |
| 54 'repository': 'http://google-breakpad.googlecode.com/svn/trunk/src', |
| 55 'revision': breakpad_revision |
| 56 }, |
| 57 'src/third_party/liblouis/src/': { |
| 58 'path': 'src/third_party/liblouis/src/', |
| 59 'repository_type': 'git', |
| 60 'name': 'liblouis', |
| 61 'repository': |
| 62 'https://chromium.googlesource.com/external/liblouis.git', |
| 63 'revision': liblouis_commit_hashcode |
| 64 }, |
| 65 'src/': { |
| 66 'path': 'src/', |
| 67 'repository_type': 'svn', |
| 68 'name': 'chromium', |
| 69 'repository': 'http://src.chromium.org/chrome/trunk', |
| 70 'revision': chromium_revision |
| 71 }, |
| 72 'src/third_party/WebKit/': { |
| 73 'path': 'src/third_party/WebKit/', |
| 74 'repository_type': 'svn', |
| 75 'name': 'blink', |
| 76 'repository': 'http://src.chromium.org/blink/trunk', |
| 77 'revision': webkit_revision |
| 78 } |
| 79 } |
| 80 |
| 81 components = chromium_deps.GetChromiumComponents( |
| 82 chromium_revision, deps_file_downloader=_GetContentOfDEPS) |
| 83 self.assertEqual(expected_results, components) |
| 84 |
| 85 def testGetChromiumComponentRange(self): |
| 86 chromium_revision1 = '283296' |
| 87 webkit_revision1 = '178200' |
| 88 breakpad_revision1 = '1345' |
| 89 liblouis_commit_hashcode1 = '3c2daee56250162e5a75830871601d74328d39f5' |
| 90 |
| 91 chromium_revision2 = '283200' |
| 92 webkit_revision2 = '178084' |
| 93 breakpad_revision2 = '1345' |
| 94 liblouis_commit_hashcode2 = '3c2daee56250162e5a75830871601d74328d39f5' |
| 95 |
| 96 def _GetContentOfDEPS(chromium_revision): |
| 97 chromium_revision = str(chromium_revision) |
| 98 if chromium_revision == chromium_revision1: |
| 99 return self.DEPS_TEMPLATE % (webkit_revision1, breakpad_revision1, |
| 100 liblouis_commit_hashcode1) |
| 101 else: |
| 102 self.assertEqual(chromium_revision2, chromium_revision) |
| 103 return self.DEPS_TEMPLATE % (webkit_revision2, breakpad_revision2, |
| 104 liblouis_commit_hashcode2) |
| 105 |
| 106 expected_results = { |
| 107 'src/breakpad/src/': { |
| 108 'old_revision': breakpad_revision2, |
| 109 'name': 'breakpad', |
| 110 'repository': 'http://google-breakpad.googlecode.com/svn/trunk/src', |
| 111 'rolled': False, |
| 112 'new_revision': breakpad_revision1, |
| 113 'path': 'src/breakpad/src/', |
| 114 'repository_type': 'svn' |
| 115 }, |
| 116 'src/third_party/liblouis/src/': { |
| 117 'old_revision': liblouis_commit_hashcode2, |
| 118 'name': 'liblouis', |
| 119 'repository': |
| 120 'https://chromium.googlesource.com/external/liblouis.git', |
| 121 'rolled': False, |
| 122 'new_revision': liblouis_commit_hashcode1, |
| 123 'path': 'src/third_party/liblouis/src/', |
| 124 'repository_type': 'git' |
| 125 }, |
| 126 'src/': { |
| 127 'old_revision': chromium_revision2, |
| 128 'name': 'chromium', |
| 129 'repository': 'http://src.chromium.org/chrome/trunk', |
| 130 'rolled': True, |
| 131 'new_revision': chromium_revision1, |
| 132 'path': 'src/', |
| 133 'repository_type': 'svn' |
| 134 }, |
| 135 'src/third_party/WebKit/': { |
| 136 'old_revision': webkit_revision2, |
| 137 'name': 'blink', |
| 138 'repository': 'http://src.chromium.org/blink/trunk', |
| 139 'rolled': True, |
| 140 'new_revision': webkit_revision1, |
| 141 'path': 'src/third_party/WebKit/', |
| 142 'repository_type': 'svn' |
| 143 } |
| 144 } |
| 145 |
| 146 components = chromium_deps.GetChromiumComponentRange( |
| 147 chromium_revision1, chromium_revision2, |
| 148 deps_file_downloader=_GetContentOfDEPS) |
| 149 self.assertEqual(expected_results, components) |
OLD | NEW |