Roll src/third_party/WebKit 6f84130:7353389 (svn 184386:184391)
[chromium-blink-merge.git] / tools / perf_expectations / PRESUBMIT.py
blobb74e2e67629c4498c396961f5d37606116a897ea
1 # Copyright (c) 2011 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.
5 """Presubmit script for perf_expectations.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8 details on the presubmit API built into gcl.
9 """
11 PERF_EXPECTATIONS = 'tools/perf_expectations/perf_expectations.json'
12 CONFIG_FILE = 'tools/perf_expectations/chromium_perf_expectations.cfg'
14 def CheckChangeOnUpload(input_api, output_api):
15 run_tests = False
16 for path in input_api.LocalPaths():
17 if (PERF_EXPECTATIONS == path or CONFIG_FILE == path):
18 run_tests = True
20 output = []
21 if run_tests:
22 whitelist = [r'.+_unittest\.py$']
23 output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
24 input_api, output_api, 'tests', whitelist))
25 return output
28 def CheckChangeOnCommit(input_api, output_api):
29 run_tests = False
30 for path in input_api.LocalPaths():
31 if (PERF_EXPECTATIONS == path or CONFIG_FILE == path):
32 run_tests = True
34 output = []
35 if run_tests:
36 whitelist = [r'.+_unittest\.py$']
37 output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
38 input_api, output_api, 'tests', whitelist))
40 output.extend(input_api.canned_checks.CheckDoNotSubmit(input_api,
41 output_api))
42 return output