diff options
author | Zhomart Mukhamejanov <zhomart@google.com> | 2018-05-18 19:22:13 +0200 |
---|---|---|
committer | Zhomart Mukhamejanov <zhomart@google.com> | 2018-05-18 19:38:33 +0200 |
commit | b0361ffa3e25ab3e234a5ccaa5587b7dca88de76 (patch) | |
tree | dc99362d4eb95196eec3ceab8aafe88124c066a0 /updater_sample/tests | |
parent | Merge "recovery: Reset optind to 1 after getopt" (diff) | |
download | android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.tar android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.tar.gz android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.tar.bz2 android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.tar.lz android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.tar.xz android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.tar.zst android_bootable_recovery-b0361ffa3e25ab3e234a5ccaa5587b7dca88de76.zip |
Diffstat (limited to 'updater_sample/tests')
-rw-r--r-- | updater_sample/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/updater_sample/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java b/updater_sample/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java index d9e54652f..3ba84c116 100644 --- a/updater_sample/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java +++ b/updater_sample/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java @@ -55,6 +55,8 @@ public class PayloadSpecsTest { private Context mTargetContext; private Context mTestContext; + private PayloadSpecs mPayloadSpecs; + @Rule public final ExpectedException thrown = ExpectedException.none(); @@ -64,6 +66,7 @@ public class PayloadSpecsTest { mTestContext = InstrumentationRegistry.getContext(); mTestDir = mTargetContext.getFilesDir(); + mPayloadSpecs = new PayloadSpecs(); } @Test @@ -75,7 +78,7 @@ public class PayloadSpecsTest { java.nio.file.Files.deleteIfExists(packageFile.toPath()); java.nio.file.Files.copy(mTestContext.getResources().openRawResource(R.raw.ota_002_package), packageFile.toPath()); - PayloadSpec spec = PayloadSpecs.forNonStreaming(packageFile); + PayloadSpec spec = mPayloadSpecs.forNonStreaming(packageFile); assertEquals("correct url", "file://" + packageFile.getAbsolutePath(), spec.getUrl()); assertEquals("correct payload offset", @@ -90,7 +93,7 @@ public class PayloadSpecsTest { @Test public void forNonStreaming_IOException() throws Exception { thrown.expect(IOException.class); - PayloadSpecs.forNonStreaming(new File("/fake/news.zip")); + mPayloadSpecs.forNonStreaming(new File("/fake/news.zip")); } @Test @@ -100,7 +103,7 @@ public class PayloadSpecsTest { long size = 200; File propertiesFile = createMockPropertiesFile(); - PayloadSpec spec = PayloadSpecs.forStreaming(url, offset, size, propertiesFile); + PayloadSpec spec = mPayloadSpecs.forStreaming(url, offset, size, propertiesFile); assertEquals("same url", url, spec.getUrl()); assertEquals("same offset", offset, spec.getOffset()); assertEquals("same size", size, spec.getSize()); |