Search in sources :

Example 6 with CachedStorageValuesHelper

use of com.android.settings.deviceinfo.storage.CachedStorageValuesHelper in project android_packages_apps_Settings by crdroidandroid.

the class StorageDashboardFragment method initializeCacheProvider.

private void initializeCacheProvider() {
    mCachedStorageValuesHelper = new CachedStorageValuesHelper(getContext(), UserHandle.myUserId());
    initializeCachedValues();
    onReceivedSizes();
}
Also used : CachedStorageValuesHelper(com.android.settings.deviceinfo.storage.CachedStorageValuesHelper)

Example 7 with CachedStorageValuesHelper

use of com.android.settings.deviceinfo.storage.CachedStorageValuesHelper in project android_packages_apps_Settings by crdroidandroid.

the class StorageDashboardFragmentTest method test_cacheProviderDoesntProvideValuesIfAppsMissing.

@Test
public void test_cacheProviderDoesntProvideValuesIfAppsMissing() {
    CachedStorageValuesHelper helper = mock(CachedStorageValuesHelper.class);
    PrivateStorageInfo info = new PrivateStorageInfo(0, 0);
    when(helper.getCachedPrivateStorageInfo()).thenReturn(info);
    mFragment.setCachedStorageValuesHelper(helper);
    mFragment.initializeCachedValues();
    assertThat(mFragment.getPrivateStorageInfo()).isNull();
    assertThat(mFragment.getAppsStorageResult()).isNull();
}
Also used : CachedStorageValuesHelper(com.android.settings.deviceinfo.storage.CachedStorageValuesHelper) PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Test(org.junit.Test)

Example 8 with CachedStorageValuesHelper

use of com.android.settings.deviceinfo.storage.CachedStorageValuesHelper in project android_packages_apps_Settings by SudaMod.

the class StorageDashboardFragmentTest method test_cacheProviderDoesntProvideValuesIfVolumeInfoMissing.

@Test
public void test_cacheProviderDoesntProvideValuesIfVolumeInfoMissing() {
    CachedStorageValuesHelper helper = mock(CachedStorageValuesHelper.class);
    SparseArray<StorageAsyncLoader.AppsStorageResult> result = new SparseArray<>();
    when(helper.getCachedAppsStorageResult()).thenReturn(result);
    mFragment.setCachedStorageValuesHelper(helper);
    mFragment.initializeCachedValues();
    assertThat(mFragment.getPrivateStorageInfo()).isNull();
    assertThat(mFragment.getAppsStorageResult()).isNull();
}
Also used : SparseArray(android.util.SparseArray) CachedStorageValuesHelper(com.android.settings.deviceinfo.storage.CachedStorageValuesHelper) Test(org.junit.Test)

Example 9 with CachedStorageValuesHelper

use of com.android.settings.deviceinfo.storage.CachedStorageValuesHelper in project android_packages_apps_Settings by DirtyUnicorns.

the class StorageDashboardFragmentTest method test_cacheProviderProvidesValuesIfBothCached.

@Test
public void test_cacheProviderProvidesValuesIfBothCached() {
    CachedStorageValuesHelper helper = mock(CachedStorageValuesHelper.class);
    PrivateStorageInfo info = new PrivateStorageInfo(0, 0);
    when(helper.getCachedPrivateStorageInfo()).thenReturn(info);
    SparseArray<StorageAsyncLoader.AppsStorageResult> result = new SparseArray<>();
    when(helper.getCachedAppsStorageResult()).thenReturn(result);
    mFragment.setCachedStorageValuesHelper(helper);
    mFragment.initializeCachedValues();
    assertThat(mFragment.getPrivateStorageInfo()).isEqualTo(info);
    assertThat(mFragment.getAppsStorageResult()).isEqualTo(result);
}
Also used : SparseArray(android.util.SparseArray) CachedStorageValuesHelper(com.android.settings.deviceinfo.storage.CachedStorageValuesHelper) PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Test(org.junit.Test)

Example 10 with CachedStorageValuesHelper

use of com.android.settings.deviceinfo.storage.CachedStorageValuesHelper in project platform_packages_apps_Settings by BlissRoms.

the class StorageDashboardFragment method initializeCacheProvider.

private void initializeCacheProvider() {
    mCachedStorageValuesHelper = new CachedStorageValuesHelper(getContext(), UserHandle.myUserId());
    initializeCachedValues();
    onReceivedSizes();
}
Also used : CachedStorageValuesHelper(com.android.settings.deviceinfo.storage.CachedStorageValuesHelper)

Aggregations

CachedStorageValuesHelper (com.android.settings.deviceinfo.storage.CachedStorageValuesHelper)28 Test (org.junit.Test)21 SparseArray (android.util.SparseArray)14 PrivateStorageInfo (com.android.settingslib.deviceinfo.PrivateStorageInfo)14