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

@@ -30,6 +30,7 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import static org.robolectric.shadows.ShadowLooper.shadowMainLooper;
import android.app.AppOpsManager;
import android.app.backup.BackupManager;
@@ -78,10 +79,12 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
import java.util.concurrent.TimeUnit;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowEntityHeaderController.class, ShadowActivityManager.class})
@Config(shadows = {
ShadowEntityHeaderController.class,
ShadowActivityManager.class,
com.android.settings.testutils.shadow.ShadowFragment.class,
})
public class AdvancedPowerUsageDetailTest {
private static final String APP_LABEL = "app label";
private static final String SUMMARY = "summary";
@@ -768,7 +771,7 @@ public class AdvancedPowerUsageDetailTest {
mFragment.onRadioButtonClicked(mOptimizePreference);
mFragment.onPause();
TimeUnit.SECONDS.sleep(100);
shadowMainLooper().idle();
verify(mMetricsFeatureProvider)
.action(
SettingsEnums.OPEN_APP_BATTERY_USAGE,
@@ -792,7 +795,7 @@ public class AdvancedPowerUsageDetailTest {
mFragment.onRadioButtonClicked(mOptimizePreference);
mFragment.onPause();
TimeUnit.SECONDS.sleep(100);
shadowMainLooper().idle();
verifyNoInteractions(mMetricsFeatureProvider);
}