1*3ac0a46fSAndroid Build Coastguard Worker# Copyright 2019 The PDFium Authors 2*3ac0a46fSAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 3*3ac0a46fSAndroid Build Coastguard Worker# found in the LICENSE file. 4*3ac0a46fSAndroid Build Coastguard Worker 5*3ac0a46fSAndroid Build Coastguard Worker"""Presubmit script for PDFium testing tools. 6*3ac0a46fSAndroid Build Coastguard Worker 7*3ac0a46fSAndroid Build Coastguard WorkerSee http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 8*3ac0a46fSAndroid Build Coastguard Workerfor more details on the presubmit API built into depot_tools. 9*3ac0a46fSAndroid Build Coastguard Worker""" 10*3ac0a46fSAndroid Build Coastguard Worker 11*3ac0a46fSAndroid Build Coastguard WorkerUSE_PYTHON3 = True 12*3ac0a46fSAndroid Build Coastguard Worker 13*3ac0a46fSAndroid Build Coastguard Worker 14*3ac0a46fSAndroid Build Coastguard Workerdef _CommonChecks(input_api, output_api): 15*3ac0a46fSAndroid Build Coastguard Worker tests = [] 16*3ac0a46fSAndroid Build Coastguard Worker tests.extend( 17*3ac0a46fSAndroid Build Coastguard Worker input_api.canned_checks.GetPylint(input_api, output_api, version='2.7')) 18*3ac0a46fSAndroid Build Coastguard Worker return tests 19*3ac0a46fSAndroid Build Coastguard Worker 20*3ac0a46fSAndroid Build Coastguard Worker 21*3ac0a46fSAndroid Build Coastguard Workerdef CheckChangeOnUpload(input_api, output_api): 22*3ac0a46fSAndroid Build Coastguard Worker tests = [] 23*3ac0a46fSAndroid Build Coastguard Worker tests.extend(_CommonChecks(input_api, output_api)) 24*3ac0a46fSAndroid Build Coastguard Worker return input_api.RunTests(tests) 25*3ac0a46fSAndroid Build Coastguard Worker 26*3ac0a46fSAndroid Build Coastguard Worker 27*3ac0a46fSAndroid Build Coastguard Workerdef CheckChangeOnCommit(input_api, output_api): 28*3ac0a46fSAndroid Build Coastguard Worker tests = [] 29*3ac0a46fSAndroid Build Coastguard Worker tests.extend(_CommonChecks(input_api, output_api)) 30*3ac0a46fSAndroid Build Coastguard Worker return input_api.RunTests(tests) 31