Move the Robolectric shadow config up.
In my testing, this reduces the runtime of the Robolectric Settings test suite on my Z840 workstation from 440 seconds to 402 seconds on average. By avoiding having a method-level Robolectric shadow import, we avoid going down a code path which needs to add more shadows later in the Robolectric execution. Bug: 64808827 Test: Settings robotests still pass Change-Id: I7b40d73b30306ae3f9759281afbd7f7266579e24
This commit is contained in:
@@ -45,7 +45,11 @@ import org.robolectric.annotation.Config;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = ShadowUtils.class
|
||||||
|
)
|
||||||
public class DeviceInfoSettingsTest {
|
public class DeviceInfoSettingsTest {
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
@@ -83,7 +87,6 @@ public class DeviceInfoSettingsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowUtils.class)
|
|
||||||
public void testNonIndexableKeys_existInXmlLayout() {
|
public void testNonIndexableKeys_existInXmlLayout() {
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
final List<String> niks = DeviceInfoSettings.SEARCH_INDEX_DATA_PROVIDER
|
final List<String> niks = DeviceInfoSettings.SEARCH_INDEX_DATA_PROVIDER
|
||||||
|
@@ -33,7 +33,6 @@ import android.os.Bundle;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
|
||||||
@@ -46,12 +45,15 @@ import org.junit.runner.RunWith;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
import org.robolectric.RuntimeEnvironment;
|
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
import org.robolectric.shadows.ShadowActivity;
|
import org.robolectric.shadows.ShadowActivity;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {ShadowUtils.class}
|
||||||
|
)
|
||||||
public class MasterClearTest {
|
public class MasterClearTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@@ -144,7 +146,6 @@ public class MasterClearTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = { ShadowUtils.class })
|
|
||||||
public void testInitiateMasterClear_inDemoMode_sendsIntent() {
|
public void testInitiateMasterClear_inDemoMode_sendsIntent() {
|
||||||
ShadowUtils.setIsDemoUser(true);
|
ShadowUtils.setIsDemoUser(true);
|
||||||
|
|
||||||
|
@@ -60,7 +60,11 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {ShadowLockPatternUtils.class}
|
||||||
|
)
|
||||||
public class SecuritySettingsTest {
|
public class SecuritySettingsTest {
|
||||||
|
|
||||||
private static final String MOCK_SUMMARY = "summary";
|
private static final String MOCK_SUMMARY = "summary";
|
||||||
@@ -181,9 +185,6 @@ public class SecuritySettingsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config (shadows = {
|
|
||||||
ShadowLockPatternUtils.class,
|
|
||||||
})
|
|
||||||
public void testNonIndexableKeys_existInXmlLayout() {
|
public void testNonIndexableKeys_existInXmlLayout() {
|
||||||
final Context context = spy(RuntimeEnvironment.application);
|
final Context context = spy(RuntimeEnvironment.application);
|
||||||
UserManager manager = mock(UserManager.class);
|
UserManager manager = mock(UserManager.class);
|
||||||
|
@@ -50,7 +50,11 @@ import org.robolectric.annotation.Implements;
|
|||||||
|
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = AccountHeaderPreferenceControllerTest.ShadowAuthenticatorHelper.class
|
||||||
|
)
|
||||||
public class AccountHeaderPreferenceControllerTest {
|
public class AccountHeaderPreferenceControllerTest {
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
@@ -83,7 +87,6 @@ public class AccountHeaderPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowAuthenticatorHelper.class)
|
|
||||||
public void onResume_shouldDisplayAccountInEntityHeader() {
|
public void onResume_shouldDisplayAccountInEntityHeader() {
|
||||||
final Lifecycle lifecycle = new Lifecycle();
|
final Lifecycle lifecycle = new Lifecycle();
|
||||||
final Account account = new Account("name1@abc.com", "com.abc");
|
final Account account = new Account("name1@abc.com", "com.abc");
|
||||||
|
@@ -111,7 +111,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_linkedUser_shouldAddOneAccountCategory() {
|
public void onResume_linkedUser_shouldAddOneAccountCategory() {
|
||||||
final UserInfo info = new UserInfo(1, "user 1", 0);
|
final UserInfo info = new UserInfo(1, "user 1", 0);
|
||||||
when(mUserManager.isManagedProfile()).thenReturn(false);
|
when(mUserManager.isManagedProfile()).thenReturn(false);
|
||||||
@@ -124,7 +123,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_oneProfile_shouldAddOneAccountCategory() {
|
public void onResume_oneProfile_shouldAddOneAccountCategory() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -138,7 +136,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_twoProfiles_shouldAddTwoAccountCategory() {
|
public void onResume_twoProfiles_shouldAddTwoAccountCategory() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -153,7 +150,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_noProfileChange_shouldNotAddOrRemoveAccountCategory() {
|
public void onResume_noProfileChange_shouldNotAddOrRemoveAccountCategory() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -171,7 +167,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_oneNewProfile_shouldAddOneAccountCategory() {
|
public void onResume_oneNewProfile_shouldAddOneAccountCategory() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -189,7 +184,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_oneProfileRemoved_shouldRemoveOneAccountCategory() {
|
public void onResume_oneProfileRemoved_shouldRemoveOneAccountCategory() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -207,7 +201,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_oneProfile_shouldSetAccountTitleWithUserName() {
|
public void onResume_oneProfile_shouldSetAccountTitleWithUserName() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", UserInfo.FLAG_MANAGED_PROFILE));
|
infos.add(new UserInfo(1, "user 1", UserInfo.FLAG_MANAGED_PROFILE));
|
||||||
@@ -226,7 +219,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_noPreferenceScreen_shouldNotCrash() {
|
public void onResume_noPreferenceScreen_shouldNotCrash() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -244,7 +236,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_noPreferenceManager_shouldNotCrash() {
|
public void onResume_noPreferenceManager_shouldNotCrash() {
|
||||||
when(mFragment.getPreferenceManager()).thenReturn(null);
|
when(mFragment.getPreferenceManager()).thenReturn(null);
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
@@ -337,7 +328,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_twoAccountsOfSameType_shouldAddThreePreferences() {
|
public void onResume_twoAccountsOfSameType_shouldAddThreePreferences() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -417,7 +407,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_noAccountChange_shouldNotAddAccountPreference() {
|
public void onResume_noAccountChange_shouldNotAddAccountPreference() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -498,7 +487,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_oneNewAccountType_shouldAddOneAccountPreference() {
|
public void onResume_oneNewAccountType_shouldAddOneAccountPreference() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
@@ -534,7 +522,6 @@ public class AccountPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
|
|
||||||
public void onResume_oneAccountRemoved_shouldRemoveOneAccountPreference() {
|
public void onResume_oneAccountRemoved_shouldRemoveOneAccountPreference() {
|
||||||
final List<UserInfo> infos = new ArrayList<>();
|
final List<UserInfo> infos = new ArrayList<>();
|
||||||
infos.add(new UserInfo(1, "user 1", 0));
|
infos.add(new UserInfo(1, "user 1", 0));
|
||||||
|
@@ -83,7 +83,11 @@ import static org.mockito.Mockito.when;
|
|||||||
|
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = InstalledAppDetailsTest.ShadowUtils.class
|
||||||
|
)
|
||||||
public final class InstalledAppDetailsTest {
|
public final class InstalledAppDetailsTest {
|
||||||
|
|
||||||
private static final String PACKAGE_NAME = "test_package_name";
|
private static final String PACKAGE_NAME = "test_package_name";
|
||||||
@@ -491,7 +495,6 @@ public final class InstalledAppDetailsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowUtils.class)
|
|
||||||
public void handleDisableable_appIsEnabled_buttonShouldWork() {
|
public void handleDisableable_appIsEnabled_buttonShouldWork() {
|
||||||
final ApplicationInfo info = new ApplicationInfo();
|
final ApplicationInfo info = new ApplicationInfo();
|
||||||
info.packageName = "pkg";
|
info.packageName = "pkg";
|
||||||
@@ -513,7 +516,6 @@ public final class InstalledAppDetailsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowUtils.class)
|
|
||||||
public void handleDisableable_appIsEnabledAndInKeepEnabledWhitelist_buttonShouldNotWork() {
|
public void handleDisableable_appIsEnabledAndInKeepEnabledWhitelist_buttonShouldNotWork() {
|
||||||
final ApplicationInfo info = new ApplicationInfo();
|
final ApplicationInfo info = new ApplicationInfo();
|
||||||
info.packageName = "pkg";
|
info.packageName = "pkg";
|
||||||
|
@@ -69,9 +69,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH,
|
@Config(
|
||||||
sdk = TestConfig.SDK_VERSION,
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
shadows = ShadowSecureSettings.class)
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {ShadowSecureSettings.class, SettingsShadowResources.class}
|
||||||
|
)
|
||||||
public class SuggestionFeatureProviderImplTest {
|
public class SuggestionFeatureProviderImplTest {
|
||||||
|
|
||||||
private static final String DOUBLE_TWIST_SENSOR_NAME = "double_twist_sensor_name";
|
private static final String DOUBLE_TWIST_SENSOR_NAME = "double_twist_sensor_name";
|
||||||
@@ -115,7 +117,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_doubleTapPower_trueWhenNotAvailable() {
|
public void isSuggestionCompleted_doubleTapPower_trueWhenNotAvailable() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, false);
|
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, false);
|
||||||
@@ -126,7 +127,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_doubleTapPower_falseWhenNotVisited() {
|
public void isSuggestionCompleted_doubleTapPower_falseWhenNotVisited() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true);
|
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true);
|
||||||
@@ -138,7 +138,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_doubleTapPower_trueWhenVisited() {
|
public void isSuggestionCompleted_doubleTapPower_trueWhenVisited() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true);
|
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true);
|
||||||
@@ -151,7 +150,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_doubleTwist_trueWhenNotAvailable() {
|
public void isSuggestionCompleted_doubleTwist_trueWhenNotAvailable() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
R.string.gesture_double_twist_sensor_name, "nonexistant name");
|
R.string.gesture_double_twist_sensor_name, "nonexistant name");
|
||||||
@@ -164,7 +162,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_ambientDisplay_falseWhenNotVisited() {
|
public void isSuggestionCompleted_ambientDisplay_falseWhenNotVisited() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.string.config_dozeComponent, "foo");
|
com.android.internal.R.string.config_dozeComponent, "foo");
|
||||||
@@ -178,7 +175,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_ambientDisplay_trueWhenVisited() {
|
public void isSuggestionCompleted_ambientDisplay_trueWhenVisited() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.string.config_dozeComponent, "foo");
|
com.android.internal.R.string.config_dozeComponent, "foo");
|
||||||
@@ -193,7 +189,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_ambientDisplayPickup_falseWhenNotVisited() {
|
public void isSuggestionCompleted_ambientDisplayPickup_falseWhenNotVisited() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.string.config_dozeComponent, "foo");
|
com.android.internal.R.string.config_dozeComponent, "foo");
|
||||||
@@ -207,7 +202,6 @@ public class SuggestionFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = SettingsShadowResources.class)
|
|
||||||
public void isSuggestionCompleted_ambientDisplayPickup_trueWhenVisited() {
|
public void isSuggestionCompleted_ambientDisplayPickup_trueWhenVisited() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(
|
||||||
com.android.internal.R.string.config_dozeComponent, "foo");
|
com.android.internal.R.string.config_dozeComponent, "foo");
|
||||||
|
@@ -52,7 +52,11 @@ import org.robolectric.annotation.Config;
|
|||||||
|
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {SettingsShadowSystemProperties.class}
|
||||||
|
)
|
||||||
public class AutomaticStorageManagementSwitchPreferenceControllerTest {
|
public class AutomaticStorageManagementSwitchPreferenceControllerTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@@ -86,7 +90,6 @@ public class AutomaticStorageManagementSwitchPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {SettingsShadowSystemProperties.class})
|
|
||||||
public void isAvailable_shouldAlwaysReturnFalse_forLowRamDevice() {
|
public void isAvailable_shouldAlwaysReturnFalse_forLowRamDevice() {
|
||||||
SettingsShadowSystemProperties.set("ro.config.low_ram", "true");
|
SettingsShadowSystemProperties.set("ro.config.low_ram", "true");
|
||||||
assertThat(mController.isAvailable()).isFalse();
|
assertThat(mController.isAvailable()).isFalse();
|
||||||
@@ -160,7 +163,6 @@ public class AutomaticStorageManagementSwitchPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Config(shadows = {SettingsShadowSystemProperties.class})
|
|
||||||
@Test
|
@Test
|
||||||
public void togglingOnShouldNotTriggerWarningFragmentIfEnabledByDefault() {
|
public void togglingOnShouldNotTriggerWarningFragmentIfEnabledByDefault() {
|
||||||
FragmentTransaction transaction = mock(FragmentTransaction.class);
|
FragmentTransaction transaction = mock(FragmentTransaction.class);
|
||||||
@@ -174,7 +176,6 @@ public class AutomaticStorageManagementSwitchPreferenceControllerTest {
|
|||||||
verify(transaction, never()).add(any(), eq(ActivationWarningFragment.TAG));
|
verify(transaction, never()).add(any(), eq(ActivationWarningFragment.TAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Config(shadows = {SettingsShadowSystemProperties.class})
|
|
||||||
@Test
|
@Test
|
||||||
public void togglingOnShouldTriggerWarningFragmentIfEnabledByDefaultAndDisabledByPolicy() {
|
public void togglingOnShouldTriggerWarningFragmentIfEnabledByDefaultAndDisabledByPolicy() {
|
||||||
FragmentTransaction transaction = mock(FragmentTransaction.class);
|
FragmentTransaction transaction = mock(FragmentTransaction.class);
|
||||||
|
@@ -45,7 +45,11 @@ import static org.mockito.Matchers.anyString;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = ShadowSystemSettings.class
|
||||||
|
)
|
||||||
public class AutoRotatePreferenceControllerTest {
|
public class AutoRotatePreferenceControllerTest {
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
@@ -88,7 +92,6 @@ public class AutoRotatePreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowSystemSettings.class)
|
|
||||||
public void updatePreference_settingsIsOff_shouldTurnOffToggle() {
|
public void updatePreference_settingsIsOff_shouldTurnOffToggle() {
|
||||||
Settings.System.putIntForUser(mContentResolver,
|
Settings.System.putIntForUser(mContentResolver,
|
||||||
Settings.System.ACCELEROMETER_ROTATION, 0, UserHandle.USER_CURRENT);
|
Settings.System.ACCELEROMETER_ROTATION, 0, UserHandle.USER_CURRENT);
|
||||||
@@ -99,7 +102,6 @@ public class AutoRotatePreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowSystemSettings.class)
|
|
||||||
public void updatePreference_settingsIsOn_shouldTurnOnToggle() {
|
public void updatePreference_settingsIsOn_shouldTurnOnToggle() {
|
||||||
Settings.System.putIntForUser(mContentResolver,
|
Settings.System.putIntForUser(mContentResolver,
|
||||||
Settings.System.ACCELEROMETER_ROTATION, 1, UserHandle.USER_CURRENT);
|
Settings.System.ACCELEROMETER_ROTATION, 1, UserHandle.USER_CURRENT);
|
||||||
|
@@ -43,7 +43,11 @@ import org.robolectric.RuntimeEnvironment;
|
|||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = ShadowSecureSettings.class
|
||||||
|
)
|
||||||
public class AssistGestureSettingsPreferenceControllerTest {
|
public class AssistGestureSettingsPreferenceControllerTest {
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
@@ -86,7 +90,6 @@ public class AssistGestureSettingsPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowSecureSettings.class)
|
|
||||||
public void testSetValue_updatesCorrectly() {
|
public void testSetValue_updatesCorrectly() {
|
||||||
int newValue = 1;
|
int newValue = 1;
|
||||||
ContentResolver resolver = mContext.getContentResolver();
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
@@ -99,7 +102,6 @@ public class AssistGestureSettingsPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowSecureSettings.class)
|
|
||||||
public void testGetValue_correctValueReturned() {
|
public void testGetValue_correctValueReturned() {
|
||||||
int currentValue = 1;
|
int currentValue = 1;
|
||||||
ContentResolver resolver = mContext.getContentResolver();
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
|
@@ -47,7 +47,11 @@ import static org.mockito.Mockito.verify;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = ShadowRestrictedLockUtilsWrapper.class
|
||||||
|
)
|
||||||
public class MobileNetworkPreferenceControllerTest {
|
public class MobileNetworkPreferenceControllerTest {
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
@@ -88,7 +92,6 @@ public class MobileNetworkPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowRestrictedLockUtilsWrapper.class)
|
|
||||||
public void wifiOnly_prefIsNotAvailable() {
|
public void wifiOnly_prefIsNotAvailable() {
|
||||||
when(mUserManager.isAdminUser()).thenReturn(true);
|
when(mUserManager.isAdminUser()).thenReturn(true);
|
||||||
when(mUserManager.hasUserRestriction(anyString(), any(UserHandle.class)))
|
when(mUserManager.hasUserRestriction(anyString(), any(UserHandle.class)))
|
||||||
|
@@ -79,8 +79,15 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
|
@Config(
|
||||||
shadows = {ShadowRunnableAsyncTask.class})
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {
|
||||||
|
ShadowRunnableAsyncTask.class,
|
||||||
|
ShadowDatabaseIndexingUtils.class,
|
||||||
|
ShadowContentResolver.class
|
||||||
|
}
|
||||||
|
)
|
||||||
public class DatabaseIndexingManagerTest {
|
public class DatabaseIndexingManagerTest {
|
||||||
private final String localeStr = "en_US";
|
private final String localeStr = "en_US";
|
||||||
|
|
||||||
@@ -747,7 +754,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
// Test new public indexing flow
|
// Test new public indexing flow
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowDatabaseIndexingUtils.class})
|
|
||||||
public void testPerformIndexing_fullIndex_getsDataFromProviders() {
|
public void testPerformIndexing_fullIndex_getsDataFromProviders() {
|
||||||
DummyProvider provider = new DummyProvider();
|
DummyProvider provider = new DummyProvider();
|
||||||
provider.onCreate();
|
provider.onCreate();
|
||||||
@@ -767,7 +773,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
|
|
||||||
public void testPerformIndexing_incrementalIndex_noDataAdded() {
|
public void testPerformIndexing_incrementalIndex_noDataAdded() {
|
||||||
final List<ResolveInfo> providerInfo = getDummyResolveInfo();
|
final List<ResolveInfo> providerInfo = getDummyResolveInfo();
|
||||||
skipFullIndex(providerInfo);
|
skipFullIndex(providerInfo);
|
||||||
@@ -792,7 +797,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
|
|
||||||
public void testPerformIndexing_localeChanged_databaseDropped() {
|
public void testPerformIndexing_localeChanged_databaseDropped() {
|
||||||
DummyProvider provider = new DummyProvider();
|
DummyProvider provider = new DummyProvider();
|
||||||
provider.onCreate();
|
provider.onCreate();
|
||||||
@@ -830,7 +834,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
|
|
||||||
public void testPerformIndexing_onOta_FullIndex() {
|
public void testPerformIndexing_onOta_FullIndex() {
|
||||||
DummyProvider provider = new DummyProvider();
|
DummyProvider provider = new DummyProvider();
|
||||||
provider.onCreate();
|
provider.onCreate();
|
||||||
@@ -851,7 +854,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
|
|
||||||
public void testPerformIndexing_onPackageChange_shouldFullIndex() {
|
public void testPerformIndexing_onPackageChange_shouldFullIndex() {
|
||||||
final List<ResolveInfo> providers = getDummyResolveInfo();
|
final List<ResolveInfo> providers = getDummyResolveInfo();
|
||||||
final String buildNumber = Build.FINGERPRINT;
|
final String buildNumber = Build.FINGERPRINT;
|
||||||
@@ -873,7 +875,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
|
|
||||||
public void testPerformIndexing_onOta_buildNumberIsCached() {
|
public void testPerformIndexing_onOta_buildNumberIsCached() {
|
||||||
DummyProvider provider = new DummyProvider();
|
DummyProvider provider = new DummyProvider();
|
||||||
provider.onCreate();
|
provider.onCreate();
|
||||||
@@ -1017,7 +1018,6 @@ public class DatabaseIndexingManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowContentResolver.class})
|
|
||||||
public void testEmptyNonIndexableKeys_emptyDataKeyResources_addedToDatabase() {
|
public void testEmptyNonIndexableKeys_emptyDataKeyResources_addedToDatabase() {
|
||||||
insertSpecialCase(TITLE_ONE, true /* enabled */, null /* dataReferenceKey */);
|
insertSpecialCase(TITLE_ONE, true /* enabled */, null /* dataReferenceKey */);
|
||||||
|
|
||||||
|
@@ -34,11 +34,14 @@ import static org.mockito.Mockito.spy;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = ShadowEventLogWriter.class
|
||||||
|
)
|
||||||
public class ConfigureKeyGuardDialogTest {
|
public class ConfigureKeyGuardDialogTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = ShadowEventLogWriter.class)
|
|
||||||
public void displayDialog_clickPositiveButton_launchSetNewPassword() {
|
public void displayDialog_clickPositiveButton_launchSetNewPassword() {
|
||||||
final FragmentController<ConfigureKeyGuardDialog> fragmentController =
|
final FragmentController<ConfigureKeyGuardDialog> fragmentController =
|
||||||
Robolectric.buildFragment(ConfigureKeyGuardDialog.class);
|
Robolectric.buildFragment(ConfigureKeyGuardDialog.class);
|
||||||
|
@@ -37,7 +37,11 @@ import org.mockito.MockitoAnnotations;
|
|||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {ShadowSecureSettings.class, ShadowUtils.class}
|
||||||
|
)
|
||||||
public class FactoryResetPreferenceControllerTest {
|
public class FactoryResetPreferenceControllerTest {
|
||||||
|
|
||||||
private static final String FACTORY_RESET_KEY = "factory_reset";
|
private static final String FACTORY_RESET_KEY = "factory_reset";
|
||||||
@@ -72,7 +76,6 @@ public class FactoryResetPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = { ShadowSecureSettings.class, ShadowUtils.class })
|
|
||||||
public void isAvailable_nonSystemUser() {
|
public void isAvailable_nonSystemUser() {
|
||||||
when(mUserManager.isAdminUser()).thenReturn(false);
|
when(mUserManager.isAdminUser()).thenReturn(false);
|
||||||
ShadowUtils.setIsDemoUser(false);
|
ShadowUtils.setIsDemoUser(false);
|
||||||
@@ -81,7 +84,6 @@ public class FactoryResetPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = { ShadowSecureSettings.class, ShadowUtils.class })
|
|
||||||
public void isAvailable_demoUser() {
|
public void isAvailable_demoUser() {
|
||||||
when(mUserManager.isAdminUser()).thenReturn(false);
|
when(mUserManager.isAdminUser()).thenReturn(false);
|
||||||
ShadowUtils.setIsDemoUser(true);
|
ShadowUtils.setIsDemoUser(true);
|
||||||
|
@@ -34,7 +34,11 @@ import org.robolectric.shadows.ShadowApplication;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(
|
||||||
|
manifest = TestConfig.MANIFEST_PATH,
|
||||||
|
sdk = TestConfig.SDK_VERSION,
|
||||||
|
shadows = {ShadowTextUtils.class}
|
||||||
|
)
|
||||||
public class RtlCompatibleViewPagerTest {
|
public class RtlCompatibleViewPagerTest {
|
||||||
|
|
||||||
private Locale mLocaleEn;
|
private Locale mLocaleEn;
|
||||||
@@ -51,7 +55,6 @@ public class RtlCompatibleViewPagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(shadows = {ShadowTextUtils.class})
|
|
||||||
public void testGetCurrentItem_shouldMaintainIndexDuringLocaleChange() {
|
public void testGetCurrentItem_shouldMaintainIndexDuringLocaleChange() {
|
||||||
testRtlCompatibleInner(0);
|
testRtlCompatibleInner(0);
|
||||||
testRtlCompatibleInner(1);
|
testRtlCompatibleInner(1);
|
||||||
|
Reference in New Issue
Block a user