update_engine: New BootControlInterface class.

The new BootControlInterface class is a platform-independent
abstraction to control the bootloader. It provides methods for setting
what partition slots are available for booting and getting the
bootloader status about the available slots.

The Chrome OS specific implementation of the bootloader was moved to
the BootControlChromeOS which now depends on the vboot_host
implementation used in Chrome OS. Follow up CL will implement the
equivalent class for Brillo.

BUG=b:23010637
TEST=unittests; cros flash from the new image and rolled back from it.

Change-Id: I0a03aeeb8c21d8c99e1866b625e6e8c96628215b
diff --git a/fake_system_state.h b/fake_system_state.h
index 59d25b6..30ba7e9 100644
--- a/fake_system_state.h
+++ b/fake_system_state.h
@@ -24,6 +24,7 @@
 #include "metrics/metrics_library_mock.h"
 #include "power_manager/dbus-proxies.h"
 #include "power_manager/dbus-proxy-mocks.h"
+#include "update_engine/fake_boot_control.h"
 #include "update_engine/fake_clock.h"
 #include "update_engine/fake_hardware.h"
 #include "update_engine/mock_connection_manager.h"
@@ -47,6 +48,8 @@
   // various members, either the default (fake/mock) or the one set to override
   // it by client code.
 
+  BootControlInterface* boot_control() override { return boot_control_; }
+
   inline ClockInterface* clock() override { return clock_; }
 
   inline void set_device_policy(
@@ -103,6 +106,10 @@
   // implementations. For convenience, setting to a null pointer will restore
   // the default implementation.
 
+  void set_boot_control(BootControlInterface* boot_control) {
+    boot_control_ = boot_control ? boot_control : &fake_boot_control_;
+  }
+
   inline void set_clock(ClockInterface* clock) {
     clock_ = clock ? clock : &fake_clock_;
   }
@@ -162,6 +169,11 @@
   // whenever the requested default was overridden by a different
   // implementation.
 
+  inline FakeBootControl* fake_boot_control() {
+    CHECK(boot_control_ == &fake_boot_control_);
+    return &fake_boot_control_;
+  }
+
   inline FakeClock* fake_clock() {
     CHECK(clock_ == &fake_clock_);
     return &fake_clock_;
@@ -219,6 +231,7 @@
 
  private:
   // Default mock/fake implementations (owned).
+  FakeBootControl fake_boot_control_;
   FakeClock fake_clock_;
   testing::NiceMock<MockConnectionManager> mock_connection_manager_;
   FakeHardware fake_hardware_;
@@ -234,6 +247,7 @@
 
   // Pointers to objects that client code can override. They are initialized to
   // the default implementations above.
+  BootControlInterface* boot_control_{&fake_boot_control_};
   ClockInterface* clock_;
   ConnectionManagerInterface* connection_manager_;
   HardwareInterface* hardware_;