OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Presubmit script for changes affecting content/test/gpu/page_sets/. | 5 """Presubmit script for changes affecting content/test/gpu/page_sets/. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 | 13 |
14 | 14 |
15 def _GetChromiumSrcDir(input_api): | 15 def _GetChromiumSrcDir(input_api): |
16 return input_api.os_path.abspath(input_api.os_path.join( | 16 return input_api.os_path.abspath(input_api.os_path.join( |
17 input_api.PresubmitLocalPath(), '..', '..', '..', '..')) | 17 input_api.PresubmitLocalPath(), '..', '..', '..', '..')) |
18 | 18 |
19 | 19 |
20 def _CheckWprShaFiles(input_api, output_api): | 20 def _CheckWprShaFiles(input_api, output_api): |
21 """Check whether the wpr sha files have matching URLs.""" | 21 """Check whether the wpr sha files have matching URLs.""" |
22 old_sys_path = sys.path | 22 old_sys_path = sys.path |
23 try: | 23 try: |
24 catapult_base_path = input_api.os_path.join( | 24 py_utils_path = input_api.os_path.join( |
25 _GetChromiumSrcDir(input_api), 'third_party', 'catapult', | 25 _GetChromiumSrcDir(input_api), 'third_party', 'catapult', 'common', |
26 'catapult_base') | 26 'py_utils') |
27 sys.path.insert(1, catapult_base_path) | 27 sys.path.insert(1, py_utils_path) |
28 from catapult_base import cloud_storage # pylint: disable=import-error | 28 from py_utils import cloud_storage # pylint: disable=import-error |
29 finally: | 29 finally: |
30 sys.path = old_sys_path | 30 sys.path = old_sys_path |
31 | 31 |
32 results = [] | 32 results = [] |
33 for affected_file in input_api.AffectedFiles(include_deletes=False): | 33 for affected_file in input_api.AffectedFiles(include_deletes=False): |
34 filename = affected_file.AbsoluteLocalPath() | 34 filename = affected_file.AbsoluteLocalPath() |
35 if not filename.endswith('wpr.sha1'): | 35 if not filename.endswith('wpr.sha1'): |
36 continue | 36 continue |
37 expected_hash = cloud_storage.ReadHash(filename) | 37 expected_hash = cloud_storage.ReadHash(filename) |
38 is_wpr_file_uploaded = any( | 38 is_wpr_file_uploaded = any( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 def CheckChangeOnUpload(input_api, output_api): | 75 def CheckChangeOnUpload(input_api, output_api): |
76 results = [] | 76 results = [] |
77 results.extend(_CommonChecks(input_api, output_api)) | 77 results.extend(_CommonChecks(input_api, output_api)) |
78 return results | 78 return results |
79 | 79 |
80 | 80 |
81 def CheckChangeOnCommit(input_api, output_api): | 81 def CheckChangeOnCommit(input_api, output_api): |
82 results = [] | 82 results = [] |
83 results.extend(_CommonChecks(input_api, output_api)) | 83 results.extend(_CommonChecks(input_api, output_api)) |
84 return results | 84 return results |
OLD | NEW |