Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 5621f9fd037151f6072d0ed06d0009e8efa9198d..5c18d2529619158b9a79dfcc614440b92fb06b5c 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -471,6 +471,21 @@ def _CheckUmaHistogramChanges(input_api, output_api): |
| 'been modified and the associated histogram name has no match in either ' |
| '%s or the modifications of it:' % (histograms_xml_path), problems)] |
| +def _CheckFlakyTestUsage(input_api, output_api): |
| + """Check that FlakyTest annotation is our own instead of the android one""" |
| + pattern = input_api.re.compile(r'import android.test.FlakyTest;') |
| + files = [] |
| + for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): |
| + if (f.LocalPath().endswith('Test.java')): |
|
rnephew (Reviews Here)
2016/04/11 18:58:26
nit:
if (f.LocalPath().endswith('Test.java')):
i
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
|
| + contents = input_api.ReadFile(f) |
| + if pattern.search(contents): |
|
rnephew (Reviews Here)
2016/04/11 18:58:26
Since contents isn't used elsewhere, you could pro
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
|
| + files.append(f) |
| + if len(files): |
| + return [ output_api.PresubmitError( |
|
rnephew (Reviews Here)
2016/04/11 18:56:30
nit: [output_api...
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
|
| + 'Use org.chromium.base.test.util.FlakyTest instead of ' + |
|
rnephew (Reviews Here)
2016/04/11 18:56:30
nit: 4 space indentation.
no need for + here. Thi
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
|
| + 'android.test.FlakyTest', |
| + files) ] |
|
rnephew (Reviews Here)
2016/04/11 18:56:30
nit: files)]
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
|
| + return [] |
| def _CheckNoNewWStrings(input_api, output_api): |
| """Checks to make sure we don't introduce use of wstrings.""" |
| @@ -1794,6 +1809,7 @@ def _CommonChecks(input_api, output_api): |
| results.extend(_CheckNoAbbreviationInPngFileName(input_api, output_api)) |
| results.extend(_CheckForInvalidOSMacros(input_api, output_api)) |
| results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api)) |
| + results.extend(_CheckFlakyTestUsage(input_api, output_api)) |
| # TODO(danakj): Remove this when base/move.h is removed. |
| results.extend(_CheckForUsingPass(input_api, output_api)) |
| results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api)) |