Search in sources :

Example 81 with PrivateStorageInfo

use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project platform_packages_apps_Settings by BlissRoms.

the class CachedStorageValuesHelperTest method getCachedPrivateStorageInfo_nullIfEmpty.

@Test
public void getCachedPrivateStorageInfo_nullIfEmpty() throws Exception {
    PrivateStorageInfo info = mCachedValuesHelper.getCachedPrivateStorageInfo();
    assertThat(info).isNull();
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Test(org.junit.Test)

Example 82 with PrivateStorageInfo

use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project platform_packages_apps_Settings by BlissRoms.

the class VolumeSizesLoaderTest method getVolumeSize_getsValidSizes.

@Test
public void getVolumeSize_getsValidSizes() throws Exception {
    VolumeInfo info = mock(VolumeInfo.class);
    StorageVolumeProvider storageVolumeProvider = mock(StorageVolumeProvider.class);
    when(storageVolumeProvider.getTotalBytes(any(), any())).thenReturn(10000L);
    when(storageVolumeProvider.getFreeBytes(any(), any())).thenReturn(1000L);
    PrivateStorageInfo storageInfo = VolumeSizesLoader.getVolumeSize(storageVolumeProvider, null, info);
    assertThat(storageInfo.freeBytes).isEqualTo(1000L);
    assertThat(storageInfo.totalBytes).isEqualTo(10000L);
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) StorageVolumeProvider(com.android.settingslib.deviceinfo.StorageVolumeProvider) VolumeInfo(android.os.storage.VolumeInfo) Test(org.junit.Test)

Example 83 with PrivateStorageInfo

use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LowStorageSliceTest method getSlice_lowStorage_shouldNotHaveErrorHint.

@Test
@Config(shadows = ShadowPrivateStorageInfo.class)
public void getSlice_lowStorage_shouldNotHaveErrorHint() {
    ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(10L, 100L));
    final Slice slice = mLowStorageSlice.getSlice();
    assertThat(slice.hasHint(HINT_ERROR)).isFalse();
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Slice(androidx.slice.Slice) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 84 with PrivateStorageInfo

use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LowStorageSliceTest method getSlice_lowStorage_shouldHaveStorageFreeTitle.

@Test
@Config(shadows = ShadowPrivateStorageInfo.class)
public void getSlice_lowStorage_shouldHaveStorageFreeTitle() {
    ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(10L, 100L));
    final Slice slice = mLowStorageSlice.getSlice();
    final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
    assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.storage_menu_free));
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Slice(androidx.slice.Slice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 85 with PrivateStorageInfo

use of com.android.settingslib.deviceinfo.PrivateStorageInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LowStorageSliceTest method getSlice_storageFree_shouldHaveErrorHint.

@Test
@Config(shadows = ShadowPrivateStorageInfo.class)
public void getSlice_storageFree_shouldHaveErrorHint() {
    ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(100L, 100L));
    final Slice slice = mLowStorageSlice.getSlice();
    assertThat(slice.hasHint(HINT_ERROR)).isTrue();
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Slice(androidx.slice.Slice) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

PrivateStorageInfo (com.android.settingslib.deviceinfo.PrivateStorageInfo)99 Test (org.junit.Test)86 View (android.view.View)21 RecyclerView (android.support.v7.widget.RecyclerView)15 CachedStorageValuesHelper (com.android.settings.deviceinfo.storage.CachedStorageValuesHelper)14 Slice (androidx.slice.Slice)9 VolumeInfo (android.os.storage.VolumeInfo)8 Config (org.robolectric.annotation.Config)8 SparseArray (android.util.SparseArray)7 StorageStatsSource (com.android.settingslib.applications.StorageStatsSource)7 StorageVolumeProvider (com.android.settingslib.deviceinfo.StorageVolumeProvider)7 VisibleForTesting (android.support.annotation.VisibleForTesting)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)6 SliceMetadata (androidx.slice.SliceMetadata)5 IconCompat (androidx.core.graphics.drawable.IconCompat)4 ShadowPrivateStorageInfo (com.android.settings.testutils.shadow.ShadowPrivateStorageInfo)4 ListBuilder (androidx.slice.builders.ListBuilder)3 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)3 VisibleForTesting (androidx.annotation.VisibleForTesting)2 NumberFormat (java.text.NumberFormat)2