Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 Chromium. | 5 """Top-level presubmit script for Chromium. |
| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 | 289 |
| 290 | 290 |
| 291 def _CheckNoUNIT_TESTInSourceFiles(input_api, output_api): | 291 def _CheckNoUNIT_TESTInSourceFiles(input_api, output_api): |
| 292 """Checks to make sure no source files use UNIT_TEST""" | 292 """Checks to make sure no source files use UNIT_TEST""" |
| 293 problems = [] | 293 problems = [] |
| 294 for f in input_api.AffectedFiles(): | 294 for f in input_api.AffectedFiles(): |
| 295 if (not f.LocalPath().endswith(('.cc', '.mm'))): | 295 if (not f.LocalPath().endswith(('.cc', '.mm'))): |
| 296 continue | 296 continue |
| 297 | 297 |
| 298 for line_num, line in f.ChangedContents(): | 298 for line_num, line in f.ChangedContents(): |
| 299 if 'UNIT_TEST' in line: | 299 if 'UNIT_TEST ' in line: |
|
Jói
2013/11/18 06:41:19
Suggest combining these conditionals since the act
rvargas (doing something else)
2013/11/18 19:07:37
:) done
| |
| 300 problems.append(' %s:%d' % (f.LocalPath(), line_num)) | |
| 301 | |
| 302 if line.endswith('UNIT_TEST'): | |
| 300 problems.append(' %s:%d' % (f.LocalPath(), line_num)) | 303 problems.append(' %s:%d' % (f.LocalPath(), line_num)) |
| 301 | 304 |
| 302 if not problems: | 305 if not problems: |
| 303 return [] | 306 return [] |
| 304 return [output_api.PresubmitPromptWarning('UNIT_TEST is only for headers.\n' + | 307 return [output_api.PresubmitPromptWarning('UNIT_TEST is only for headers.\n' + |
| 305 '\n'.join(problems))] | 308 '\n'.join(problems))] |
| 306 | 309 |
| 307 | 310 |
| 308 def _CheckNoNewWStrings(input_api, output_api): | 311 def _CheckNoNewWStrings(input_api, output_api): |
| 309 """Checks to make sure we don't introduce use of wstrings.""" | 312 """Checks to make sure we don't introduce use of wstrings.""" |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1077 trybots += ['cros_x86'] | 1080 trybots += ['cros_x86'] |
| 1078 | 1081 |
| 1079 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1082 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
| 1080 # unless they're .gyp(i) files as changes to those files can break the gyp | 1083 # unless they're .gyp(i) files as changes to those files can break the gyp |
| 1081 # step on that bot. | 1084 # step on that bot. |
| 1082 if (not all(re.search('^chrome', f) for f in files) or | 1085 if (not all(re.search('^chrome', f) for f in files) or |
| 1083 any(re.search('\.gypi?$', f) for f in files)): | 1086 any(re.search('\.gypi?$', f) for f in files)): |
| 1084 trybots += ['android_aosp'] | 1087 trybots += ['android_aosp'] |
| 1085 | 1088 |
| 1086 return trybots | 1089 return trybots |
| OLD | NEW |