/tools/apkzlib/src/test/java/com/android/tools/build/apkzlib/zip/ |
D | ZFileTest.java | 71 try (ZFile zf = new ZFile(zpath)) { in getZipPath() argument 72 assertEquals(zpath, zf.getFile()); in getZipPath() 79 File zf = new File(temporaryDir, "a"); in readNonExistingFile() local 80 try (ZFile azf = new ZFile(zf)) { in readNonExistingFile() 84 assertTrue(zf.exists()); in readNonExistingFile() 90 File zf = new File(temporaryDir, "a"); in readExistingEmptyFile() local 91 Files.write(new byte[0], zf); in readExistingEmptyFile() 92 try (ZFile azf = new ZFile(zf)) { in readExistingEmptyFile() 101 File zf = ZipTestUtils.cloneRsrc("empty-zip.zip", mTemporaryFolder); in readAlmostEmptyZip() local 103 try (ZFile azf = new ZFile(zf)) { in readAlmostEmptyZip() [all …]
|
D | AlignmentTest.java | 58 try (ZFile zf = new ZFile(newZFile, options)) { in addAlignedFile() argument 59 zf.add("test.txt", new ByteArrayInputStream(testBytes), false); in addAlignedFile() 74 try (ZFile zf = new ZFile(newZFile, options)) { in addNonAlignedFile() argument 75 zf.add("test.txt.foo", new ByteArrayInputStream(testBytes), false); in addNonAlignedFile() 89 try (ZFile zf = new ZFile(newZFile)) { 90 zf.add("file1.txt", new ByteArrayInputStream(testBytes1), false); 91 zf.add("file0.txt", new ByteArrayInputStream(testBytes0), false); 92 zf.close(); 94 StoredEntry se0 = zf.get("file0.txt"); 98 StoredEntry se1 = zf.get("file1.txt"); [all …]
|
D | ZFileNotificationTest.java | 115 try (ZFile zf = new ZFile(new File(mTemporaryFolder.getRoot(), "a.zip"))) { in notifyAddFile() argument 117 zf.addZFileExtension(kl); in notifyAddFile() 121 zf.add("foo", new ByteArrayInputStream(new byte[] { 1, 2 })); in notifyAddFile() 122 zf.finishAllBackgroundTasks(); in notifyAddFile() 129 StoredEntry foo = zf.get("foo"); in notifyAddFile() 138 try (ZFile zf = new ZFile(new File(mTemporaryFolder.getRoot(), "a.zip"))) { in notifyRemoveFile() argument 140 zf.addZFileExtension(kl); in notifyRemoveFile() 144 zf.add("foo", new ByteArrayInputStream(new byte[] { 1, 2 })); in notifyRemoveFile() 145 zf.finishAllBackgroundTasks(); in notifyRemoveFile() 148 StoredEntry foo = zf.get("foo"); in notifyRemoveFile() [all …]
|
D | ExtraFieldTest.java | 97 try (ZFile zf = new ZFile(mZipFile)) { in readEntryWithNoExtraField() argument 98 StoredEntry foo = zf.get("foo"); in readEntryWithNoExtraField() 125 try (ZFile zf = new ZFile(mZipFile)) { in readSingleExtraField() argument 126 StoredEntry foo = zf.get("foo"); in readSingleExtraField() 172 try (ZFile zf = new ZFile(mZipFile)) { in readMultipleExtraFields() argument 173 StoredEntry foo = zf.get("foo"); in readMultipleExtraFields() 199 try (ZFile zf = new ZFile(mZipFile)) { in addExtraFieldToExistingEntry() argument 200 zf.add("before", new ByteArrayInputStream(new byte[] { 0, 1, 2 })); in addExtraFieldToExistingEntry() 201 zf.add("extra", new ByteArrayInputStream(new byte[] { 3, 4, 5 })); in addExtraFieldToExistingEntry() 202 zf.add("after", new ByteArrayInputStream(new byte[] { 6, 7, 8 })); in addExtraFieldToExistingEntry() [all …]
|
D | ZFileReadOnlyTest.java | 48 try (ZFile zf = new ZFile(zip)) { in makeTestZip() argument 49 zf.add("bar", new ByteArrayInputStream(new byte[] { 0, 1, 2, 3, 4, 5 })); in makeTestZip() 57 try (ZFile zf = new ZFile(makeTestZip(), new ZFileOptions(), true)) { in cannotUpdateInRoMode() argument 59 zf.update(); in cannotUpdateInRoMode() 69 try (ZFile zf = new ZFile(makeTestZip(), new ZFileOptions(), true)) { in cannotAddFilesInRoMode() argument 71 zf.add("bar2", new ByteArrayInputStream(new byte[] { 6, 7, })); in cannotAddFilesInRoMode() 82 try (ZFile zf = new ZFile(makeTestZip(), new ZFileOptions(), true)) { in cannotAddRecursivelyInRoMode() argument 84 zf.addAllRecursively(folder); in cannotAddRecursivelyInRoMode() 94 try (ZFile zf = new ZFile(makeTestZip(), new ZFileOptions(), true)) { in cannotReplaceFilesInRoMode() argument 96 zf.add("bar", new ByteArrayInputStream(new byte[] { 6, 7 })); in cannotReplaceFilesInRoMode() [all …]
|
D | ZipToolsTest.java | 121 try (ZFile zf = new ZFile(cloneZipFile())) { in zfileReadsZipFile() argument 123 assertEquals(6, zf.entries().size()); in zfileReadsZipFile() 125 assertEquals(4, zf.entries().size()); in zfileReadsZipFile() 128 assertFileInZip(zf, "root"); in zfileReadsZipFile() 129 assertFileInZip(zf, "images/lena.png"); in zfileReadsZipFile() 130 assertFileInZip(zf, "text-files/rfc2460.txt"); in zfileReadsZipFile() 131 assertFileInZip(zf, "text-files/wikipedia.html"); in zfileReadsZipFile() 155 try (ZFile zf = new ZFile(zfile, options)) { in testReadZFile() argument 156 zf.add("root", new ByteArrayInputStream(ZipTestUtils.rsrcBytes("root"))); in testReadZFile() 157 zf.add("images/", new ByteArrayInputStream(new byte[0])); in testReadZFile() [all …]
|
D | OldApkReadTest.java | 33 try (ZFile zf = new ZFile(apkFile, new ZFileOptions())) { in testReadOldApk() argument 34 StoredEntry classesDex = zf.get("classes.dex"); in testReadOldApk()
|
/tools/apkzlib/src/test/java/com/android/tools/build/apkzlib/sign/ |
D | ManifestGenerationTest.java | 48 try (ZFile zf = new ZFile(zip)) { in elementaryManifestGeneration() argument 49 zf.add("abc", new ByteArrayInputStream(new byte[]{1})); in elementaryManifestGeneration() 50 zf.add("x/", new ByteArrayInputStream(new byte[0])); in elementaryManifestGeneration() 51 zf.add("x/abc", new ByteArrayInputStream(new byte[]{2})); in elementaryManifestGeneration() 55 extension.register(zf); in elementaryManifestGeneration() 57 zf.update(); in elementaryManifestGeneration() 59 StoredEntry se = zf.get("META-INF/MANIFEST.MF"); in elementaryManifestGeneration() 83 ZFile zf = closer.register(new ZFile(zip)); in manifestGenerationOnHalfWrittenFile() local 86 zf.add("wiki", wiki); in manifestGenerationOnHalfWrittenFile() 91 extension.register(zf); in manifestGenerationOnHalfWrittenFile() [all …]
|
D | JarSigningTest.java | 50 try (ZFile zf = new ZFile(zipFile)) { in signEmptyJar() argument 51 ApkZFileTestUtils.addAndroidManifest(zf); in signEmptyJar() 54 manifestExtension.register(zf); in signEmptyJar() 59 new SigningExtension(12, p.v2, p.v1, true, false).register(zf); in signEmptyJar() 193 try (ZFile zf = new ZFile(zipFile)) { in v2SignAddsApkSigningBlock() argument 194 ApkZFileTestUtils.addAndroidManifest(zf); in v2SignAddsApkSigningBlock() 197 manifestExtension.register(zf); in v2SignAddsApkSigningBlock() 201 new SigningExtension(12, p.v2, p.v1, false, true).register(zf); in v2SignAddsApkSigningBlock() 314 try (ZFile zf = new ZFile(zipFile)) { in openSignedJarDoesNotForcesWriteIfSignatureIsNotCorrect() argument 315 ApkZFileTestUtils.addAndroidManifest(zf); in openSignedJarDoesNotForcesWriteIfSignatureIsNotCorrect() [all …]
|
D | FullApkSignTest.java | 65 ZFile zf = new ZFile(out, options); in testSignature() local 67 .register(zf); in testSignature() 70 zf.add(f1Name, new ByteArrayInputStream(f1Data)); in testSignature() 73 zf.add(f2Name, new ByteArrayInputStream(f2Data)); in testSignature() 74 zf.close(); in testSignature()
|
/tools/apkzlib/src/test/java/com/android/tools/build/apkzlib/zfile/ |
D | ApkAlignmentTest.java | 64 try (ZFile zf = new ZFile(apk)) { in soFilesUncompressedAndAligned() argument 65 StoredEntry soEntry = zf.get("/doesnt_work.so"); in soFilesUncompressedAndAligned() 81 try (ZFile zf = new ZFile(zipToMerge)) { in soFilesMergedFromZipsCanBeUncompressedAndAligned() argument 82 zf.add("/zero.so", new ByteArrayInputStream(new byte[500])); in soFilesMergedFromZipsCanBeUncompressedAndAligned() 85 try (ZFile zf = new ZFile(zipToMerge)) { in soFilesMergedFromZipsCanBeUncompressedAndAligned() argument 86 StoredEntry zeroSo = zf.get("/zero.so"); in soFilesMergedFromZipsCanBeUncompressedAndAligned() 117 try (ZFile zf = new ZFile(apk)) { in soFilesMergedFromZipsCanBeUncompressedAndAligned() argument 118 StoredEntry soEntry = zf.get("/zero.so"); in soFilesMergedFromZipsCanBeUncompressedAndAligned() 161 try (ZFile zf = new ZFile(apk)) { in soFilesUncompressedAndNotAligned() argument 162 StoredEntry soEntry = zf.get("/doesnt_work.so"); in soFilesUncompressedAndNotAligned() [all …]
|
/tools/apkzlib/src/test/java/com/android/tools/build/apkzlib/zip/compress/ |
D | MultiCompressorTest.java | 64 try (ZFile zf = new ZFile(zip)) { in storeIsBest() argument 65 zf.add("file", new ByteArrayInputStream(new byte[0])); in storeIsBest() 66 StoredEntry entry = zf.get("file"); in storeIsBest() 83 try (ZFile zf = new ZFile(zip)) { in sameCompressionResultButBetterThanStore() argument 84 zf.add("file", new ByteArrayInputStream(data)); in sameCompressionResultButBetterThanStore() 85 StoredEntry entry = zf.get("file"); in sameCompressionResultButBetterThanStore()
|
/tools/apkzlib/src/test/java/com/android/tools/build/apkzlib/utils/ |
D | ApkZFileTestUtils.java | 115 public static void addAndroidManifest(ZFile zf) throws IOException { in addAndroidManifest() argument 116 zf.add("AndroidManifest.xml", new ByteArrayInputStream(getAndroidManifest())); in addAndroidManifest()
|