Fix broken tests of AppInfoDashboardFragmentTest

Fixes: 218798403
Test: robotests
Change-Id: Id263259b778c3b12728eb6831afb286e0a2772ae
This commit is contained in:
Yanting Yang
2022-02-10 18:54:31 +08:00
parent 4ed41905c3
commit 2b6746b183

View File

@@ -16,6 +16,7 @@
package com.android.settings.applications.appinfo;
import static com.android.settings.applications.appinfo.AppInfoDashboardFragment.ACCESS_RESTRICTED_SETTINGS;
import static com.android.settings.applications.appinfo.AppInfoDashboardFragment.ARG_PACKAGE_NAME;
import static com.android.settings.applications.appinfo.AppInfoDashboardFragment.UNINSTALL_ALL_USERS_MENU;
import static com.android.settings.applications.appinfo.AppInfoDashboardFragment.UNINSTALL_UPDATES;
@@ -55,7 +56,6 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -145,7 +145,6 @@ public final class AppInfoDashboardFragmentTest {
}
@Test
@Ignore
public void onPrepareOptionsMenu_setUpdateMenuVisible_byDefaultForSystemApps_shouldBeTrue() {
Menu menu = onPrepareOptionsMenuTestsSetup();
mFragment.onPrepareOptionsMenu(menu);
@@ -155,7 +154,6 @@ public final class AppInfoDashboardFragmentTest {
@Test
@Config(qualifiers = "mcc999")
@Ignore
public void onPrepareOptionsMenu_setUpdateMenuVisible_ifDisabledByDevice_shouldBeFalse() {
Menu menu = onPrepareOptionsMenuTestsSetup();
mFragment.onPrepareOptionsMenu(menu);
@@ -168,8 +166,10 @@ public final class AppInfoDashboardFragmentTest {
Menu menu = mock(Menu.class);
final MenuItem uninstallUpdatesMenuItem = mock(MenuItem.class);
final MenuItem uninstallForAllMenuItem = mock(MenuItem.class);
final MenuItem accessRestrictedMenuItem = mock(MenuItem.class);
when(menu.findItem(UNINSTALL_UPDATES)).thenReturn(uninstallUpdatesMenuItem);
when(menu.findItem(UNINSTALL_ALL_USERS_MENU)).thenReturn(uninstallForAllMenuItem);
when(menu.findItem(ACCESS_RESTRICTED_SETTINGS)).thenReturn(accessRestrictedMenuItem);
// Setup work to prevent NPE
final ApplicationInfo info = new ApplicationInfo();