Merge changes I886a7277,I25d96c82

* changes:
  Move development test package to sdk 26
  Move OemUnlockPreferenceControllerTest to sdk 26
This commit is contained in:
TreeHugger Robot
2017-11-28 22:43:30 +00:00
committed by Android (Google) Code Review
77 changed files with 102 additions and 85 deletions

View File

@@ -98,7 +98,7 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
@Override
public void updateState(Preference preference) {
super.updateState(preference);
mPreference.setChecked(mOemLockManager.isOemUnlockAllowed());
mPreference.setChecked(isOemUnlockedAllowed());
updateOemUnlockSettingDescription();
// Showing mEnableOemUnlock preference as device has persistent data block.
mPreference.setDisabledByAdmin(null);
@@ -183,7 +183,8 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
/**
* Returns {@code true} if the bootloader has been unlocked. Otherwise, returns {code false}.
*/
private boolean isBootloaderUnlocked() {
@VisibleForTesting
boolean isBootloaderUnlocked() {
return mOemLockManager.isDeviceOemUnlocked();
}
@@ -216,4 +217,9 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
userHandle);
}
@VisibleForTesting
boolean isOemUnlockedAllowed() {
return mOemLockManager.isOemUnlockAllowed();
}
}

View File

@@ -46,7 +46,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AbstractBluetoothA2dpPreferenceControllerTest {
@Mock

View File

@@ -41,7 +41,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AdbPreferenceControllerTest {
@Mock

View File

@@ -44,7 +44,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AllowAppsOnExternalPreferenceControllerTest {
@Mock

View File

@@ -44,7 +44,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AnimatorDurationScalePreferenceControllerTest {
@Mock

View File

@@ -43,7 +43,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppsNotRespondingPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BackgroundProcessLimitPreferenceControllerTest {
@Mock

View File

@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothAbsoluteVolumePreferenceControllerTest {

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioBitsPerSamplePreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioChannelModePreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioCodecPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioQualityPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioSampleRatePreferenceControllerTest {
@Mock

View File

@@ -45,7 +45,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothAvrcpVersionPreferenceControllerTest {

View File

@@ -42,7 +42,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothDeviceNoNamePreferenceControllerTest {

View File

@@ -45,7 +45,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothInbandRingingPreferenceControllerTest {

View File

@@ -41,7 +41,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothSnoopLogPreferenceControllerTest {

View File

@@ -51,7 +51,7 @@ import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BugReportInPowerPreferenceControllerTest {
@Mock

View File

@@ -35,7 +35,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BugReportPreferenceControllerTest {
@Mock

View File

@@ -45,7 +45,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,
shadows = {SettingsShadowSystemProperties.class})
public class CameraLaserSensorPreferenceControllerTest {

View File

@@ -54,7 +54,7 @@ import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class, ShadowUtils.class})
public class ClearAdbKeysPreferenceControllerTest {

View File

@@ -43,7 +43,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows =
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows =
SettingsShadowSystemProperties.class)
public class ConnectivityMonitorPreferenceControllerTest {

View File

@@ -45,7 +45,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class CoolColorTemperaturePreferenceControllerTest {

View File

@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class DebugGpuOverdrawPreferenceControllerTest {

View File

@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class DebugNonRectClipOperationsPreferenceControllerTest {

View File

@@ -38,7 +38,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DebugViewAttributesPreferenceControllerTest {
@Mock

View File

@@ -52,7 +52,7 @@ import org.robolectric.util.ReflectionHelpers;
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 DevelopmentSettingsDashboardFragmentTest {
private SwitchBar mSwitchBar;

View File

@@ -31,7 +31,7 @@ import org.robolectric.shadows.ShadowToast;
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DevelopmentSettingsDisabledActivityTest {
@Test

View File

@@ -44,7 +44,7 @@ import org.robolectric.util.ReflectionHelpers;
import java.util.ArrayList;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowUtils.class
})

View File

@@ -38,7 +38,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 DisableAutomaticUpdatesPreferenceControllerTest {
@Mock

View File

@@ -51,7 +51,7 @@ import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class FileEncryptionPreferenceControllerTest {

View File

@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ForceGpuRenderingPreferenceControllerTest {

View File

@@ -40,7 +40,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ForceMSAAPreferenceControllerTest {

View File

@@ -45,7 +45,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FreeformWindowsPreferenceControllerTest {
private static final String ENG_BUILD_TYPE = "eng";

View File

@@ -41,7 +41,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class GpuViewUpdatesPreferenceControllerTest {

View File

@@ -41,7 +41,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class HardwareLayersUpdatesPreferenceControllerTest {

View File

@@ -47,7 +47,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class HardwareOverlaysPreferenceControllerTest {
@Mock

View File

@@ -47,7 +47,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class HdcpCheckingPreferenceControllerTest {

View File

@@ -42,7 +42,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class KeepActivitiesPreferenceControllerTest {
private static final int SETTING_VALUE_ON = 1;

View File

@@ -28,7 +28,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LocalBackupPasswordPreferenceControllerTest {
@Mock

View File

@@ -43,7 +43,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LocalTerminalPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class LogPersistPreferenceControllerTest {

View File

@@ -39,7 +39,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class LogdSizePreferenceControllerTest {

View File

@@ -41,7 +41,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MemoryUsagePreferenceControllerTest {
@Mock

View File

@@ -38,7 +38,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MobileDataAlwaysOnPreferenceControllerTest {
@Mock

View File

@@ -39,7 +39,7 @@ import org.robolectric.util.ReflectionHelpers;
import java.util.Collections;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MockLocationAppPreferenceControllerTest {
@Mock

View File

@@ -41,7 +41,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class NotificationChannelWarningsPreferenceControllerTest {
@Mock

View File

@@ -48,7 +48,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class OemUnlockPreferenceControllerTest {
@Mock
@@ -108,6 +108,7 @@ public class OemUnlockPreferenceControllerTest {
doReturn(false).when(mController).showKeyguardConfirmation(mResources,
REQUEST_CODE_ENABLE_OEM_UNLOCK);
doNothing().when(mController).confirmEnableOemUnlock();
mController.onPreferenceChange(null, true);
verify(mController).confirmEnableOemUnlock();
@@ -115,17 +116,20 @@ public class OemUnlockPreferenceControllerTest {
@Test
public void onPreferenceChanged_turnOffUnlock() {
mController = spy(mController);
mController.onPreferenceChange(null, false);
verify(mOemLockManager).setOemUnlockAllowedByUser(false);
doReturn(false).when(mController).isBootloaderUnlocked();
verify(mFragment).getChildFragmentManager();
}
@Test
public void updateState_preferenceShouldBeCheckedAndShouldBeDisabled() {
mController = spy(mController);
when(mOemLockManager.isOemUnlockAllowed()).thenReturn(true);
doReturn(true).when(mController).isOemUnlockedAllowed();
doReturn(true).when(mController).isOemUnlockAllowedByUserAndCarrier();
when(mOemLockManager.isDeviceOemUnlocked()).thenReturn(true);
doReturn(true).when(mController).isBootloaderUnlocked();
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -135,9 +139,10 @@ public class OemUnlockPreferenceControllerTest {
@Test
public void updateState_preferenceShouldBeUncheckedAndShouldBeDisabled() {
mController = spy(mController);
when(mOemLockManager.isOemUnlockAllowed()).thenReturn(false);
doReturn(false).when(mController).isOemUnlockedAllowed();
doReturn(true).when(mController).isOemUnlockAllowedByUserAndCarrier();
when(mOemLockManager.isDeviceOemUnlocked()).thenReturn(true);
doReturn(true).when(mController).isBootloaderUnlocked();
mController.updateState(mPreference);
verify(mPreference).setChecked(false);
@@ -147,9 +152,10 @@ public class OemUnlockPreferenceControllerTest {
@Test
public void updateState_preferenceShouldBeCheckedAndShouldBeEnabled() {
mController = spy(mController);
when(mOemLockManager.isOemUnlockAllowed()).thenReturn(true);
doReturn(true).when(mController).isOemUnlockedAllowed();
doReturn(true).when(mController).isOemUnlockAllowedByUserAndCarrier();
when(mOemLockManager.isDeviceOemUnlocked()).thenReturn(false);
doReturn(false).when(mController).isBootloaderUnlocked();
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -176,7 +182,9 @@ public class OemUnlockPreferenceControllerTest {
public void onDeveloperOptionsEnabled_preferenceShouldCheckRestriction() {
mController = spy(mController);
doReturn(false).when(mController).isOemUnlockAllowedByUserAndCarrier();
doReturn(false).when(mController).isBootloaderUnlocked();
when(mPreference.isEnabled()).thenReturn(true);
mController.onDeveloperOptionsEnabled();
verify(mPreference).checkRestrictionAndSetDisabled(UserManager.DISALLOW_FACTORY_RESET);
@@ -186,8 +194,11 @@ public class OemUnlockPreferenceControllerTest {
@Test
public void onDeveloperOptionsDisabled_preferenceShouldCheckRestriction() {
mController = spy(mController);
doReturn(true).when(mController).isOemUnlockedAllowed();
doReturn(false).when(mController).isOemUnlockAllowedByUserAndCarrier();
doReturn(false).when(mController).isBootloaderUnlocked();
when(mPreference.isEnabled()).thenReturn(true);
mController.onDeveloperOptionsDisabled();
verify(mPreference).checkRestrictionAndSetDisabled(UserManager.DISALLOW_FACTORY_RESET);

View File

@@ -43,7 +43,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PictureColorModePreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PointerLocationPreferenceControllerTest {
@Mock

View File

@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ProfileGpuRenderingPreferenceControllerTest {

View File

@@ -39,7 +39,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ResizableActivityPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RtlLayoutPreferenceControllerTest {
@Mock

View File

@@ -39,7 +39,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SecondaryDisplayPreferenceControllerTest {
@Mock

View File

@@ -48,7 +48,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SelectDebugAppPreferenceControllerTest {
@Mock

View File

@@ -57,7 +57,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUtils.class})
public class SelectUsbConfigPreferenceControllerTest {

View File

@@ -43,7 +43,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class SetGpuRendererPreferenceControllerTest {

View File

@@ -40,7 +40,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShortcutManagerThrottlingPreferenceControllerTest {
@Mock

View File

@@ -41,7 +41,7 @@ import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ShowLayoutBoundsPreferenceControllerTest {

View File

@@ -47,7 +47,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShowSurfaceUpdatesPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShowTapsPreferenceControllerTest {
@Mock

View File

@@ -46,7 +46,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SimulateColorSpacePreferenceControllerTest {
@Mock

View File

@@ -45,7 +45,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class StayAwakePreferenceControllerTest {
@Mock

View File

@@ -45,7 +45,7 @@ import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class StrictModePreferenceControllerTest {

View File

@@ -38,7 +38,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TetheringHardwareAccelPreferenceControllerTest {
@Mock

View File

@@ -44,7 +44,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TransitionAnimationScalePreferenceControllerTest {
@Mock

View File

@@ -38,7 +38,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UsbAudioRoutingPreferenceControllerTest {
@Mock

View File

@@ -51,7 +51,7 @@ import java.util.Collections;
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 VerifyAppsOverUsbPreferenceControllerTest {
@Mock

View File

@@ -50,7 +50,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WaitForDebuggerPreferenceControllerTest {
@Mock

View File

@@ -42,7 +42,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WebViewAppPreferenceControllerTest {
@Mock

View File

@@ -40,7 +40,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiAggressiveHandoverPreferenceControllerTest {
@Mock

View File

@@ -38,7 +38,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiDisplayCertificationPreferenceControllerTest {
@Mock

View File

@@ -35,7 +35,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiRoamScansPreferenceControllerTest {
@Mock

View File

@@ -35,7 +35,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiVerboseLoggingPreferenceControllerTest {
@Mock
private Context mContext;

View File

@@ -44,7 +44,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WindowAnimationScalePreferenceControllerTest {
@Mock

View File

@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FeatureFlagsDashboardTest {
private FeatureFlagsDashboard mDashboard;

View File

@@ -45,7 +45,7 @@ import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowPackageManager;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DevelopmentTilePreferenceControllerTest {
@Mock