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

Side by Side Diff: scripts/slave/unittests/extract_build_test.py

Issue 11451004: Bugfixing URL construction for extract build step (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Rebased Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/slave/slave_utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import unittest
8
9 import test_env # pylint: disable=W0403,W0611
10
11 from slave import extract_build
12 from slave import slave_utils
13
14 _SCRIPT_DIR = os.path.dirname(__file__)
15 _ABS_BUILD_DIR = os.path.abspath(_SCRIPT_DIR)
16
17
18 class MockOptions(object):
19 webkit_dir = None
20 build_properties = {}
21 factory_properties = {}
22
23
24 class ExtractBuildTest(unittest.TestCase):
25 def testGetBuildUrl(self):
26 options = MockOptions()
27
28 # version_suffix is not tested, since it would just be copying of
29 # implementation details from extract_build.py into this test.
30 base_filename, _version_suffix = slave_utils.GetZipFileNames(
31 options.build_properties, _ABS_BUILD_DIR, None, extract=True)
32
33 gs_url_without_slash = 'gs://foo/Win'
34 gs_url_with_slash = 'gs://foo/Win/'
35 gs_url_with_filename = 'gs://foo/Win/%s.zip' % base_filename
36 http_url_without_slash = 'http://foo/Win'
37 http_url_with_slash = 'http://foo/Win/'
38 http_url_with_filename = 'http://foo/Win/%s.zip' % base_filename
39 expected_gs_url = gs_url_with_slash + base_filename + '.zip'
40 expected_http_url = http_url_with_slash + base_filename + '.zip'
41
42 # Verify that only one slash is added: URL without ending slash.
43 self._VerifyBuildUrl(options, gs_url_without_slash, expected_gs_url)
44 self._VerifyBuildUrl(options, http_url_without_slash, expected_http_url)
45
46 # URL with ending slash.
47 self._VerifyBuildUrl(options, gs_url_with_slash, expected_gs_url)
48 self._VerifyBuildUrl(options, http_url_with_slash, expected_http_url)
49
50 # URL with filename.
51 self._VerifyBuildUrl(options, gs_url_with_filename, expected_gs_url)
52 self._VerifyBuildUrl(options, http_url_with_filename, expected_http_url)
53
54 def _VerifyBuildUrl(self, options, url_template, expected_url):
55 options.build_url = url_template
56 url, _versioned_url = extract_build.GetBuildUrl(_SCRIPT_DIR, options)
57 self.assertEquals(url, expected_url)
58
59 if __name__ == '__main__':
60 unittest.main()
OLDNEW
« no previous file with comments | « scripts/slave/slave_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698