BootControl exposes DynamicPartitionControl.
Add BootControlInterface::GetDynamicPartitionControl, which
exposes the internal DynamicPartitionControlInterface object.
BootControlStub / FakeBootControl / BootControlChromeOS uses
DynamicPartitionControlStub (all functions succeeds).
BootControlAndroid uses DynamicPartitionControlAndroid.
GetPartitionDevice is exposed so that BootControlAndroid can use it.
Follow-up CLs delete duplicated PreparePartitionsForUpdate
and Cleanup from BootControlInterface so that BootControlAndroid remains
a thin wrapper of the HAL (+GetPartitionDevice, which exists before
dynamic partitions.)
Test: update_engine_unittests
Change-Id: Ifc2aa2ee8a63ef581c8ebc562ec158794ac51dfd
diff --git a/common/fake_boot_control.h b/common/fake_boot_control.h
index 11810d1..1d6d979 100644
--- a/common/fake_boot_control.h
+++ b/common/fake_boot_control.h
@@ -18,12 +18,14 @@
#define UPDATE_ENGINE_COMMON_FAKE_BOOT_CONTROL_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include <base/time/time.h>
#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/dynamic_partition_control_stub.h"
namespace chromeos_update_engine {
@@ -34,6 +36,8 @@
SetNumSlots(num_slots_);
// The current slot should be bootable.
is_bootable_[current_slot_] = true;
+
+ dynamic_partition_control_.reset(new DynamicPartitionControlStub());
}
// BootControlInterface overrides.
@@ -103,6 +107,10 @@
is_bootable_[slot] = bootable;
}
+ DynamicPartitionControlInterface* GetDynamicPartitionControl() {
+ return dynamic_partition_control_.get();
+ }
+
private:
BootControlInterface::Slot num_slots_{2};
BootControlInterface::Slot current_slot_{0};
@@ -110,6 +118,8 @@
std::vector<bool> is_bootable_;
std::vector<std::map<std::string, std::string>> devices_;
+ std::unique_ptr<DynamicPartitionControlInterface> dynamic_partition_control_;
+
DISALLOW_COPY_AND_ASSIGN(FakeBootControl);
};