diff options
Diffstat (limited to 'cmds/idmap2/tests/TestHelpers.h')
-rw-r--r-- | cmds/idmap2/tests/TestHelpers.h | 99 |
1 files changed, 63 insertions, 36 deletions
diff --git a/cmds/idmap2/tests/TestHelpers.h b/cmds/idmap2/tests/TestHelpers.h index adea3293534d..b599dcb0069a 100644 --- a/cmds/idmap2/tests/TestHelpers.h +++ b/cmds/idmap2/tests/TestHelpers.h @@ -30,7 +30,7 @@ const unsigned char idmap_raw_data[] = { 0x49, 0x44, 0x4d, 0x50, // 0x4: version - 0x01, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, // 0x8: target crc 0x34, 0x12, 0x00, 0x00, @@ -38,8 +38,14 @@ const unsigned char idmap_raw_data[] = { // 0xc: overlay crc 0x78, 0x56, 0x00, 0x00, - // 0x10: target path "target.apk" - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x61, 0x70, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // 0x10: fulfilled policies + 0x11, 0x00, 0x00, 0x00, + + // 0x14: enforce overlayable + 0x01, + + // 0x15: target path "targetX.apk" + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x58, 0x2e, 0x61, 0x70, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -56,8 +62,8 @@ const unsigned char idmap_raw_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // 0x110: overlay path "overlay.apk" - 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, + // 0x115: overlay path "overlayX.apk" + 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x58, 0x2e, 0x61, 0x70, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -74,56 +80,77 @@ const unsigned char idmap_raw_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // DATA HEADER - // 0x210: target package id - 0x7f, 0x00, + // 0x215: debug string + // string length, including terminating null + 0x08, 0x00, 0x00, 0x00, - // 0x212: types count - 0x02, 0x00, + // string contents "debug\0\0\0" (padded to word alignment) + 0x64, 0x65, 0x62, 0x75, 0x67, 0x00, 0x00, 0x00, - // DATA BLOCK - // 0x214: target type - 0x02, 0x00, + // DATA HEADER + // 0x221: target_package_id + 0x7f, - // 0x216: overlay type - 0x02, 0x00, + // 0x222: overlay_package_id + 0x7f, - // 0x218: entry count - 0x01, 0x00, + // 0x223: target_entry_count + 0x03, 0x00, 0x00, 0x00, - // 0x21a: entry offset - 0x00, 0x00, + // 0x227: overlay_entry_count + 0x03, 0x00, 0x00, 0x00, - // 0x21c: entries + // 0x22b: string_pool_offset 0x00, 0x00, 0x00, 0x00, - // DATA BLOCK - // 0x220: target type - 0x03, 0x00, + // 0x22f: string_pool_byte_length + 0x00, 0x00, 0x00, 0x00, - // 0x222: overlay type - 0x03, 0x00, + // TARGET ENTRIES + // 0x233: 0x7f020000 + 0x00, 0x00, 0x02, 0x7f, - // 0x224: entry count - 0x03, 0x00, + // 0x237: TYPE_REFERENCE + 0x01, - // 0x226: entry offset - 0x03, 0x00, + // 0x238: 0x7f020000 + 0x00, 0x00, 0x02, 0x7f, - // 0x228, 0x22c, 0x230: entries - 0x00, 0x00, 0x00, 0x00, + // 0x23c: 0x7f030000 + 0x00, 0x00, 0x03, 0x7f, + + // 0x240: TYPE_REFERENCE + 0x01, + + // 0x241: 0x7f030000 + 0x00, 0x00, 0x03, 0x7f, + + // 0x245: 0x7f030002 + 0x02, 0x00, 0x03, 0x7f, + + // 0x249: TYPE_REFERENCE + 0x01, + + // 0x24a: 0x7f030001 + 0x01, 0x00, 0x03, 0x7f, + + // OVERLAY ENTRIES + // 0x24e: 0x7f020000 -> 0x7f020000 + 0x00, 0x00, 0x02, 0x7f, 0x00, 0x00, 0x02, 0x7f, - 0xff, 0xff, 0xff, 0xff, + // 0x256: 0x7f030000 -> 0x7f030000 + 0x00, 0x00, 0x03, 0x7f, 0x00, 0x00, 0x03, 0x7f, - 0x01, 0x00, 0x00, 0x00}; + // 0x25e: 0x7f030001 -> 0x7f030002 + 0x01, 0x00, 0x03, 0x7f, 0x02, 0x00, 0x03, 0x7f}; -const unsigned int idmap_raw_data_len = 565; +const unsigned int idmap_raw_data_len = 0x266; std::string GetTestDataPath(); class Idmap2Tests : public testing::Test { protected: - virtual void SetUp() { + void SetUp() override { #ifdef __ANDROID__ tmp_dir_path_ = "/data/local/tmp/idmap2-tests-XXXXXX"; #else @@ -136,7 +163,7 @@ class Idmap2Tests : public testing::Test { idmap_path_ = tmp_dir_path_ + "/a.idmap"; } - virtual void TearDown() { + void TearDown() override { EXPECT_EQ(rmdir(tmp_dir_path_.c_str()), 0) << "Failed to remove temporary directory " << tmp_dir_path_ << ": " << strerror(errno); } |