Call into ViewTargeter from View::HitTestRect()
[chromium-blink-merge.git] / tools / PRESUBMIT.py
blobaff6048f1a8a45e277e3e771a281f0e167d65360
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
3 # found in the LICENSE file.
5 """Top-level presubmit script for bisect/perf trybot.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8 details on the presubmit API built into gcl.
9 """
11 import imp
12 import os
14 def _ExamineConfigFiles(input_api):
15 for f in input_api.AffectedFiles():
16 if (not f.LocalPath().endswith('run-bisect-perf-regression.cfg') and
17 not f.LocalPath().endswith('run-perf-test.cfg')):
18 continue
20 try:
21 cfg_file = imp.load_source('config', os.path.basename(f.LocalPath()))
23 for k, v in cfg_file.config.iteritems():
24 if v:
25 return f.LocalPath()
26 except (IOError, AttributeError, TypeError):
27 return f.LocalPath()
29 return None
31 def _CheckNoChangesToBisectConfigFile(input_api, output_api):
32 results = _ExamineConfigFiles(input_api)
33 if results:
34 return [output_api.PresubmitError(
35 'The bisection config file should only contain a config dict with '
36 'empty fields. Changes to this file should never be submitted.',
37 items=[results])]
39 return []
41 def CommonChecks(input_api, output_api):
42 results = []
43 results.extend(_CheckNoChangesToBisectConfigFile(input_api, output_api))
44 return results
46 def CheckChangeOnUpload(input_api, output_api):
47 return CommonChecks(input_api, output_api)
49 def CheckChangeOnCommit(input_api, output_api):
50 return CommonChecks(input_api, output_api)