Loading tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java +13 −14 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.settings.applications; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -48,12 +49,13 @@ import com.android.settingslib.widget.LayoutPreference; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; Loading @@ -62,6 +64,8 @@ import org.robolectric.util.ReflectionHelpers; @RunWith(RobolectricTestRunner.class) @Config(shadows = {ShadowEntityHeaderController.class, ShadowSettingsLibUtils.class}) public class AppInfoWithHeaderTest { @Rule public final MockitoRule mMockitoRule = MockitoJUnit.rule(); @Mock(answer = Answers.RETURNS_DEEP_STUBS) private EntityHeaderController mHeaderController; Loading @@ -71,7 +75,6 @@ public class AppInfoWithHeaderTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); mFactory = FakeFeatureFactory.setupForTest(); when(mFactory.metricsFeatureProvider.getMetricsCategory(any(Object.class))) .thenReturn(MetricsProto.MetricsEvent.SETTINGS_APP_NOTIF_CATEGORY); Loading Loading @@ -120,7 +123,6 @@ public class AppInfoWithHeaderTest { assertThat(mAppInfoWithHeader.mPackageRemovedCalled).isTrue(); } @Ignore("b/315135755") @Test public void noExtraUserHandleInIntent_retrieveAppEntryWithMyUserId() throws PackageManager.NameNotFoundException { Loading @@ -133,10 +135,8 @@ public class AppInfoWithHeaderTest { when(mAppInfoWithHeader.mState.getEntry(packageName, UserHandle.myUserId())).thenReturn(entry); when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(entry.info.packageName, PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.GET_SIGNING_CERTIFICATES | PackageManager.GET_PERMISSIONS, UserHandle.myUserId())).thenReturn( when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(eq(entry.info.packageName), any(), eq(UserHandle.myUserId()))).thenReturn( mAppInfoWithHeader.mPackageInfo); mAppInfoWithHeader.retrieveAppEntry(); Loading @@ -146,7 +146,6 @@ public class AppInfoWithHeaderTest { assertThat(mAppInfoWithHeader.mAppEntry).isNotNull(); } @Ignore("b/315135755") @Test public void extraUserHandleInIntent_retrieveAppEntryWithMyUserId() throws PackageManager.NameNotFoundException { Loading @@ -161,10 +160,8 @@ public class AppInfoWithHeaderTest { entry.info.packageName = packageName; when(mAppInfoWithHeader.mState.getEntry(packageName, USER_ID)).thenReturn(entry); when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(entry.info.packageName, PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.GET_SIGNING_CERTIFICATES | PackageManager.GET_PERMISSIONS, USER_ID)).thenReturn( when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(eq(entry.info.packageName), any(), eq(USER_ID))).thenReturn( mAppInfoWithHeader.mPackageInfo); mAppInfoWithHeader.retrieveAppEntry(); Loading Loading @@ -232,6 +229,8 @@ public class AppInfoWithHeaderTest { } @Override protected Intent getIntent() { return mIntent; } protected Intent getIntent() { return mIntent; } } } Loading
tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java +13 −14 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.settings.applications; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -48,12 +49,13 @@ import com.android.settingslib.widget.LayoutPreference; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; Loading @@ -62,6 +64,8 @@ import org.robolectric.util.ReflectionHelpers; @RunWith(RobolectricTestRunner.class) @Config(shadows = {ShadowEntityHeaderController.class, ShadowSettingsLibUtils.class}) public class AppInfoWithHeaderTest { @Rule public final MockitoRule mMockitoRule = MockitoJUnit.rule(); @Mock(answer = Answers.RETURNS_DEEP_STUBS) private EntityHeaderController mHeaderController; Loading @@ -71,7 +75,6 @@ public class AppInfoWithHeaderTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); mFactory = FakeFeatureFactory.setupForTest(); when(mFactory.metricsFeatureProvider.getMetricsCategory(any(Object.class))) .thenReturn(MetricsProto.MetricsEvent.SETTINGS_APP_NOTIF_CATEGORY); Loading Loading @@ -120,7 +123,6 @@ public class AppInfoWithHeaderTest { assertThat(mAppInfoWithHeader.mPackageRemovedCalled).isTrue(); } @Ignore("b/315135755") @Test public void noExtraUserHandleInIntent_retrieveAppEntryWithMyUserId() throws PackageManager.NameNotFoundException { Loading @@ -133,10 +135,8 @@ public class AppInfoWithHeaderTest { when(mAppInfoWithHeader.mState.getEntry(packageName, UserHandle.myUserId())).thenReturn(entry); when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(entry.info.packageName, PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.GET_SIGNING_CERTIFICATES | PackageManager.GET_PERMISSIONS, UserHandle.myUserId())).thenReturn( when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(eq(entry.info.packageName), any(), eq(UserHandle.myUserId()))).thenReturn( mAppInfoWithHeader.mPackageInfo); mAppInfoWithHeader.retrieveAppEntry(); Loading @@ -146,7 +146,6 @@ public class AppInfoWithHeaderTest { assertThat(mAppInfoWithHeader.mAppEntry).isNotNull(); } @Ignore("b/315135755") @Test public void extraUserHandleInIntent_retrieveAppEntryWithMyUserId() throws PackageManager.NameNotFoundException { Loading @@ -161,10 +160,8 @@ public class AppInfoWithHeaderTest { entry.info.packageName = packageName; when(mAppInfoWithHeader.mState.getEntry(packageName, USER_ID)).thenReturn(entry); when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(entry.info.packageName, PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.GET_SIGNING_CERTIFICATES | PackageManager.GET_PERMISSIONS, USER_ID)).thenReturn( when(mAppInfoWithHeader.mPm.getPackageInfoAsUser(eq(entry.info.packageName), any(), eq(USER_ID))).thenReturn( mAppInfoWithHeader.mPackageInfo); mAppInfoWithHeader.retrieveAppEntry(); Loading Loading @@ -232,6 +229,8 @@ public class AppInfoWithHeaderTest { } @Override protected Intent getIntent() { return mIntent; } protected Intent getIntent() { return mIntent; } } }