Fake the cache size to be 0 bytes when cleared.
The fast track storage calculation returns a non-zero answer after the storage has been cleared. The simplest workaround here is to fake the size as 0 bytes in the view after cache clearing. It will not be zero if the user exits and comes back, but this should be fine. MARK IT ZERO! Change-Id: Ia012c2cf2842040d5eac3d4a72539ec7dcfb9570 Fixes: 34965659 Test: Settings Robotest
This commit is contained in:
@@ -92,4 +92,22 @@ public class AppStorageSizesControllerTest {
|
||||
assertThat(mDataPreference.getSummary()).isEqualTo("100B");
|
||||
assertThat(mTotalPreference.getSummary()).isEqualTo("111B");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fakeCacheFlagSetsCacheToZero() {
|
||||
AppStorageStats result = mock(AppStorageStats.class);
|
||||
when(result.getCodeBytes()).thenReturn(1L);
|
||||
when(result.getCacheBytes()).thenReturn(10L);
|
||||
when(result.getDataBytes()).thenReturn(100L);
|
||||
when(result.getTotalBytes()).thenReturn(111L);
|
||||
|
||||
mController.setResult(result);
|
||||
mController.setCacheCleared(true);
|
||||
mController.updateUi(mContext);
|
||||
|
||||
assertThat(mAppPreference.getSummary()).isEqualTo("1.00B");
|
||||
assertThat(mCachePreference.getSummary()).isEqualTo("0.00B");
|
||||
assertThat(mDataPreference.getSummary()).isEqualTo("100B");
|
||||
assertThat(mTotalPreference.getSummary()).isEqualTo("101B");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user