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

Unified Diff: base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java

Issue 1748853002: [Android] Revise handling of document-mode-only tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix DocumentActivity after bad rebase in https://codereview.chromium.org/1688603004/ Created 4 years, 10 months 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
« no previous file with comments | « no previous file | base/test/android/javatests/src/org/chromium/base/test/BaseTestResult.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java
diff --git a/base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java b/base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java
index 669307c82b43c749422ba85bb07ce50f0aa4f4f4..24a7e3ad0d914f9f0f0ce5d6f2add04187403965 100644
--- a/base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java
+++ b/base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java
@@ -84,6 +84,9 @@ public class BaseInstrumentationTestRunner extends InstrumentationTestRunner {
if (restrictions != null) {
for (String restriction : restrictions.value()) {
if (restrictionApplies(restriction)) {
+ Log.i(TAG, "Test " + testCase.getClass().getName() + "#"
+ + testCase.getName() + " skipped because of restriction "
+ + restriction);
return true;
}
}
@@ -130,14 +133,23 @@ public class BaseInstrumentationTestRunner extends InstrumentationTestRunner {
@Override
public boolean shouldSkip(TestCase testCase) {
Class<?> testClass = testCase.getClass();
+ Method testMethod = getTestMethod(testCase);
+
+ int minSdkLevel = 0;
if (testClass.isAnnotationPresent(MinAndroidSdkLevel.class)) {
- MinAndroidSdkLevel v = testClass.getAnnotation(MinAndroidSdkLevel.class);
- if (Build.VERSION.SDK_INT < v.value()) {
- Log.i(TAG, "Test " + testClass.getName() + "#" + testCase.getName()
- + " is not enabled at SDK level " + Build.VERSION.SDK_INT
- + ".");
- return true;
- }
+ minSdkLevel = Math.max(testClass.getAnnotation(MinAndroidSdkLevel.class).value(),
+ minSdkLevel);
+ }
+ if (testMethod != null && testMethod.isAnnotationPresent(MinAndroidSdkLevel.class)) {
+ minSdkLevel = Math.max(testMethod.getAnnotation(MinAndroidSdkLevel.class).value(),
+ minSdkLevel);
+ }
+
+ if (Build.VERSION.SDK_INT < minSdkLevel) {
+ Log.i(TAG, "Test " + testClass.getName() + "#" + testCase.getName()
+ + " is not enabled at SDK level " + Build.VERSION.SDK_INT
+ + ".");
+ return true;
}
return false;
}
« no previous file with comments | « no previous file | base/test/android/javatests/src/org/chromium/base/test/BaseTestResult.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698