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:
Daniel Nishi
2017-08-17 14:34:05 -07:00
parent 682ff5562c
commit 739b0eef10
15 changed files with 74 additions and 67 deletions

View File

@@ -111,7 +111,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_linkedUser_shouldAddOneAccountCategory() {
final UserInfo info = new UserInfo(1, "user 1", 0);
when(mUserManager.isManagedProfile()).thenReturn(false);
@@ -124,7 +123,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_oneProfile_shouldAddOneAccountCategory() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -138,7 +136,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_twoProfiles_shouldAddTwoAccountCategory() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -153,7 +150,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_noProfileChange_shouldNotAddOrRemoveAccountCategory() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -171,7 +167,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_oneNewProfile_shouldAddOneAccountCategory() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -189,7 +184,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_oneProfileRemoved_shouldRemoveOneAccountCategory() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -207,7 +201,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_oneProfile_shouldSetAccountTitleWithUserName() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", UserInfo.FLAG_MANAGED_PROFILE));
@@ -226,7 +219,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_noPreferenceScreen_shouldNotCrash() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -244,7 +236,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_noPreferenceManager_shouldNotCrash() {
when(mFragment.getPreferenceManager()).thenReturn(null);
final List<UserInfo> infos = new ArrayList<>();
@@ -337,7 +328,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_twoAccountsOfSameType_shouldAddThreePreferences() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -417,7 +407,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_noAccountChange_shouldNotAddAccountPreference() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -498,7 +487,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_oneNewAccountType_shouldAddOneAccountPreference() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
@@ -534,7 +522,6 @@ public class AccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public void onResume_oneAccountRemoved_shouldRemoveOneAccountPreference() {
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));