diff options
author | Yifan Hong <elsk@google.com> | 2019-09-16 13:18:22 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2019-09-23 19:38:27 -0700 |
commit | 13d41cb2accc1e2e1271b22a53f0dce6db0493f5 (patch) | |
tree | a3f1a02ee80743e96abdd8be437411402b02b16d /boot_control_android_unittest.cc | |
parent | 87ea73fe5a48c54ad56ba769375d180d1ce5c614 (diff) |
[REFACTOR] Pass DeltaArchiveManifest to DynamicPartitionControl
DynamicPartitionControl need the list of operations to calculate
COW sizes.
- Remove BootControlInterface::PartitionMetadata. Replace all references
with DeltaArchiveManifest. DeltaArchiveManifest has all information
that PartitionMetadata has.
- Rename all InitPartitionMetadata to PreparePartitionsForUpdate
- Change all PreparePartitionsForUpdate to use new signature
Bug: 138816109
Test: update_enigne_unittests --gtest_filter=*BootControl*:*Dynamic*
Change-Id: I4389ba2b1801addf8c3bc8395e2ea6a9a3ed27a0
Diffstat (limited to 'boot_control_android_unittest.cc')
-rw-r--r-- | boot_control_android_unittest.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/boot_control_android_unittest.cc b/boot_control_android_unittest.cc index 3b921912..f090de2f 100644 --- a/boot_control_android_unittest.cc +++ b/boot_control_android_unittest.cc @@ -102,7 +102,7 @@ class BootControlAndroidTest : public ::testing::Test { LoadMetadataBuilder(GetSuperDevice(slot), slot)) .Times(AnyNumber()) .WillRepeatedly(Invoke([sizes](auto, auto) { - return NewFakeMetadata(PartitionSuffixSizesToMetadata(sizes)); + return NewFakeMetadata(PartitionSuffixSizesToManifest(sizes)); })); } @@ -125,11 +125,11 @@ class BootControlAndroidTest : public ::testing::Test { })); } - bool InitPartitionMetadata(uint32_t slot, - PartitionSizes partition_sizes, - bool update_metadata = true) { - auto m = PartitionSizesToMetadata(partition_sizes); - return bootctl_.InitPartitionMetadata(slot, m, update_metadata); + bool PreparePartitionsForUpdate(uint32_t slot, + PartitionSizes partition_sizes, + bool update_metadata = true) { + auto m = PartitionSizesToManifest(partition_sizes); + return bootctl_.PreparePartitionsForUpdate(slot, m, update_metadata); } BootControlAndroid bootctl_; // BootControlAndroid under test. @@ -155,9 +155,9 @@ TEST_P(BootControlAndroidTestP, {T("system"), 2_GiB}, {T("vendor"), 1_GiB}}); - // Not calling through BootControlAndroidTest::InitPartitionMetadata(), since - // we don't want any default group in the PartitionMetadata. - EXPECT_TRUE(bootctl_.InitPartitionMetadata(target(), {}, true)); + // Not calling through BootControlAndroidTest::PreparePartitionsForUpdate(), + // since we don't want any default group in the PartitionMetadata. + EXPECT_TRUE(bootctl_.PreparePartitionsForUpdate(target(), {}, true)); // Should use dynamic source partitions. EXPECT_CALL(dynamicControl(), GetState(S("system"))) @@ -197,7 +197,7 @@ TEST_P(BootControlAndroidTestP, GetPartitionDeviceWhenResumingUpdate) { {T("system"), 2_GiB}, {T("vendor"), 1_GiB}}); - EXPECT_TRUE(InitPartitionMetadata( + EXPECT_TRUE(PreparePartitionsForUpdate( target(), {{"system", 2_GiB}, {"vendor", 1_GiB}}, false)); // Dynamic partition "system". @@ -240,7 +240,7 @@ INSTANTIATE_TEST_CASE_P(BootControlAndroidTest, TEST_F(BootControlAndroidTest, ApplyingToCurrentSlot) { SetSlots({1, 1}); - EXPECT_FALSE(InitPartitionMetadata(target(), {})) + EXPECT_FALSE(PreparePartitionsForUpdate(target(), {})) << "Should not be able to apply to current slot."; } |