Merge changes I6b4c5d1d,I1b81bbdf
* changes: Move enterprise test package to sdk 26 Update ApplicationListPreferenceCtrlTest to sdk 26
This commit is contained in:
committed by
Android (Google) Code Review
commit
08ff0e8f53
@@ -31,7 +31,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
* Tests for {@link AdminActionPreferenceControllerBase}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AdminActionPreferenceControllerBaseTest extends
|
||||
AdminActionPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link AdminGrantedCameraPermissionPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AdminGrantedCameraPermissionPreferenceControllerTest extends
|
||||
AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link AdminGrantedLocationPermissionsPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AdminGrantedLocationPermissionsPreferenceControllerTest extends
|
||||
AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link AdminGrantedMicrophonePermissionPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AdminGrantedMicrophonePermissionPreferenceControllerTest extends
|
||||
AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -26,7 +26,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link AdminGrantedPermissionsPreferenceControllerBase}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AdminGrantedPermissionsPreferenceControllerBaseTest extends
|
||||
AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -39,7 +39,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link AlwaysOnVpnCurrentUserPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AlwaysOnVpnCurrentUserPreferenceControllerTest {
|
||||
|
||||
private static final String VPN_SET_DEVICE = "VPN set";
|
||||
|
@@ -38,7 +38,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link AlwaysOnVpnManagedProfilePreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class AlwaysOnVpnManagedProfilePreferenceControllerTest {
|
||||
|
||||
private static final String KEY_ALWAYS_ON_VPN_MANAGED_PROFILE = "always_on_vpn_managed_profile";
|
||||
|
@@ -46,7 +46,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public class ApplicationListFragmentTest {
|
||||
private static final int USER_ID = 0;
|
||||
private static final int USER_APP_UID = 0;
|
||||
|
@@ -17,11 +17,15 @@
|
||||
package com.android.settings.enterprise;
|
||||
|
||||
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -29,6 +33,7 @@ import static org.mockito.Mockito.when;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.UserManager;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
@@ -54,7 +59,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public class ApplicationListPreferenceControllerTest {
|
||||
|
||||
private static final int MAIN_USER_ID = 0;
|
||||
@@ -74,6 +79,8 @@ public class ApplicationListPreferenceControllerTest {
|
||||
private PackageManager mPackageManager;
|
||||
@Mock(answer = RETURNS_DEEP_STUBS)
|
||||
private SettingsPreferenceFragment mFragment;
|
||||
@Mock
|
||||
private UserManager mUserManager;
|
||||
|
||||
private Context mContext;
|
||||
private ApplicationListPreferenceController mController;
|
||||
@@ -82,7 +89,8 @@ public class ApplicationListPreferenceControllerTest {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
final ShadowApplication shadowContext = ShadowApplication.getInstance();
|
||||
mContext = shadowContext.getApplicationContext();
|
||||
mContext = spy(shadowContext.getApplicationContext());
|
||||
doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);
|
||||
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
|
||||
when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext);
|
||||
when(mPackageManager.getText(eq(APP_1), anyInt(), any())).thenReturn(APP_1);
|
||||
|
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
* Tests for {@link BugReportsPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class BugReportsPreferenceControllerTest extends
|
||||
AdminActionPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -35,7 +35,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link CaCertsCurrentUserPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class CaCertsCurrentUserPreferenceControllerTest extends
|
||||
CaCertsPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link CaCertsManagedProfilePreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class CaCertsManagedProfilePreferenceControllerTest extends
|
||||
CaCertsPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link CaCertsPreferenceControllerBase}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public class CaCertsPreferenceControllerBaseTest extends CaCertsPreferenceControllerTestBase {
|
||||
private static final String PREF_KEY = "pref";
|
||||
|
||||
|
@@ -45,7 +45,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link EnterpriseInstalledPackagesPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class EnterpriseInstalledPackagesPreferenceControllerTest {
|
||||
|
||||
private static final String KEY_NUMBER_ENTERPRISE_INSTALLED_PACKAGES
|
||||
|
@@ -57,7 +57,7 @@ import static org.mockito.Mockito.when;
|
||||
* Tests for {@link EnterprisePrivacyFeatureProviderImpl}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class EnterprisePrivacyFeatureProviderImplTest {
|
||||
|
||||
private final ComponentName OWNER = new ComponentName("dummy", "component");
|
||||
|
@@ -39,7 +39,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link EnterprisePrivacyPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class EnterprisePrivacyPreferenceControllerTest {
|
||||
|
||||
private static final String MANAGED_GENERIC = "managed by organization";
|
||||
|
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
* Tests for {@link EnterprisePrivacySettings}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class EnterprisePrivacySettingsTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
|
@@ -42,7 +42,7 @@ import org.robolectric.shadows.ShadowApplication;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public class EnterpriseSetDefaultAppsListFragmentTest {
|
||||
@Mock(answer = RETURNS_DEEP_STUBS)
|
||||
private PreferenceScreen mScreen;
|
||||
|
@@ -59,7 +59,7 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public class EnterpriseSetDefaultAppsListPreferenceControllerTest {
|
||||
private static final int USER_ID = 0;
|
||||
private static final int APP_UID = 0;
|
||||
|
@@ -52,7 +52,7 @@ import java.util.List;
|
||||
* Tests for {@link EnterpriseSetDefaultAppsPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class EnterpriseSetDefaultAppsPreferenceControllerTest {
|
||||
|
||||
private static final String KEY_DEFAULT_APPS = "number_enterprise_set_default_apps";
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link FailedPasswordWipeCurrentUserPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class FailedPasswordWipeCurrentUserPreferenceControllerTest extends
|
||||
FailedPasswordWipePreferenceControllerTestBase {
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link FailedPasswordWipeManagedProfilePreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class FailedPasswordWipeManagedProfilePreferenceControllerTest extends
|
||||
FailedPasswordWipePreferenceControllerTestBase {
|
||||
|
||||
|
@@ -26,7 +26,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link FailedPasswordWipePreferenceControllerBase}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class FailedPasswordWipePreferenceControllerBaseTest extends
|
||||
FailedPasswordWipePreferenceControllerTestBase {
|
||||
|
||||
|
@@ -38,7 +38,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link GlobalHttpProxyPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class GlobalHttpProxyPreferenceControllerTest {
|
||||
|
||||
private static final String KEY_GLOBAL_HTTP_PROXY = "global_http_proxy";
|
||||
|
@@ -39,7 +39,7 @@ import org.robolectric.annotation.Config;
|
||||
* Tests for {@link ImePreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class ImePreferenceControllerTest {
|
||||
|
||||
private static final String DEFAULT_IME_LABEL = "Test IME";
|
||||
|
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.when;
|
||||
* Tests for {@link ManageDeviceAdminPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class ManageDeviceAdminPreferenceControllerTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
|
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
* Tests for {@link NetworkLogsPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class NetworkLogsPreferenceControllerTest extends
|
||||
AdminActionPreferenceControllerTestBase {
|
||||
|
||||
|
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
* Tests for {@link SecurityLogsPreferenceController}.
|
||||
*/
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
|
||||
public final class SecurityLogsPreferenceControllerTest extends
|
||||
AdminActionPreferenceControllerTestBase {
|
||||
|
||||
|
Reference in New Issue
Block a user