• Home
  • Raw
  • Download

Lines Matching refs:handle

57 static int32_t OpenArchiveWrapper(const std::string& name, ZipArchiveHandle* handle) {  in OpenArchiveWrapper()  argument
59 return OpenArchive(abs_path.c_str(), handle); in OpenArchiveWrapper()
133 ZipArchiveHandle handle; in TEST() local
134 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
135 CloseArchive(handle); in TEST()
137 ASSERT_EQ(kInvalidEntryName, OpenArchiveWrapper("bad_filename.zip", &handle)); in TEST()
138 CloseArchive(handle); in TEST()
142 ZipArchiveHandle handle; in TEST() local
143 ASSERT_EQ(kInvalidOffset, OpenArchiveWrapper("crash.apk", &handle)); in TEST()
144 CloseArchive(handle); in TEST()
148 ZipArchiveHandle handle; in TEST() local
149 ASSERT_EQ(kEmptyArchive, OpenArchiveWrapper("empty.zip", &handle)); in TEST()
150 CloseArchive(handle); in TEST()
154 ZipArchiveHandle handle; in TEST() local
155 ASSERT_EQ(kInvalidFile, OpenArchiveWrapper("zero-size-cd.zip", &handle)); in TEST()
156 CloseArchive(handle); in TEST()
160 ZipArchiveHandle handle; in TEST() local
161 ASSERT_NE(0, OpenArchiveWrapper("missing.zip", &handle)); in TEST()
164 ASSERT_EQ(-1, GetFileDescriptor(handle)); in TEST()
170 ZipArchiveHandle handle; in TEST() local
171 ASSERT_EQ(0, OpenArchiveFd(fd, "OpenWithAssumeFdOwnership", &handle)); in TEST()
172 CloseArchive(handle); in TEST()
180 ZipArchiveHandle handle; in TEST() local
181 ASSERT_EQ(0, OpenArchiveFd(fd, "OpenWithAssumeFdOwnership", &handle, false)); in TEST()
182 CloseArchive(handle); in TEST()
192 ZipArchiveHandle handle; in TEST() local
193 ASSERT_EQ(0, OpenArchiveFdRange(fd, "OpenWithAssumeFdOwnership", &handle, in TEST()
195 CloseArchive(handle); in TEST()
205 ZipArchiveHandle handle; in TEST() local
206 ASSERT_EQ(0, OpenArchiveFdRange(fd, "OpenWithAssumeFdOwnership", &handle, in TEST()
208 CloseArchive(handle); in TEST()
214 ZipArchiveHandle handle; in TEST() local
215 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
218 ASSERT_EQ(0, StartIteration(handle, &iteration_cookie)); in TEST()
230 CloseArchive(handle); in TEST()
251 ZipArchiveHandle handle; in AssertIterationOrder() local
252 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in AssertIterationOrder()
255 ASSERT_EQ(0, StartIteration(handle, &iteration_cookie, prefix, suffix)); in AssertIterationOrder()
257 CloseArchive(handle); in AssertIterationOrder()
262 ZipArchiveHandle handle; in AssertIterationOrderWithMatcher() local
263 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in AssertIterationOrderWithMatcher()
266 ASSERT_EQ(0, StartIteration(handle, &iteration_cookie, matcher)); in AssertIterationOrderWithMatcher()
268 CloseArchive(handle); in AssertIterationOrderWithMatcher()
322 ZipArchiveHandle handle; in TEST() local
323 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
326 ASSERT_EQ(0, StartIteration(handle, &iteration_cookie, "x", "y")); in TEST()
334 CloseArchive(handle); in TEST()
338 ZipArchiveHandle handle; in TEST() local
339 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
342 ASSERT_EQ(0, FindEntry(handle, "a.txt", &data)); in TEST()
353 ASSERT_LT(FindEntry(handle, "this file does not exist", &data), 0); in TEST()
355 CloseArchive(handle); in TEST()
359 ZipArchiveHandle handle; in TEST() local
360 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
363 ASSERT_EQ(kInvalidEntryName, FindEntry(handle, "", &data)); in TEST()
365 CloseArchive(handle); in TEST()
369 ZipArchiveHandle handle; in TEST() local
370 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
374 ASSERT_EQ(kInvalidEntryName, FindEntry(handle, very_long_name, &data)); in TEST()
376 CloseArchive(handle); in TEST()
380 ZipArchiveHandle handle; in TEST() local
381 ASSERT_EQ(0, OpenArchiveWrapper("declaredlength.zip", &handle)); in TEST()
384 ASSERT_EQ(0, StartIteration(handle, &iteration_cookie)); in TEST()
392 CloseArchive(handle); in TEST()
411 ZipArchiveHandle handle; in TEST() local
413 ASSERT_EQ(0, OpenArchiveFdRange(tmp_file.fd, "OpenArchiveFdRange", &handle, in TEST()
419 ASSERT_EQ(0, FindEntry(handle, "a.txt", &data)); in TEST()
423 ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer.get(), a_size)); in TEST()
427 ASSERT_EQ(0, FindEntry(handle, "b.txt", &data)); in TEST()
431 ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer.get(), b_size)); in TEST()
434 CloseArchive(handle); in TEST()
438 ZipArchiveHandle handle; in TEST() local
439 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
443 ASSERT_EQ(0, FindEntry(handle, "a.txt", &data)); in TEST()
447 ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer, a_size)); in TEST()
452 ASSERT_EQ(0, FindEntry(handle, "b.txt", &data)); in TEST()
456 ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer, b_size)); in TEST()
460 CloseArchive(handle); in TEST()
503 ZipArchiveHandle handle; in TEST() local
504 ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle, false)); in TEST()
507 ASSERT_EQ(0, FindEntry(handle, "empty.txt", &entry)); in TEST()
511 ASSERT_EQ(0, ExtractToMemory(handle, &entry, buffer, 1)); in TEST()
513 ASSERT_EQ(0, ExtractToMemory(handle, &entry, nullptr, 0)); in TEST()
517 ASSERT_EQ(0, ExtractEntryToFile(handle, &entry, tmp_output_file.fd)); in TEST()
529 ZipArchiveHandle handle; in TEST() local
530 ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EntryLargerThan32KTest", &handle, false)); in TEST()
533 ASSERT_EQ(0, FindEntry(handle, kAbTxtName, &entry)); in TEST()
538 ASSERT_EQ(0, ExtractToMemory(handle, &entry, &buffer[0], static_cast<uint32_t>(buffer.size()))); in TEST()
543 ASSERT_EQ(0, ExtractEntryToFile(handle, &entry, tmp_output_file.fd)); in TEST()
574 ZipArchiveHandle handle; in TEST() local
575 ASSERT_GT(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle, false)); in TEST()
586 ZipArchiveHandle handle; in TEST() local
587 ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle)); in TEST()
590 ASSERT_EQ(0, FindEntry(handle, "a.txt", &entry)); in TEST()
591 ASSERT_EQ(0, ExtractEntryToFile(handle, &entry, tmp_file.fd)); in TEST()
621 ZipArchiveHandle handle; in TEST() local
623 OpenArchiveFromMemory(file_map->data(), file_map->size(), zip_path.c_str(), &handle)); in TEST()
627 ASSERT_EQ(0, FindEntry(handle, "META-INF/com/google/android/update-binary", &binary_entry)); in TEST()
630 ASSERT_EQ(0, ExtractEntryToFile(handle, &binary_entry, tmp_binary.fd)); in TEST()
634 static void ZipArchiveStreamTest(ZipArchiveHandle& handle, const std::string& entry_name, bool raw, in ZipArchiveStreamTest() argument
636 ASSERT_EQ(0, FindEntry(handle, entry_name, entry)); in ZipArchiveStreamTest()
639 stream.reset(ZipArchiveStreamEntry::CreateRaw(handle, *entry)); in ZipArchiveStreamTest()
646 stream.reset(ZipArchiveStreamEntry::Create(handle, *entry)); in ZipArchiveStreamTest()
665 ZipArchiveHandle handle; in ZipArchiveStreamTestUsingContents() local
666 ASSERT_EQ(0, OpenArchiveWrapper(zip_file, &handle)); in ZipArchiveStreamTestUsingContents()
670 ZipArchiveStreamTest(handle, entry_name, raw, true, &entry, &read_data); in ZipArchiveStreamTestUsingContents()
675 CloseArchive(handle); in ZipArchiveStreamTestUsingContents()
680 ZipArchiveHandle handle; in ZipArchiveStreamTestUsingMemory() local
681 ASSERT_EQ(0, OpenArchiveWrapper(zip_file, &handle)); in ZipArchiveStreamTestUsingMemory()
685 ZipArchiveStreamTest(handle, entry_name, false, true, &entry, &read_data); in ZipArchiveStreamTestUsingMemory()
690 0, ExtractToMemory(handle, &entry, cmp_data.data(), static_cast<uint32_t>(cmp_data.size()))); in ZipArchiveStreamTestUsingMemory()
693 CloseArchive(handle); in ZipArchiveStreamTestUsingMemory()
721 ZipArchiveHandle handle; in TEST() local
722 ASSERT_EQ(0, OpenArchiveWrapper(kBadCrcZip, &handle)); in TEST()
726 ZipArchiveStreamTest(handle, "a.txt", false, false, &entry, &read_data); in TEST()
728 CloseArchive(handle); in TEST()
732 ZipArchiveHandle handle; in TEST() local
733 ASSERT_EQ(0, OpenArchiveWrapper(kBadCrcZip, &handle)); in TEST()
737 ZipArchiveStreamTest(handle, "b.txt", false, false, &entry, &read_data); in TEST()
739 CloseArchive(handle); in TEST()
780 ZipArchiveHandle handle; in ExtractEntryToMemory() local
781 ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "ExtractEntryToMemory", &handle, false)); in ExtractEntryToMemory()
787 ASSERT_EQ(0, FindEntry(handle, "name", &entry)); in ExtractEntryToMemory()
791 (*error_code_out) = ExtractToMemory(handle, &entry, &((*entry_out)[0]), 12); in ExtractEntryToMemory()
793 CloseArchive(handle); in ExtractEntryToMemory()
885 ZipArchiveHandle handle; in TEST() local
886 ASSERT_EQ(kInvalidFile, OpenArchiveFd(tmp_file.fd, "LeadingNonZipBytes", &handle, false)); in TEST()
1189 ZipArchiveHandle handle; in TEST_F() local
1191 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1192 CloseArchive(handle); in TEST_F()
1201 ZipArchiveHandle handle; in TEST_F() local
1203 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1204 CloseArchive(handle); in TEST_F()
1212 ZipArchiveHandle handle; in TEST_F() local
1215 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1216 CloseArchive(handle); in TEST_F()
1225 ZipArchiveHandle handle; in TEST_F() local
1227 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1229 ASSERT_EQ(0, FindEntry(handle, "a.txt", &entry)); in TEST_F()
1233 ASSERT_EQ(0, FindEntry(handle, "b.txt", &entry)); in TEST_F()
1236 CloseArchive(handle); in TEST_F()
1255 ZipArchiveHandle handle; in TEST_F() local
1257 "debug_zip64", &handle)); in TEST_F()
1259 ASSERT_EQ(0, FindEntry(handle, "a.txt", &entry)); in TEST_F()
1263 ASSERT_EQ(0, FindEntry(handle, "b.txt", &entry)); in TEST_F()
1266 CloseArchive(handle); in TEST_F()
1278 ZipArchiveHandle handle; in TEST_F() local
1280 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1282 ASSERT_NE(0, FindEntry(handle, "a.txt", &entry)); in TEST_F()
1284 CloseArchive(handle); in TEST_F()
1295 ZipArchiveHandle handle; in TEST_F() local
1297 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1300 ASSERT_EQ(0, StartIteration(handle, &iteration_cookie)); in TEST_F()
1307 CloseArchive(handle); in TEST_F()
1318 ZipArchiveHandle handle; in TEST_F() local
1320 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1321 CloseArchive(handle); in TEST_F()
1330 ZipArchiveHandle handle; in TEST_F() local
1332 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1334 ASSERT_EQ(0, FindEntry(handle, "a.txt", &entry)); in TEST_F()
1337 ASSERT_EQ(0, ExtractToWriter(handle, &entry, &writer)); in TEST_F()
1348 ZipArchiveHandle handle; in TEST_F() local
1350 0, OpenArchiveFromMemory(zip_content_.data(), zip_content_.size(), "debug_zip64", &handle)); in TEST_F()
1352 ASSERT_EQ(0, FindEntry(handle, "b.txt", &entry)); in TEST_F()
1355 ASSERT_EQ(0, ExtractToWriter(handle, &entry, &writer)); in TEST_F()
1382 ZipArchiveHandle handle; in TEST_F() local
1384 "debug_zip64", &handle)); in TEST_F()
1386 ASSERT_EQ(0, FindEntry(handle, "b.txt", &entry)); in TEST_F()
1389 ASSERT_EQ(0, ExtractToWriter(handle, &entry, &writer)); in TEST_F()
1406 ZipArchiveHandle handle; in TEST() local
1407 ASSERT_EQ(0, OpenArchiveFromMemory(&zip[0], zip.size(), "name", &handle)); in TEST()
1410 ASSERT_EQ(0, StartIteration(handle, &cookie)); in TEST()