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

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

Issue 2819983002: (Reland) Expose resources in Robolectric/JUnit tests. (Closed)
Patch Set: Fix Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.testing.local; 5 package org.chromium.testing.local;
6 6
7 import org.junit.runners.model.InitializationError; 7 import org.junit.runners.model.InitializationError;
8 import org.robolectric.RobolectricTestRunner; 8 import org.robolectric.RobolectricTestRunner;
9 import org.robolectric.annotation.Config; 9 import org.robolectric.annotation.Config;
10 import org.robolectric.internal.ManifestFactory; 10 import org.robolectric.internal.ManifestFactory;
11 11
12 /** 12 /**
13 * A custom Robolectric Junit4 Test Runner with Chromium specific settings. 13 * A custom Robolectric Junit4 Test Runner with Chromium specific settings.
14 */ 14 */
15 public class LocalRobolectricTestRunner extends RobolectricTestRunner { 15 public class LocalRobolectricTestRunner extends RobolectricTestRunner {
16 private static final int DEFAULT_SDK = 25; 16 private static final int DEFAULT_SDK = 25;
17 private static final String DEFAULT_PACKAGE_NAME = "org.robolectric.default" ;
17 18
18 public LocalRobolectricTestRunner(Class<?> testClass) throws InitializationE rror { 19 public LocalRobolectricTestRunner(Class<?> testClass) throws InitializationE rror {
19 super(testClass); 20 super(testClass);
20 } 21 }
21 22
22 @Override 23 @Override
23 protected Config buildGlobalConfig() { 24 protected Config buildGlobalConfig() {
24 return new Config.Builder().setSdk(DEFAULT_SDK).build(); 25 String packageName =
26 System.getProperty("chromium.robolectric.package.name", DEFAULT_ PACKAGE_NAME);
27
28 return new Config.Builder().setSdk(DEFAULT_SDK).setPackageName(packageNa me).build();
25 } 29 }
26 30
27 @Override 31 @Override
28 protected ManifestFactory getManifestFactory(Config config) { 32 protected ManifestFactory getManifestFactory(Config config) {
29 return new GNManifestFactory(); 33 return new GNManifestFactory();
30 } 34 }
31 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698