1 # Copyright 2014 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 def CheckChangeOnUpload(input_api
, output_api
):
6 return _CommonChecks(input_api
, output_api
)
8 def CheckChangeOnCommit(input_api
, output_api
):
9 return _CommonChecks(input_api
, output_api
)
11 def _CommonChecks(input_api
, output_api
):
12 """Checks common to both upload and commit."""
15 would_affect_tests
= [
17 'copyright_scanner.py',
18 'copyright_scanner_unittest.py'
20 need_to_run_unittests
= False
21 for f
in input_api
.AffectedFiles():
22 if any(t
for t
in would_affect_tests
if f
.LocalPath().endswith(t
)):
23 need_to_run_unittests
= True
25 tests
= [input_api
.os_path
.join(
26 input_api
.PresubmitLocalPath(), 'copyright_scanner_unittest.py')]
28 input_api
.canned_checks
.RunUnitTests(input_api
, output_api
, tests
))