Use the "fast track" storage calculation for all categories.

Bug: 34204877
Test: Settings Robo
Change-Id: I4a3e26e6e96e9b697c1019160c053b079076d3a2
This commit is contained in:
Daniel Nishi
2017-01-31 12:48:23 -08:00
parent 23eb4378d6
commit 7cec1bc53c
5 changed files with 57 additions and 106 deletions

View File

@@ -42,7 +42,7 @@ import java.util.ArrayList;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class AppAsyncLoaderTest {
public class StorageAsyncLoaderTest {
@Mock
private StorageStatsSource mSource;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -51,13 +51,13 @@ public class AppAsyncLoaderTest {
private PackageManagerWrapper mPackageManager;
ArrayList<ApplicationInfo> mInfo = new ArrayList<>();
private AppsAsyncLoader mLoader;
private StorageAsyncLoader mLoader;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mInfo = new ArrayList<>();
mLoader = new AppsAsyncLoader(mContext, 1, "id", mSource, mPackageManager);
mLoader = new StorageAsyncLoader(mContext, 1, "id", mSource, mPackageManager);
when(mPackageManager.getInstalledApplicationsAsUser(anyInt(), anyInt())).thenReturn(mInfo);
}
@@ -66,7 +66,7 @@ public class AppAsyncLoaderTest {
addPackage(1001, 0, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
addPackage(1002, 0, 100, 1000, ApplicationInfo.CATEGORY_UNDEFINED);
AppsAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
StorageAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
assertThat(result.gamesSize).isEqualTo(0L);
assertThat(result.otherAppsSize).isEqualTo(1111L);
@@ -76,7 +76,7 @@ public class AppAsyncLoaderTest {
public void testGamesAreFiltered() throws Exception {
addPackage(1001, 0, 1, 10, ApplicationInfo.CATEGORY_GAME);
AppsAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
StorageAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
assertThat(result.gamesSize).isEqualTo(11L);
assertThat(result.otherAppsSize).isEqualTo(0);
@@ -87,7 +87,7 @@ public class AppAsyncLoaderTest {
addPackage(1001, 0, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
addPackage(1001, 0, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
AppsAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
StorageAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
assertThat(result.otherAppsSize).isEqualTo(11L);
}
@@ -96,7 +96,7 @@ public class AppAsyncLoaderTest {
public void testCacheIsIgnored() throws Exception {
addPackage(1001, 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
AppsAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
StorageAsyncLoader.AppsStorageResult result = mLoader.loadInBackground();
assertThat(result.otherAppsSize).isEqualTo(11L);
}