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

@@ -79,8 +79,15 @@ import java.util.Map;
import java.util.Set;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
shadows = {ShadowRunnableAsyncTask.class})
@Config(
manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
shadows = {
ShadowRunnableAsyncTask.class,
ShadowDatabaseIndexingUtils.class,
ShadowContentResolver.class
}
)
public class DatabaseIndexingManagerTest {
private final String localeStr = "en_US";
@@ -747,7 +754,6 @@ public class DatabaseIndexingManagerTest {
// Test new public indexing flow
@Test
@Config(shadows = {ShadowDatabaseIndexingUtils.class})
public void testPerformIndexing_fullIndex_getsDataFromProviders() {
DummyProvider provider = new DummyProvider();
provider.onCreate();
@@ -767,7 +773,6 @@ public class DatabaseIndexingManagerTest {
}
@Test
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
public void testPerformIndexing_incrementalIndex_noDataAdded() {
final List<ResolveInfo> providerInfo = getDummyResolveInfo();
skipFullIndex(providerInfo);
@@ -792,7 +797,6 @@ public class DatabaseIndexingManagerTest {
}
@Test
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
public void testPerformIndexing_localeChanged_databaseDropped() {
DummyProvider provider = new DummyProvider();
provider.onCreate();
@@ -830,7 +834,6 @@ public class DatabaseIndexingManagerTest {
}
@Test
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
public void testPerformIndexing_onOta_FullIndex() {
DummyProvider provider = new DummyProvider();
provider.onCreate();
@@ -851,7 +854,6 @@ public class DatabaseIndexingManagerTest {
}
@Test
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
public void testPerformIndexing_onPackageChange_shouldFullIndex() {
final List<ResolveInfo> providers = getDummyResolveInfo();
final String buildNumber = Build.FINGERPRINT;
@@ -873,7 +875,6 @@ public class DatabaseIndexingManagerTest {
}
@Test
@Config(shadows = {ShadowDatabaseIndexingUtils.class,})
public void testPerformIndexing_onOta_buildNumberIsCached() {
DummyProvider provider = new DummyProvider();
provider.onCreate();
@@ -1017,7 +1018,6 @@ public class DatabaseIndexingManagerTest {
}
@Test
@Config(shadows = {ShadowContentResolver.class})
public void testEmptyNonIndexableKeys_emptyDataKeyResources_addedToDatabase() {
insertSpecialCase(TITLE_ONE, true /* enabled */, null /* dataReferenceKey */);