Search in sources :

Example 1 with CachedStorageValuesHelper

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

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 2 with CachedStorageValuesHelper

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

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 3 with CachedStorageValuesHelper

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

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 4 with CachedStorageValuesHelper

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

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 5 with CachedStorageValuesHelper

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

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