| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Presubmit script for files in chrome/browser/resources. | 5 """Presubmit script for files in chrome/browser/resources. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 html_element_re = r'<(.*?)(^|\s+)metric\s*=\s*"%s"(.*?)>' % (metric_name) | 85 html_element_re = r'<(.*?)(^|\s+)metric\s*=\s*"%s"(.*?)>' % (metric_name) |
| 86 type_re = (r'datatype\s*=\s*"boolean"|type\s*=\s*"checkbox"|' | 86 type_re = (r'datatype\s*=\s*"boolean"|type\s*=\s*"checkbox"|' |
| 87 'type\s*=\s*"radio".*?value\s*=\s*("true"|"false")') | 87 'type\s*=\s*"radio".*?value\s*=\s*("true"|"false")') |
| 88 | 88 |
| 89 match = input_api.re.search(html_element_re, new_content, input_api.re.DOTALL) | 89 match = input_api.re.search(html_element_re, new_content, input_api.re.DOTALL) |
| 90 return (match and | 90 return (match and |
| 91 any(input_api.re.search(type_re, match.group(i)) for i in (1, 3))) | 91 any(input_api.re.search(type_re, match.group(i)) for i in (1, 3))) |
| 92 | 92 |
| 93 | 93 |
| 94 def CheckHtml(input_api, output_api): | 94 def CheckHtml(input_api, output_api): |
| 95 return input_api.canned_checks.CheckLongLines(input_api, output_api, 80) | 95 return input_api.canned_checks.CheckLongLines( |
| 96 input_api, output_api, 80, lambda x: x.LocalPath().endswith('.html')) |
| 96 | 97 |
| 97 | 98 |
| 98 def RunVulcanizeTests(input_api, output_api): | 99 def RunVulcanizeTests(input_api, output_api): |
| 99 presubmit_path = input_api.PresubmitLocalPath() | 100 presubmit_path = input_api.PresubmitLocalPath() |
| 100 tests = [input_api.os_path.join(presubmit_path, 'vulcanize_gn_test.py')] | 101 tests = [input_api.os_path.join(presubmit_path, 'vulcanize_gn_test.py')] |
| 101 return input_api.canned_checks.RunUnitTests(input_api, output_api, tests) | 102 return input_api.canned_checks.RunUnitTests(input_api, output_api, tests) |
| 102 | 103 |
| 103 | 104 |
| 104 def _CheckChangeOnUploadOrCommit(input_api, output_api): | 105 def _CheckChangeOnUploadOrCommit(input_api, output_api): |
| 105 results = CheckUserActionUpdate(input_api, output_api, ACTION_XML_PATH) | 106 results = CheckUserActionUpdate(input_api, output_api, ACTION_XML_PATH) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 119 return _CheckChangeOnUploadOrCommit(input_api, output_api) | 120 return _CheckChangeOnUploadOrCommit(input_api, output_api) |
| 120 | 121 |
| 121 | 122 |
| 122 def PostUploadHook(cl, change, output_api): | 123 def PostUploadHook(cl, change, output_api): |
| 123 return output_api.EnsureCQIncludeTrybotsAreAdded( | 124 return output_api.EnsureCQIncludeTrybotsAreAdded( |
| 124 cl, | 125 cl, |
| 125 [ | 126 [ |
| 126 'master.tryserver.chromium.linux:closure_compilation', | 127 'master.tryserver.chromium.linux:closure_compilation', |
| 127 ], | 128 ], |
| 128 'Automatically added optional Closure bots to run on CQ.') | 129 'Automatically added optional Closure bots to run on CQ.') |
| OLD | NEW |