Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: PRESUBMIT_test.py

Issue 2583933003: Replace deprecated Android java test annotations (Closed)
Patch Set: Rebase again :( Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: PRESUBMIT_test.py
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 34da837503ee43af54f882c1b709baaff0b4ce00..1b5fd316720d4e15dcc219375ad489c2f5f409cb 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -959,6 +959,53 @@ class PydepsNeedsUpdatingTest(unittest.TestCase):
self.assertTrue('File is stale' in str(results[1]))
+class AndroidDeprecatedTestAnnotationTest(unittest.TestCase):
+ def testCheckAndroidTestAnnotationUsage(self):
+ mock_input_api = MockInputApi()
+ mock_output_api = MockOutputApi()
+
+ mock_input_api.files = [
+ MockAffectedFile('LalaLand.java', [
+ 'random stuff'
+ ]),
+ MockAffectedFile('CorrectUsage.java', [
+ 'import android.support.test.filters.LargeTest;',
+ 'import android.support.test.filters.MediumTest;',
+ 'import android.support.test.filters.SmallTest;',
+ ]),
+ MockAffectedFile('UsedDeprecatedLargeTestAnnotation.java', [
+ 'import android.test.suitebuilder.annotation.LargeTest;',
+ ]),
+ MockAffectedFile('UsedDeprecatedMediumTestAnnotation.java', [
+ 'import android.test.suitebuilder.annotation.MediumTest;',
+ ]),
+ MockAffectedFile('UsedDeprecatedSmallTestAnnotation.java', [
+ 'import android.test.suitebuilder.annotation.SmallTest;',
+ ]),
+ MockAffectedFile('UsedDeprecatedSmokeAnnotation.java', [
+ 'import android.test.suitebuilder.annotation.Smoke;',
+ ])
+ ]
+ msgs = PRESUBMIT._CheckAndroidTestAnnotationUsage(
+ mock_input_api, mock_output_api)
+ self.assertEqual(1, len(msgs),
+ 'Expected %d items, found %d: %s'
+ % (1, len(msgs), msgs))
+ self.assertEqual(4, len(msgs[0].items),
+ 'Expected %d items, found %d: %s'
+ % (4, len(msgs[0].items), msgs[0].items))
+ self.assertTrue('UsedDeprecatedLargeTestAnnotation.java:1' in msgs[0].items,
+ 'UsedDeprecatedLargeTestAnnotation not found in errors')
+ self.assertTrue('UsedDeprecatedMediumTestAnnotation.java:1'
+ in msgs[0].items,
+ 'UsedDeprecatedMediumTestAnnotation not found in errors')
+ self.assertTrue('UsedDeprecatedSmallTestAnnotation.java:1' in msgs[0].items,
+ 'UsedDeprecatedSmallTestAnnotation not found in errors')
+ self.assertTrue('UsedDeprecatedSmokeAnnotation.java:1' in msgs[0].items,
+ 'UsedDeprecatedSmokeAnnotation not found in errors')
+
+
+
class LogUsageTest(unittest.TestCase):
def testCheckAndroidCrLogUsage(self):
« no previous file with comments | « PRESUBMIT.py ('k') | android_webview/javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698