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

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

Issue 2273553002: Create BaseJUnitClassRunner to run junit4 style tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not obfuscate junit Created 4 years, 2 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
Index: base/test/android/javatests/src/org/chromium/base/test/util/RestrictionSkipCheck.java
diff --git a/base/test/android/javatests/src/org/chromium/base/test/util/RestrictionSkipCheck.java b/base/test/android/javatests/src/org/chromium/base/test/util/RestrictionSkipCheck.java
index 00c04d46528d90d5f225e5928cb78d21d1fa7804..bdc083c7cda57dbfc28bd8d9a730bfa9ebb4c390 100644
--- a/base/test/android/javatests/src/org/chromium/base/test/util/RestrictionSkipCheck.java
+++ b/base/test/android/javatests/src/org/chromium/base/test/util/RestrictionSkipCheck.java
@@ -9,13 +9,11 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
-import junit.framework.TestCase;
+import org.junit.runners.model.FrameworkMethod;
import org.chromium.base.Log;
import org.chromium.base.SysUtils;
-import java.lang.reflect.Method;
-
/**
* Checks if any restrictions exist and skip the test if it meets those restrictions.
*/
@@ -30,15 +28,14 @@ public class RestrictionSkipCheck extends SkipCheck {
}
@Override
- public boolean shouldSkip(TestCase testCase) {
- Method method = getTestMethod(testCase);
- if (method == null) return true;
+ public boolean shouldSkip(FrameworkMethod frameworkMethod) {
+ if (frameworkMethod == null) return true;
- for (Restriction restriction : getAnnotations(method, Restriction.class)) {
+ for (Restriction restriction : getAnnotations(frameworkMethod, Restriction.class)) {
for (String restrictionVal : restriction.value()) {
if (restrictionApplies(restrictionVal)) {
- Log.i(TAG, "Test " + testCase.getClass().getName() + "#"
- + testCase.getName() + " skipped because of restriction "
+ Log.i(TAG, "Test " + frameworkMethod.getDeclaringClass().getName() + "#"
+ + frameworkMethod.getName() + " skipped because of restriction "
+ restriction);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698