Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 5548a58b0d611d8c82d4b9ae7d8dd159d2f793fb..ae2cc35f316d9fcfbe347a9cfe8938970b099cc9 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -1721,6 +1721,34 @@ def _CheckAndroidCrLogUsage(input_api, output_api): |
| return results |
| +def _CheckAndroidTestAnnotationUsage(input_api, output_api): |
| + """Check that the deprecated test annotations like, "Smoke" |
|
jbudorick
2016/12/20 00:22:19
nit:
"""Checks that android.test.suitebuilder.ann
|
| + "android.test.suitebuilder.annotation.SmallTest", should no longer be used |
| + """ |
| + deprecated_annotation_import_pattern = input_api.re.compile( |
| + r'^import android\.test\.suitebuilder\.annotation\..*;', |
| + input_api.re.MULTILINE) |
| + sources = lambda x: input_api.FilterSourceFile(x, white_list=(r'.*\.java$',), |
|
jbudorick
2016/12/20 00:22:19
nit: drop all params onto the following line.
|
| + black_list=None) |
| + errors = [] |
| + for f in input_api.AffectedFiles(sources): |
| + for line_num, line in f.ChangedContents(): |
| + if deprecated_annotation_import_pattern.search(line): |
| + errors.append("%s:%d" % (f.LocalPath(), line_num)) |
| + |
| + results = [] |
| + if errors: |
| + results.append(output_api.PresubmitError( |
| + 'Annotations in android.test.suitebuilder.annotation is deprecated since' |
|
jbudorick
2016/12/20 00:22:19
nit:
Annotations in android.test.suitebuilder.ann
|
| + ' level 24, please replace the annotation with' |
| + ' classes in android.support.test.filters. Import' |
| + ' "//third_party/android_support_test_runner:runner_java" in your BUILD' |
| + ' file if neccessary. Contact yolandyan@chromium.org is you have any' |
| + ' questions', |
| + errors)) |
| + return results |
| + |
| + |
| def _CheckAndroidNewMdpiAssetLocation(input_api, output_api): |
| """Checks if MDPI assets are placed in a correct directory.""" |
| file_filter = lambda f: (f.LocalPath().endswith('.png') and |
| @@ -1998,6 +2026,7 @@ def _AndroidSpecificOnUploadChecks(input_api, output_api): |
| results.extend(_CheckAndroidCrLogUsage(input_api, output_api)) |
| results.extend(_CheckAndroidNewMdpiAssetLocation(input_api, output_api)) |
| results.extend(_CheckAndroidToastUsage(input_api, output_api)) |
| + results.extend(_CheckAndroidTestAnnotationUsage(input_api, output_api)) |
| return results |