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

Side by Side Diff: tools/perf/fetch_benchmark_deps_unittest.py

Issue 2694713006: [Telemetry] Make fetch_benchmark_deps_unittest mock archive_info2 (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | 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
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 os 5 import os
6 import sys 6 import sys
7 import unittest 7 import unittest
8 import StringIO 8 import StringIO
9 9
10 import mock # pylint: disable=import-error 10 import mock # pylint: disable=import-error
(...skipping 26 matching lines...) Expand all
37 It checks if the paths returned are expected and have corresponding sha1 37 It checks if the paths returned are expected and have corresponding sha1
38 checksums. The expected result can be omitted if the dependencies of 38 checksums. The expected result can be omitted if the dependencies of
39 specified benchmarks are subject to changes. 39 specified benchmarks are subject to changes.
40 40
41 Args: 41 Args:
42 benchmark_name: benchmark name 42 benchmark_name: benchmark name
43 expected_fetched_file_paths: the expected result. 43 expected_fetched_file_paths: the expected result.
44 """ 44 """
45 sys.argv[1] = benchmark_name 45 sys.argv[1] = benchmark_name
46 output = StringIO.StringIO() 46 output = StringIO.StringIO()
47 with mock.patch('telemetry.wpr.archive_info.WprArchiveInfo' 47 with mock.patch('telemetry.wpr.archive_info2.WprArchiveInfo'
48 '.DownloadArchivesIfNeeded') as mock_download: 48 '.DownloadArchivesIfNeeded') as mock_download:
49 with mock.patch('py_utils.cloud_storage' 49 with mock.patch('py_utils.cloud_storage'
50 '.GetFilesInDirectoryIfChanged') as mock_get: 50 '.GetFilesInDirectoryIfChanged') as mock_get:
51 mock_download.return_value = True 51 mock_download.return_value = True
52 mock_get.GetFilesInDirectoryIfChanged.return_value = True 52 mock_get.GetFilesInDirectoryIfChanged.return_value = True
53 fetch_benchmark_deps.main(output) 53 fetch_benchmark_deps.main(output)
54 for f in output.getvalue().splitlines(): 54 for f in output.getvalue().splitlines():
55 fullpath = os.path.join(path_util.GetChromiumSrcDir(), f) 55 fullpath = os.path.join(path_util.GetChromiumSrcDir(), f)
56 sha1path = fullpath + '.sha1' 56 sha1path = fullpath + '.sha1'
57 self.assertTrue(os.path.isfile(sha1path)) 57 self.assertTrue(os.path.isfile(sha1path))
58 if expected_fetched_file_paths: 58 if expected_fetched_file_paths:
59 self.assertEquals(expected_fetched_file_paths, 59 self.assertEquals(expected_fetched_file_paths,
60 NormPaths(output.getvalue())) 60 NormPaths(output.getvalue()))
61 61
62 def testFetchWPRs(self): 62 def testFetchWPRs(self):
63 self._RunFetchBenchmarkDepsTest('smoothness.top_25_smooth') 63 self._RunFetchBenchmarkDepsTest('smoothness.top_25_smooth')
64 64
65 def testFetchServingDirs(self): 65 def testFetchServingDirs(self):
66 self._RunFetchBenchmarkDepsTest('media.tough_video_cases') 66 self._RunFetchBenchmarkDepsTest('media.tough_video_cases')
67 67
68 def testFetchOctane(self): 68 def testFetchOctane(self):
69 octane_wpr_path = os.path.join( 69 octane_wpr_path = os.path.join(
70 os.path.dirname(__file__), 'page_sets', 'data', 'octane_002.wpr') 70 os.path.dirname(__file__), 'page_sets', 'data', 'octane_002.wpr')
71 expected = os.path.relpath(octane_wpr_path, 71 expected = os.path.relpath(octane_wpr_path,
72 path_util.GetChromiumSrcDir()) 72 path_util.GetChromiumSrcDir())
73 self._RunFetchBenchmarkDepsTest('octane', NormPaths(expected)) 73 self._RunFetchBenchmarkDepsTest('octane', NormPaths(expected))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698