blob: 455701ec27ceeba3a70233264a3f85411e324eec [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return _CommonChecks(input_api, output_api)
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
would_affect_tests = [
need_to_run_unittests = False
for f in input_api.AffectedFiles():
if any(t for t in would_affect_tests if f.LocalPath().endswith(t)):
need_to_run_unittests = True
tests = [input_api.os_path.join(
input_api.PresubmitLocalPath(), '')]
input_api.canned_checks.RunUnitTests(input_api, output_api, tests))
return results