Settings: Fix queryShortcuts_shouldOnlyIncludeSystemApp test

Previously this test asserted that the ActivityInfo instances
were the same address. While this can assert general equality,
it is more robust to assert the ActivityInfo's properties-
mainly that the associated application is a system app.

Bug: b/314924127
Test: atest SettingsRoboTests:com.android.settings.shortcut.CreateShortcutPreferenceControllerTest
Flag: TEST_ONLY
Change-Id: I0d60fb848afdd40cecf3f3393421006ad1ff1086
This commit is contained in:
Wes Okuhara
2024-11-08 12:12:16 -08:00
parent 3d21de7e38
commit fd77ab6182

View File

@@ -116,7 +116,6 @@ public class CreateShortcutPreferenceControllerTest {
.isEqualTo(SHORTCUT_ID_PREFIX + intent.getComponent().flattenToShortString());
}
@Ignore("b/314924127")
@Test
public void queryShortcuts_shouldOnlyIncludeSystemApp() {
final ResolveInfo ri1 = new ResolveInfo();
@@ -137,7 +136,9 @@ public class CreateShortcutPreferenceControllerTest {
doReturn(false).when(mController).canShowWifiHotspot();
final List<ResolveInfo> info = mController.queryShortcuts();
assertThat(info).hasSize(1);
assertThat(info.get(0).activityInfo).isEqualTo(ri2.activityInfo);
final ActivityInfo resultActivityInfo = info.get(0).activityInfo;
assertThat(resultActivityInfo.name).isEqualTo(ri2.activityInfo.name);
assertThat(resultActivityInfo.applicationInfo.isSystemApp()).isTrue();
}
@Ignore("b/314924127")