diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2021-06-09 05:18:08 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2021-06-09 05:18:08 -0700 |
commit | f476d74eefab00e5b40d54513a2621e664c70ddf (patch) | |
tree | 01ec931931503ed80f181b2d85efb5df0079e4ba /aosp/apex_handler_android_unittest.cc | |
parent | 0482fa15f58c1de5ead9e0e3e2aa1d593d18e6c2 (diff) | |
parent | ac7fc8e1debff1f57afe79f144d8d16a1a0ec470 (diff) |
Merge ac7fc8e1debff1f57afe79f144d8d16a1a0ec470 on remote branch
Change-Id: I2cd41cefedfd492f9e20617ad9929ebf1cdde79e
Diffstat (limited to 'aosp/apex_handler_android_unittest.cc')
-rw-r--r-- | aosp/apex_handler_android_unittest.cc | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/aosp/apex_handler_android_unittest.cc b/aosp/apex_handler_android_unittest.cc index 981ae9dd..847ccaad 100644 --- a/aosp/apex_handler_android_unittest.cc +++ b/aosp/apex_handler_android_unittest.cc @@ -41,7 +41,7 @@ ApexInfo CreateApexInfo(const std::string& package_name, return std::move(result); } -TEST(ApexHandlerAndroidTest, CalculateSize) { +TEST(ApexHandlerAndroidTest, CalculateSizeUpdatableApex) { ApexHandlerAndroid apex_handler; std::vector<ApexInfo> apex_infos; ApexInfo compressed_apex_1 = CreateApexInfo("sample1", 1, true, 1); @@ -52,10 +52,10 @@ TEST(ApexHandlerAndroidTest, CalculateSize) { apex_infos.push_back(uncompressed_apex); auto result = apex_handler.CalculateSize(apex_infos); ASSERT_TRUE(result.ok()); - EXPECT_EQ(*result, 3u); + ASSERT_EQ(*result, 3u); } -TEST(ApexHandlerAndroidTest, AllocateSpace) { +TEST(ApexHandlerAndroidTest, AllocateSpaceUpdatableApex) { ApexHandlerAndroid apex_handler; std::vector<ApexInfo> apex_infos; ApexInfo compressed_apex_1 = CreateApexInfo("sample1", 1, true, 1); @@ -64,10 +64,39 @@ TEST(ApexHandlerAndroidTest, AllocateSpace) { apex_infos.push_back(compressed_apex_1); apex_infos.push_back(compressed_apex_2); apex_infos.push_back(uncompressed_apex); - EXPECT_TRUE(apex_handler.AllocateSpace(apex_infos)); + ASSERT_TRUE(apex_handler.AllocateSpace(apex_infos)); // Should be able to pass empty list - EXPECT_TRUE(apex_handler.AllocateSpace({})); + ASSERT_TRUE(apex_handler.AllocateSpace({})); +} + +TEST(ApexHandlerAndroidTest, CalculateSizeFlattenedApex) { + FlattenedApexHandlerAndroid apex_handler; + std::vector<ApexInfo> apex_infos; + ApexInfo compressed_apex_1 = CreateApexInfo("sample1", 1, true, 1); + ApexInfo compressed_apex_2 = CreateApexInfo("sample2", 2, true, 2); + ApexInfo uncompressed_apex = CreateApexInfo("uncompressed", 1, false, 4); + apex_infos.push_back(compressed_apex_1); + apex_infos.push_back(compressed_apex_2); + apex_infos.push_back(uncompressed_apex); + auto result = apex_handler.CalculateSize(apex_infos); + ASSERT_TRUE(result.ok()); + ASSERT_EQ(*result, 0u); +} + +TEST(ApexHandlerAndroidTest, AllocateSpaceFlattenedApex) { + FlattenedApexHandlerAndroid apex_handler; + std::vector<ApexInfo> apex_infos; + ApexInfo compressed_apex_1 = CreateApexInfo("sample1", 1, true, 1); + ApexInfo compressed_apex_2 = CreateApexInfo("sample2", 2, true, 2); + ApexInfo uncompressed_apex = CreateApexInfo("uncompressed", 1, false, 4); + apex_infos.push_back(compressed_apex_1); + apex_infos.push_back(compressed_apex_2); + apex_infos.push_back(uncompressed_apex); + ASSERT_TRUE(apex_handler.AllocateSpace(apex_infos)); + + // Should be able to pass empty list + ASSERT_TRUE(apex_handler.AllocateSpace({})); } } // namespace chromeos_update_engine |