diff options
author | 2023-02-13 12:42:12 +0000 | |
---|---|---|
committer | 2023-02-21 18:00:00 +0000 | |
commit | 052f5fb6d28717b7ff236c508f5fb36a7705f662 (patch) | |
tree | d148b944857d92cc4ad5666f7139c16b6ba56394 /runtime/common_runtime_test.h | |
parent | 4184f23701a64e9902ffced803968fcc5601764b (diff) |
Refactor DexFileLoader
The first parameter of the Open methods specifies the data source,
that we intend to load the dex file(s) from. This creates large number
of overloads when multiplied by diversity of the other arguments.
Move the data source parameters to the constructor of DexFileLoader.
Specifically, the constructor just creates the right DexFileContainer,
and the rest of the loader is independent of the data source used.
This removes large amount of the overloads as well as large amount
of copy-pasted code. Majority of ArtDexFileLoader has been removed.
Bug: 266950186
Test: ./art/test.py -b --host --optimizing --64
Change-Id: I6580b49e65441eec93a7e0124be23bd8c859904a
Diffstat (limited to 'runtime/common_runtime_test.h')
-rw-r--r-- | runtime/common_runtime_test.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h index 56e32254d9..85c48a240c 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -88,13 +88,12 @@ class CommonRuntimeTestImpl : public CommonArtTestImpl { bool MutateDexFile(File* output_dex, const std::string& input_jar, const Mutator& mutator) { std::vector<std::unique_ptr<const DexFile>> dex_files; std::string error_msg; - const ArtDexFileLoader dex_file_loader; - CHECK(dex_file_loader.Open(input_jar.c_str(), - input_jar.c_str(), - /*verify=*/ true, - /*verify_checksum=*/ true, + ArtDexFileLoader dex_file_loader(input_jar); + CHECK(dex_file_loader.Open(/*verify=*/true, + /*verify_checksum=*/true, &error_msg, - &dex_files)) << error_msg; + &dex_files)) + << error_msg; EXPECT_EQ(dex_files.size(), 1u) << "Only one input dex is supported"; const std::unique_ptr<const DexFile>& dex = dex_files[0]; CHECK(dex->EnableWrite()) << "Failed to enable write"; |