OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Top-level presubmit script for Blink. | 5 """Top-level presubmit script for Blink. |
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 gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 def _CheckForDangerousTestFunctions(input_api, output_api): | 168 def _CheckForDangerousTestFunctions(input_api, output_api): |
169 """Tests should not be using serveAsynchronousMockedRequests, since it does | 169 """Tests should not be using serveAsynchronousMockedRequests, since it does |
170 not guarantee that the threaded HTML parser will have completed.""" | 170 not guarantee that the threaded HTML parser will have completed.""" |
171 serve_async_requests_re = input_api.re.compile( | 171 serve_async_requests_re = input_api.re.compile( |
172 r'serveAsynchronousMockedRequests') | 172 r'serveAsynchronousMockedRequests') |
173 errors = input_api.canned_checks._FindNewViolationsOfRule( | 173 errors = input_api.canned_checks._FindNewViolationsOfRule( |
174 lambda _, x: not serve_async_requests_re.search(x), | 174 lambda _, x: not serve_async_requests_re.search(x), |
175 input_api, None) | 175 input_api, None) |
176 errors = [' * %s' % violation for violation in errors] | 176 errors = [' * %s' % violation for violation in errors] |
177 if errors: | 177 if errors: |
178 return [output_api.PresubmitError( | 178 return [output_api.PresubmitPromptOrNotify( |
179 'You should be using FrameTestHelpers::' | 179 'You should probably be using one of the FrameTestHelpers::' |
180 'pumpPendingRequests() instead of ' | 180 '(re)load* functions instead of ' |
181 'serveAsynchronousMockedRequests() in the following ' | 181 'serveAsynchronousMockedRequests() in the following ' |
182 'locations:\n%s' % '\n'.join(errors))] | 182 'locations:\n%s' % '\n'.join(errors))] |
183 return [] | 183 return [] |
184 | 184 |
185 | 185 |
186 def _CheckForFailInFile(input_api, f): | 186 def _CheckForFailInFile(input_api, f): |
187 pattern = input_api.re.compile('^FAIL') | 187 pattern = input_api.re.compile('^FAIL') |
188 errors = [] | 188 errors = [] |
189 for line_num, line in f.ChangedContents(): | 189 for line_num, line in f.ChangedContents(): |
190 if pattern.match(line): | 190 if pattern.match(line): |
191 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) | 191 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) |
192 return errors | 192 return errors |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 for master in masters: | 296 for master in masters: |
297 try_config.setdefault(master, {}) | 297 try_config.setdefault(master, {}) |
298 for builder in masters[master]: | 298 for builder in masters[master]: |
299 # Do not trigger presubmit builders, since they're likely to fail | 299 # Do not trigger presubmit builders, since they're likely to fail |
300 # (e.g. OWNERS checks before finished code review), and we're | 300 # (e.g. OWNERS checks before finished code review), and we're |
301 # running local presubmit anyway. | 301 # running local presubmit anyway. |
302 if 'presubmit' not in builder: | 302 if 'presubmit' not in builder: |
303 try_config[master][builder] = ['defaulttests'] | 303 try_config[master][builder] = ['defaulttests'] |
304 | 304 |
305 return try_config | 305 return try_config |
OLD | NEW |