Adopt robolectric 3.5.1
Bug: 70581603 Test: make RunSettingsRoboTests Change-Id: I21dba3381ae62ee12de1ce29bea473b3d0f069c0
This commit is contained in:
@@ -14,7 +14,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
|
||||
LOCAL_JAVA_LIBRARIES := \
|
||||
junit \
|
||||
platform-robolectric-3.4.2-prebuilt \
|
||||
platform-robolectric-3.5.1-prebuilt \
|
||||
telephony-common
|
||||
|
||||
LOCAL_INSTRUMENTATION_FOR := Settings
|
||||
@@ -42,4 +42,4 @@ LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src
|
||||
|
||||
LOCAL_ROBOTEST_TIMEOUT := 36000
|
||||
|
||||
include prebuilts/misc/common/robolectric/3.4.2/run_robotests.mk
|
||||
include prebuilts/misc/common/robolectric/3.5.1/run_robotests.mk
|
||||
|
@@ -50,7 +50,7 @@ public class HelpTrampolineTest {
|
||||
final Intent intent = new Intent().setClassName(
|
||||
RuntimeEnvironment.application.getPackageName(), HelpTrampoline.class.getName());
|
||||
|
||||
Robolectric.buildActivity(HelpTrampoline.class).withIntent(intent).create().get();
|
||||
Robolectric.buildActivity(HelpTrampoline.class, intent).create().get();
|
||||
|
||||
assertThat(ShadowHelpUtils.isGetHelpIntentCalled()).isFalse();
|
||||
}
|
||||
@@ -60,8 +60,8 @@ public class HelpTrampolineTest {
|
||||
final Intent intent = new Intent().setClassName(
|
||||
RuntimeEnvironment.application.getPackageName(), HelpTrampoline.class.getName())
|
||||
.putExtra(Intent.EXTRA_TEXT, "help_url_upgrading");
|
||||
final ShadowActivity shadow = shadowOf(Robolectric.buildActivity(HelpTrampoline.class)
|
||||
.withIntent(intent).create().get());
|
||||
final ShadowActivity shadow =
|
||||
shadowOf(Robolectric.buildActivity(HelpTrampoline.class, intent).create().get());
|
||||
final Intent launchedIntent = shadow.getNextStartedActivity();
|
||||
|
||||
assertThat(ShadowHelpUtils.isGetHelpIntentCalled()).isTrue();
|
||||
|
@@ -131,9 +131,7 @@ public class ChooseLockSettingsHelperTest {
|
||||
public void testLaunchConfirmationActivity_internal_shouldPropagateTheme() {
|
||||
Intent intent = new Intent()
|
||||
.putExtra(WizardManagerHelper.EXTRA_THEME, WizardManagerHelper.THEME_GLIF_V2);
|
||||
Activity activity = Robolectric.buildActivity(Activity.class)
|
||||
.withIntent(intent)
|
||||
.get();
|
||||
Activity activity = Robolectric.buildActivity(Activity.class, intent).get();
|
||||
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(activity);
|
||||
helper.launchConfirmationActivity(123, "test title", true, 0 /* userId */);
|
||||
|
||||
|
@@ -62,8 +62,8 @@ public class SettingsRobolectricTestRunner extends RobolectricTestRunner {
|
||||
|
||||
// By adding any resources from libraries we need the AndroidManifest, we can access
|
||||
// them from within the parallel universe's resource loader.
|
||||
final AndroidManifest manifest = new AndroidManifest(Fs.fileFromPath(manifestPath),
|
||||
Fs.fileFromPath(resDir), Fs.fileFromPath(assetsDir)) {
|
||||
return new AndroidManifest(Fs.fileFromPath(manifestPath), Fs.fileFromPath(resDir),
|
||||
Fs.fileFromPath(assetsDir), "com.android.settings") {
|
||||
@Override
|
||||
public List<ResourcePath> getIncludedResourcePaths() {
|
||||
List<ResourcePath> paths = super.getIncludedResourcePaths();
|
||||
@@ -71,10 +71,6 @@ public class SettingsRobolectricTestRunner extends RobolectricTestRunner {
|
||||
return paths;
|
||||
}
|
||||
};
|
||||
|
||||
// Set the package name to the renamed one
|
||||
manifest.setPackageName("com.android.settings");
|
||||
return manifest;
|
||||
}
|
||||
|
||||
public static void getIncludedResourcePaths(String packageName, List<ResourcePath> paths) {
|
||||
|
Reference in New Issue
Block a user