summaryrefslogtreecommitdiff
path: root/simpleperf/read_apk_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/read_apk_test.cpp')
-rw-r--r--simpleperf/read_apk_test.cpp34
1 files changed, 12 insertions, 22 deletions
diff --git a/simpleperf/read_apk_test.cpp b/simpleperf/read_apk_test.cpp
index e4dd71f5..d9665ac6 100644
--- a/simpleperf/read_apk_test.cpp
+++ b/simpleperf/read_apk_test.cpp
@@ -20,16 +20,14 @@
#include "get_test_data.h"
#include "test_util.h"
-using namespace simpleperf;
-
TEST(read_apk, FindElfInApkByOffset) {
ApkInspector inspector;
ASSERT_TRUE(inspector.FindElfInApkByOffset("/dev/null", 0) == nullptr);
ASSERT_TRUE(inspector.FindElfInApkByOffset(GetTestData(APK_FILE), 0) == nullptr);
// Test if we can read the EmbeddedElf using an offset inside its [offset, offset+size] range
// in the apk file.
- EmbeddedElf* ee = inspector.FindElfInApkByOffset(
- GetTestData(APK_FILE), NATIVELIB_OFFSET_IN_APK + NATIVELIB_SIZE_IN_APK / 2);
+ EmbeddedElf* ee = inspector.FindElfInApkByOffset(GetTestData(APK_FILE),
+ NATIVELIB_OFFSET_IN_APK + NATIVELIB_SIZE_IN_APK / 2);
ASSERT_TRUE(ee != nullptr);
ASSERT_EQ(NATIVELIB_IN_APK, ee->entry_name());
ASSERT_EQ(NATIVELIB_OFFSET_IN_APK, ee->entry_offset());
@@ -48,35 +46,27 @@ TEST(read_apk, FindElfInApkByName) {
TEST(read_apk, ParseExtractedInMemoryPath) {
std::string zip_path;
std::string entry_name;
- ASSERT_TRUE(ParseExtractedInMemoryPath(
- "[anon:dalvik-classes.dex extracted in memory from "
+ ASSERT_TRUE(ParseExtractedInMemoryPath("[anon:dalvik-classes.dex extracted in memory from "
"/data/app/com.example.simpleperf.simpleperfexamplepurejava-HZK6bPs3Z9SDT3a-tqmasA==/"
- "base.apk]",
- &zip_path, &entry_name));
- ASSERT_EQ(zip_path,
- "/data/app/com.example.simpleperf.simpleperfexamplepurejava"
+ "base.apk]", &zip_path, &entry_name));
+ ASSERT_EQ(zip_path, "/data/app/com.example.simpleperf.simpleperfexamplepurejava"
"-HZK6bPs3Z9SDT3a-tqmasA==/base.apk");
ASSERT_EQ(entry_name, "classes.dex");
- ASSERT_FALSE(
- ParseExtractedInMemoryPath("[anon:dalvik-thread local mark stack]", &zip_path, &entry_name));
- ASSERT_TRUE(ParseExtractedInMemoryPath(
- "/dev/ashmem/dalvik-classes.dex extracted in memory from "
+ ASSERT_FALSE(ParseExtractedInMemoryPath("[anon:dalvik-thread local mark stack]",
+ &zip_path, &entry_name));
+ ASSERT_TRUE(ParseExtractedInMemoryPath("/dev/ashmem/dalvik-classes.dex extracted in memory from "
"/data/app/com.example.simpleperf.simpleperfexamplepurejava-HZK6bPs3Z9SDT3a-tqmasA==/base.apk"
- " (deleted)",
- &zip_path, &entry_name));
- ASSERT_EQ(zip_path,
- "/data/app/com.example.simpleperf.simpleperfexamplepurejava"
+ " (deleted)", &zip_path, &entry_name));
+ ASSERT_EQ(zip_path, "/data/app/com.example.simpleperf.simpleperfexamplepurejava"
"-HZK6bPs3Z9SDT3a-tqmasA==/base.apk");
ASSERT_EQ(entry_name, "classes.dex");
ASSERT_FALSE(ParseExtractedInMemoryPath("/dev/ashmem/dalvik-thread local mark stack (deleted)",
&zip_path, &entry_name));
// Parse multidex file.
- ASSERT_TRUE(ParseExtractedInMemoryPath(
- "/dev/ashmem/dalvik-classes2.dex extracted in memory from "
+ ASSERT_TRUE(ParseExtractedInMemoryPath("/dev/ashmem/dalvik-classes2.dex extracted in memory from "
"/data/app/getxml.test.com.testgetxml-knxI11ZXLT-OVBs9X9bSkw==/base.apk!classes2.dex "
- "(deleted)",
- &zip_path, &entry_name));
+ "(deleted)", &zip_path, &entry_name));
ASSERT_EQ(zip_path, "/data/app/getxml.test.com.testgetxml-knxI11ZXLT-OVBs9X9bSkw==/base.apk");
ASSERT_EQ(entry_name, "classes2.dex");
}