use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project android_packages_apps_Settings by omnirom.
the class StorageDashboardFragmentTest method test_dontLoadWhenQuotaOnAndAllLoaded.
@Test
public void test_dontLoadWhenQuotaOnAndAllLoaded() {
View fakeView = mock(View.class, RETURNS_DEEP_STUBS);
RecyclerView fakeRecyclerView = mock(RecyclerView.class, RETURNS_DEEP_STUBS);
when(fakeView.findViewById(anyInt())).thenReturn(fakeView);
mFragment = spy(mFragment);
when(mFragment.getView()).thenReturn(fakeView);
when(mFragment.getListView()).thenReturn(fakeRecyclerView);
mFragment.setStorageResult(new SparseArray<>());
PrivateStorageInfo storageInfo = new PrivateStorageInfo(0, 0);
mFragment.setPrivateStorageInfo(storageInfo);
mFragment.maybeSetLoading(true);
verify(mFragment, never()).setLoading(true, false);
}
use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project android_packages_apps_Settings by LineageOS.
the class CachedStorageValuesHelperTest method getCachedPrivateStorageInfo_nullIfDataIsStale.
@Test
public void getCachedPrivateStorageInfo_nullIfDataIsStale() throws Exception {
when(mMockClock.getCurrentTime()).thenReturn(10000000L);
mSharedPreferences.edit().putLong(GAME_APPS_SIZE_KEY, 0).putLong(MUSIC_APPS_SIZE_KEY, 10).putLong(VIDEO_APPS_SIZE_KEY, 100).putLong(PHOTO_APPS_SIZE_KEY, 1000).putLong(OTHER_APPS_SIZE_KEY, 10000).putLong(CACHE_APPS_SIZE_KEY, 100000).putLong(EXTERNAL_TOTAL_BYTES, 2).putLong(EXTERNAL_AUDIO_BYTES, 22).putLong(EXTERNAL_VIDEO_BYTES, 222).putLong(EXTERNAL_IMAGE_BYTES, 2222).putLong(EXTERNAL_APP_BYTES, 22222).putLong(FREE_BYTES_KEY, 1000L).putLong(TOTAL_BYTES_KEY, 5000L).putInt(USER_ID_KEY, 0).putLong(TIMESTAMP_KEY, 10000L).apply();
PrivateStorageInfo info = mCachedValuesHelper.getCachedPrivateStorageInfo();
assertThat(info).isNull();
}
use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project android_packages_apps_Settings by LineageOS.
the class CachedStorageValuesHelperTest method getCachedPrivateStorageInfo_nullIfWrongUser.
@Test
public void getCachedPrivateStorageInfo_nullIfWrongUser() throws Exception {
when(mMockClock.getCurrentTime()).thenReturn(10001L);
mSharedPreferences.edit().putLong(GAME_APPS_SIZE_KEY, 0).putLong(MUSIC_APPS_SIZE_KEY, 10).putLong(VIDEO_APPS_SIZE_KEY, 100).putLong(PHOTO_APPS_SIZE_KEY, 1000).putLong(OTHER_APPS_SIZE_KEY, 10000).putLong(CACHE_APPS_SIZE_KEY, 100000).putLong(EXTERNAL_TOTAL_BYTES, 2).putLong(EXTERNAL_AUDIO_BYTES, 22).putLong(EXTERNAL_VIDEO_BYTES, 222).putLong(EXTERNAL_IMAGE_BYTES, 2222).putLong(EXTERNAL_APP_BYTES, 22222).putLong(FREE_BYTES_KEY, 1000L).putLong(TOTAL_BYTES_KEY, 5000L).putInt(USER_ID_KEY, 1).putLong(TIMESTAMP_KEY, 10000L).apply();
PrivateStorageInfo info = mCachedValuesHelper.getCachedPrivateStorageInfo();
assertThat(info).isNull();
}
use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project android_packages_apps_Settings by LineageOS.
the class CachedStorageValuesHelperTest method getCachedPrivateStorageInfo_nullIfEmpty.
@Test
public void getCachedPrivateStorageInfo_nullIfEmpty() throws Exception {
PrivateStorageInfo info = mCachedValuesHelper.getCachedPrivateStorageInfo();
assertThat(info).isNull();
}
use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project android_packages_apps_Settings by LineageOS.
the class StorageDashboardFragmentTest method test_dontLoadWhenQuotaOffIfVolumeInfoNotLoaded.
@Test
public void test_dontLoadWhenQuotaOffIfVolumeInfoNotLoaded() {
View fakeView = mock(View.class, RETURNS_DEEP_STUBS);
RecyclerView fakeRecyclerView = mock(RecyclerView.class, RETURNS_DEEP_STUBS);
when(fakeView.findViewById(anyInt())).thenReturn(fakeView);
mFragment = spy(mFragment);
when(mFragment.getView()).thenReturn(fakeView);
when(mFragment.getListView()).thenReturn(fakeRecyclerView);
PrivateStorageInfo info = new PrivateStorageInfo(0, 0);
mFragment.setPrivateStorageInfo(info);
mFragment.maybeSetLoading(false);
verify(mFragment, never()).setLoading(true, false);
}
Aggregations