Setup external/robolectric for SettingsRoboTests

Current failing tests: ab/I64100010182936387
Had to Ignore some of com.android.settings.accessibility tests, which will be fixed separately

Bug: 261728063
Test: atest SettingsRoboTests -- --test-arg com.android.tradefed.testtype.IsolatedHostTest:java-flags:-XX:CompressedClassSpaceSize=3g

Change-Id: I4a0cb992db924936826e0c9808accc78dddb5f30
This commit is contained in:
Rex Hoffman
2023-06-07 20:20:58 +00:00
committed by Kevin Liu
parent 4f510190b3
commit 3c961e1c0e
180 changed files with 1339 additions and 157 deletions

View File

@@ -125,6 +125,7 @@ public class CreateShortcutPreferenceControllerTest {
new Intent(CreateShortcutPreferenceController.SHORTCUT_PROBE),
Arrays.asList(ri1, ri2));
doReturn(false).when(mController).canShowWifiHotspot();
final List<ResolveInfo> info = mController.queryShortcuts();
assertThat(info).hasSize(1);
assertThat(info.get(0).activityInfo).isEqualTo(ri2.activityInfo);
@@ -150,6 +151,7 @@ public class CreateShortcutPreferenceControllerTest {
new Intent(CreateShortcutPreferenceController.SHORTCUT_PROBE),
Arrays.asList(ri1, ri2));
doReturn(false).when(mController).canShowWifiHotspot();
final List<ResolveInfo> info = mController.queryShortcuts();
assertThat(info).hasSize(2);
assertThat(info.get(0).activityInfo).isEqualTo(ri2.activityInfo);
@@ -158,6 +160,7 @@ public class CreateShortcutPreferenceControllerTest {
@Test
public void queryShortcuts_setSupportOneHandedMode_ShouldEnableShortcuts() {
doReturn(true).when(mController).canShowWifiHotspot();
SystemProperties.set(SUPPORT_ONE_HANDED_MODE, "true");
setupActivityInfo(Settings.OneHandedSettingsActivity.class.getSimpleName());
@@ -166,6 +169,7 @@ public class CreateShortcutPreferenceControllerTest {
@Test
public void queryShortcuts_setUnsupportOneHandedMode_ShouldDisableShortcuts() {
doReturn(false).when(mController).canShowWifiHotspot();
SystemProperties.set(SUPPORT_ONE_HANDED_MODE, "false");
setupActivityInfo(Settings.OneHandedSettingsActivity.class.getSimpleName());
@@ -174,7 +178,7 @@ public class CreateShortcutPreferenceControllerTest {
@Test
public void queryShortcuts_configShowWifiHotspot_ShouldEnableShortcuts() {
when(mController.canShowWifiHotspot()).thenReturn(true);
doReturn(true).when(mController).canShowWifiHotspot();
setupActivityInfo(Settings.WifiTetherSettingsActivity.class.getSimpleName());
assertThat(mController.queryShortcuts()).hasSize(1);
@@ -182,7 +186,7 @@ public class CreateShortcutPreferenceControllerTest {
@Test
public void queryShortcuts_configNotShowWifiHotspot_ShouldDisableShortcuts() {
when(mController.canShowWifiHotspot()).thenReturn(false);
doReturn(false).when(mController).canShowWifiHotspot();
setupActivityInfo(Settings.WifiTetherSettingsActivity.class.getSimpleName());
assertThat(mController.queryShortcuts()).hasSize(0);