Update IntentSearchViewHolderTest to sdk 26
Test: make RunSettingsRoboTests -j40 Change-Id: I579be569a9a56175e45abc329b61cb1b9daf3ac7
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
package com.android.settings.search;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
@@ -32,8 +34,10 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
@@ -58,7 +62,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public class IntentSearchViewHolderTest {
|
||||
|
||||
private static final String TITLE = "title";
|
||||
@@ -72,6 +76,8 @@ public class IntentSearchViewHolderTest {
|
||||
private SearchFragment mFragment;
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
@Mock
|
||||
private UserManager mUserManager;
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
private IntentSearchViewHolder mHolder;
|
||||
private Drawable mIcon;
|
||||
@@ -189,6 +195,9 @@ public class IntentSearchViewHolderTest {
|
||||
|
||||
@Test
|
||||
public void testBindViewElements_appSearchResult() {
|
||||
mHolder = spy(mHolder);
|
||||
doReturn(new ColorDrawable(0)).when(mHolder).getBadgedIcon(any(ApplicationInfo.class),
|
||||
anyInt());
|
||||
when(mPackageManager.getUserBadgedLabel(any(CharSequence.class),
|
||||
eq(new UserHandle(USER_ID)))).thenReturn(BADGED_LABEL);
|
||||
|
||||
|
Reference in New Issue
Block a user