Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / permissions / PRESUBMIT.py
blob421841c3009134b74e606e899d2f55b1f4e9df08
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 """Chromium presubmit script for src/extensions/common/permissions.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details on the presubmit API built into depot_tools.
9 """
10 import sys
12 def GetPreferredTrySlaves():
13 return ['linux_chromeos']
15 def _CreateAPIPermissionIDChecker(input_api, output_api):
16 original_sys_path = sys.path
18 try:
19 sys.path.append(input_api.os_path.join(
20 input_api.PresubmitLocalPath(), '..', '..', '..', 'tools',
21 'strict_enum_value_checker'))
22 from strict_enum_value_checker import StrictEnumValueChecker
23 finally:
24 sys.path = original_sys_path
26 return StrictEnumValueChecker(input_api, output_api,
27 start_marker=' enum ID {', end_marker=' // Last entry:',
28 path='extensions/common/permissions/api_permission.h')
30 def CheckChangeOnUpload(input_api, output_api):
31 return _CreateAPIPermissionIDChecker(input_api, output_api).Run()
33 def CheckChangeOnCommit(input_api, output_api):
34 return _CreateAPIPermissionIDChecker(input_api, output_api).Run()