use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class StorageProfileFragmentTest method verifyAppSizesAreNotZeroedOut.
@Test
public void verifyAppSizesAreNotZeroedOut() {
StorageItemPreferenceController controller = mock(StorageItemPreferenceController.class);
StorageProfileFragment fragment = new StorageProfileFragment();
StorageAsyncLoader.AppsStorageResult result = new StorageAsyncLoader.AppsStorageResult();
result.musicAppsSize = 100;
result.otherAppsSize = 200;
result.gamesSize = 300;
result.videoAppsSize = 400;
result.externalStats = new StorageStatsSource.ExternalStorageStats(6, 1, 2, 3, 0);
SparseArray<StorageAsyncLoader.AppsStorageResult> resultsArray = new SparseArray<>();
resultsArray.put(0, result);
fragment.setPreferenceController(controller);
fragment.onLoadFinished(null, resultsArray);
MockitoAnnotations.initMocks(this);
verify(controller).onLoadFinished(mCaptor.capture(), anyInt());
StorageAsyncLoader.AppsStorageResult extractedResult = mCaptor.getValue().get(0);
assertThat(extractedResult.musicAppsSize).isEqualTo(100);
assertThat(extractedResult.videoAppsSize).isEqualTo(400);
assertThat(extractedResult.otherAppsSize).isEqualTo(200);
assertThat(extractedResult.gamesSize).isEqualTo(300);
assertThat(extractedResult.externalStats.audioBytes).isEqualTo(1);
assertThat(extractedResult.externalStats.videoBytes).isEqualTo(2);
assertThat(extractedResult.externalStats.imageBytes).isEqualTo(3);
assertThat(extractedResult.externalStats.totalBytes).isEqualTo(6);
}
Aggregations