Clean up profile tests.
Use TestDexFileBuilder and remove FakeDex. Add a helper
class for shared code between ProfileCompilationInfoTest
and ProfileAssistantTest.
Test: m test-art-host-gtest
Test: run-gtests.sh
Bug: 148067697
Change-Id: I0bf5d3fb7a456dcd717bce694d7f832a654fcccb
diff --git a/libdexfile/dex/dex_file_loader.cc b/libdexfile/dex/dex_file_loader.cc
index d3fac97..861f911 100644
--- a/libdexfile/dex/dex_file_loader.cc
+++ b/libdexfile/dex/dex_file_loader.cc
@@ -220,6 +220,30 @@
}
std::unique_ptr<const DexFile> DexFileLoader::Open(
+ const std::string& location,
+ uint32_t location_checksum,
+ std::vector<uint8_t>&& memory,
+ const OatDexFile* oat_dex_file,
+ bool verify,
+ bool verify_checksum,
+ std::string* error_msg) {
+ auto memory_data = memory.data();
+ auto memory_size = memory.size();
+ return OpenCommon(memory_data,
+ memory_size,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0,
+ location,
+ location_checksum,
+ oat_dex_file,
+ verify,
+ verify_checksum,
+ error_msg,
+ std::make_unique<VectorContainer>(std::move(memory)),
+ /*verify_result=*/ nullptr);
+}
+
+std::unique_ptr<const DexFile> DexFileLoader::Open(
const uint8_t* base,
size_t size,
const std::string& location,