diff options
author | Brian Orr <brianorr@google.com> | 2021-05-10 11:39:59 -0700 |
---|---|---|
committer | Brian Orr <brianorr@google.com> | 2021-05-10 11:39:59 -0700 |
commit | f79cb91b4218a68642c94a01defc0594e742b3f4 (patch) | |
tree | 01ec931931503ed80f181b2d85efb5df0079e4ba /aosp/apex_handler_android_unittest.cc | |
parent | d650df1d306a5a828e7b13a8cc954196fea44992 (diff) | |
parent | 3d4e6e0d7ed2b609e0fe2b4d0fcb250808f97476 (diff) |
Merge SP1A.210510.001
Change-Id: If7498b293041f2ae00fd93563417d60a0c13e7c9
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 |