Search in sources :

Example 21 with StorageItemPreferenceController

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);
}
Also used : SparseArray(android.util.SparseArray) StorageItemPreferenceController(com.android.settings.deviceinfo.storage.StorageItemPreferenceController) StorageAsyncLoader(com.android.settings.deviceinfo.storage.StorageAsyncLoader) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) Test(org.junit.Test)

Aggregations

StorageItemPreferenceController (com.android.settings.deviceinfo.storage.StorageItemPreferenceController)21 StorageManager (android.os.storage.StorageManager)14 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)14 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)14 ArrayList (java.util.ArrayList)14 UserManager (android.os.UserManager)7 SparseArray (android.util.SparseArray)7 StorageAsyncLoader (com.android.settings.deviceinfo.storage.StorageAsyncLoader)7 StorageSummaryDonutPreferenceController (com.android.settings.deviceinfo.storage.StorageSummaryDonutPreferenceController)7 StorageStatsSource (com.android.settingslib.applications.StorageStatsSource)7 Test (org.junit.Test)7 UserManagerWrapper (com.android.settings.applications.UserManagerWrapper)6 UserManagerWrapperImpl (com.android.settings.applications.UserManagerWrapperImpl)6 AutomaticStorageManagementSwitchPreferenceController (com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController)6