Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / resources / PRESUBMIT.py
blobc27f5a84a2959e7eab0b8b58b919c0a24394cf97
1 # Copyright (c) 2012 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 """Presubmit script for Chromium UI resources.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools, and see
9 http://www.chromium.org/developers/web-development-style-guide for the rules
10 we're checking against here.
11 """
14 def CheckChangeOnUpload(input_api, output_api):
15 return _CommonChecks(input_api, output_api)
18 def CheckChangeOnCommit(input_api, output_api):
19 return _CommonChecks(input_api, output_api)
22 def _CommonChecks(input_api, output_api):
23 """Checks common to both upload and commit."""
24 results = []
25 resources = input_api.PresubmitLocalPath()
27 # List of paths with their associated scale factor. This is used to verify
28 # that the images modified in one are the correct scale of the other.
29 path_scales = [
30 [(100, 'default_100_percent/'), (200, 'default_200_percent/')],
33 import sys
34 old_path = sys.path
36 try:
37 sys.path = [resources] + old_path
38 from resource_check import resource_scale_factors
40 for paths in path_scales:
41 results.extend(resource_scale_factors.ResourceScaleFactors(
42 input_api, output_api, paths).RunChecks())
43 finally:
44 sys.path = old_path
46 return results