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

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

Issue 2710343003: Update Robolectric to 3.2.2 (Closed)
Patch Set: Small fix to StripLayoutHelperTest Created 3 years, 9 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..ae72114f37ab032cedaac73d8f4c3798333876d7 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
@@ -5,39 +5,27 @@
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.internal.ManifestFactory;
/**
- * 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 with Chromium specific settings.
*/
public class LocalRobolectricTestRunner extends RobolectricTestRunner {
-
- private static final int DEFAULT_ANDROID_API_LEVEL = 21;
+ private static final int DEFAULT_SDK = 25;
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 Config buildGlobalConfig() {
+ return new Config.Builder().setSdk(DEFAULT_SDK).build();
+ }
+
+ @Override
+ protected ManifestFactory getManifestFactory(Config config) {
+ return new GNManifestFactory();
}
}
« no previous file with comments | « testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java ('k') | third_party/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698