Merge "Follow storage API polishing." into oc-dev am: e398a84199

am: 4ecbc32b48

Change-Id: Ie47474e46fa6ebfffdddad04ab8c99b332c4f8cc
This commit is contained in:
Jeff Sharkey
2017-04-17 23:58:17 +00:00
committed by android-build-merger
7 changed files with 32 additions and 11 deletions

View File

@@ -40,6 +40,8 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import java.io.IOException;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class FetchPackageStorageAsyncLoaderTest {
@@ -56,7 +58,7 @@ public class FetchPackageStorageAsyncLoaderTest {
}
@Test
public void worksForValidPackageNameAndUid() {
public void worksForValidPackageNameAndUid() throws Exception {
AppStorageStats stats = mock(AppStorageStats.class);
when(stats.getCodeBytes()).thenReturn(1L);
when(stats.getDataBytes()).thenReturn(2L);
@@ -72,9 +74,9 @@ public class FetchPackageStorageAsyncLoaderTest {
}
@Test
public void installerExceptionHandledCleanly() {
public void installerExceptionHandledCleanly() throws Exception {
when(mSource.getStatsForPackage(anyString(), anyString(), any(UserHandle.class))).
thenThrow(new IllegalStateException("intentional failure"));
thenThrow(new IOException("intentional failure"));
ApplicationInfo info = new ApplicationInfo();
info.packageName = PACKAGE_NAME;
FetchPackageStorageAsyncLoader task = new FetchPackageStorageAsyncLoader(

View File

@@ -81,7 +81,7 @@ public class MusicViewHolderControllerTest {
}
@Test
public void storageShouldRepresentStorageStatsQuery() {
public void storageShouldRepresentStorageStatsQuery() throws Exception {
when(mSource.getExternalStorageStats(any(String.class), any(UserHandle.class))).thenReturn(
new StorageStatsSource.ExternalStorageStats(1, 1, 0, 0));

View File

@@ -70,7 +70,7 @@ public class StorageSettingsTest {
}
@Test
public void updateSummary_shouldDisplayUsedPercentAndFreeSpace() {
public void updateSummary_shouldDisplayUsedPercentAndFreeSpace() throws Exception {
final SummaryLoader loader = mock(SummaryLoader.class);
final SummaryLoader.SummaryProvider provider =
StorageSettings.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(mActivity, loader);