1# Copyright 2017 The PDFium 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. 4 5"""Presubmit script for pdfium. 6 7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 8for more details about the presubmit API built into depot_tools. 9""" 10 11def _CheckPublicHeaders(input_api, output_api): 12 """Checks that the public headers match the API tests.""" 13 src_path = input_api.os_path.dirname(input_api.PresubmitLocalPath()) 14 check_script = input_api.os_path.join( 15 src_path, 'testing' , 'tools' , 'api_check.py') 16 try: 17 input_api.subprocess.check_output(check_script) 18 return [] 19 except input_api.subprocess.CalledProcessError as error: 20 return [output_api.PresubmitError('api_check.py failed:', 21 long_text=error.output)] 22 23 24def CheckChangeOnUpload(input_api, output_api): 25 results = [] 26 results += _CheckPublicHeaders(input_api, output_api) 27 return results 28 29 30def CheckChangeOnCommit(input_api, output_api): 31 results = [] 32 results += _CheckPublicHeaders(input_api, output_api) 33 return results 34