update_engine: added CanRollback dbus method
Added a method to the update engine to check if a rollback
partition is available and can be booted from.
update_engine_client is also updated to call the function
when --can_rollback paramater is specified
BUG=chromium:343301
TEST=Ran "update_engine_client --can_rollback" and unit tests
Change-Id: If3fcb29a0067069a22812f60e9b67c6fdbbd18bd
Reviewed-on: https://chromium-review.googlesource.com/187157
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/mock_hardware.h b/mock_hardware.h
index 6a27488..8257b91 100644
--- a/mock_hardware.h
+++ b/mock_hardware.h
@@ -22,6 +22,9 @@
ON_CALL(*this, BootDevice())
.WillByDefault(testing::Invoke(&fake_,
&FakeHardware::BootDevice));
+ ON_CALL(*this, GetKernelDevices())
+ .WillByDefault(testing::Invoke(&fake_,
+ &FakeHardware::GetKernelDevices));
ON_CALL(*this, IsKernelBootable(testing::_, testing::_))
.WillByDefault(testing::Invoke(&fake_,
&FakeHardware::IsKernelBootable));
@@ -50,6 +53,7 @@
// Hardware overrides.
MOCK_METHOD0(BootKernelDevice, const std::string());
MOCK_METHOD0(BootDevice, const std::string());
+ MOCK_METHOD0(GetKernelDevices, std::vector<std::string>());
MOCK_METHOD2(IsKernelBootable,
bool(const std::string& kernel_device, bool* bootable));
MOCK_METHOD1(MarkKernelUnbootable,