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

Unified Diff: testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java

Issue 2710343003: Update Robolectric to 3.2.2 (Closed)
Patch Set: Update Robolectric to 3.2 Created 3 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
Index: testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
diff --git a/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java b/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
index 171b9c6aaf13047e5bf29b0501502ff0530293e3..02f8d4705b3734d410cbb8fff0721d00973048b3 100644
--- a/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
+++ b/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
@@ -7,37 +7,20 @@ package org.chromium.testing.local;
import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
-import org.robolectric.manifest.AndroidManifest;
+import org.robolectric.SdkPicker;
/**
- * A custom Robolectric Junit4 Test Runner. This test runner will ignore the
- * API level written in the AndroidManifest as that can cause issues if
- * Robolectric does not support that API level. The API level will be grabbed
- * from the robolectric Config annotation, or just be
- * |DEFAULT_ANDROID_API_LEVEL|
+ * A custom Robolectric Junit4 Test Runner. This test runner specifies which
+ * API levels are supported in Chromium.
*/
public class LocalRobolectricTestRunner extends RobolectricTestRunner {
- private static final int DEFAULT_ANDROID_API_LEVEL = 21;
-
public LocalRobolectricTestRunner(Class<?> testClass) throws InitializationError {
super(testClass);
}
@Override
- protected int pickSdkVersion(Config config, AndroidManifest appManifest) {
- // Pulling from the manifest is dangerous as the apk might target a version of
- // android that robolectric does not yet support. We still allow the API level to
- // be overridden with the Config annotation.
- if (config != null) {
- if (config.sdk().length > 1) {
- throw new IllegalArgumentException(
- "RobolectricTestRunner does not support multiple values for @Config.sdk");
- } else if (config.sdk().length == 1) {
- return config.sdk()[0];
- }
- }
- return DEFAULT_ANDROID_API_LEVEL;
+ protected SdkPicker createSdkPicker() {
+ return new SdkPicker(System.getProperties(), 18, 21, 25);
}
}

Powered by Google App Engine
This is Rietveld 408576698