Mark only browser as default in app detail page
Change-Id: I8112d859ba788a1dc67c44b5e0de668c0fc13169 Fix: 35307728 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.settings.applications.defaultapps;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.UserManager;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
@@ -35,6 +36,8 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
@@ -85,4 +88,15 @@ public class DefaultBrowserPreferenceControllerTest {
|
||||
|
||||
verify(mPackageManager).getDefaultBrowserPackageNameAsUser(anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isBrowserDefault_onlyApp_shouldReturnTrue() {
|
||||
final String testPkg = "pkg";
|
||||
when(mPackageManager.getDefaultBrowserPackageNameAsUser(anyInt()))
|
||||
.thenReturn(null);
|
||||
when(mPackageManager.queryIntentActivitiesAsUser(any(Intent.class), anyInt(), anyInt()))
|
||||
.thenReturn(Arrays.asList(new ResolveInfo()));
|
||||
|
||||
assertThat(mController.isBrowserDefault(testPkg, 0)).isTrue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user