AU: disable GPIOs in production; some structural changes

Since we are not making use of the GPIO funcionality in UE for the
moment, it's been advised that it should be disabled. This CL does just
that, plus a few small changes:

* Adds a "no-op" GPIO implementation, which simply returns a constant
  value every time it's being asked whether test-mode was signaled (in
  this case, we set it to return false).

* The GPIO handler is embedded in SystemState. This makes sense from
  both the conceptual and usability standpoint.  The SystemState object
  can be parametrized to initialize either a real or a no-op GPIO
  handler.

BUG=chromium-os:32263
TEST=passes unit tests; does not engage GPIO protocol on x86-alex

Change-Id: I8121647baa7611041073dcf305beddab57c0e49c
Reviewed-on: https://gerrit.chromium.org/gerrit/40633
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/mock_system_state.h b/mock_system_state.h
index bb6ee98..2b17ce4 100644
--- a/mock_system_state.h
+++ b/mock_system_state.h
@@ -10,6 +10,7 @@
 #include <metrics/metrics_library_mock.h>
 #include <policy/mock_device_policy.h>
 
+#include "update_engine/mock_gpio_handler.h"
 #include "update_engine/mock_payload_state.h"
 #include "update_engine/prefs_mock.h"
 #include "update_engine/system_state.h"
@@ -20,49 +21,56 @@
 // OOBE is completed even when there's no such marker file, etc.
 class MockSystemState : public SystemState {
  public:
-  MockSystemState() : prefs_(&mock_prefs_) {
+  inline MockSystemState() : prefs_(&mock_prefs_) {
     mock_payload_state_.Initialize(&mock_prefs_);
+    mock_gpio_handler_ = new testing::NiceMock<MockGpioHandler>();
   }
-  virtual ~MockSystemState() {}
+  inline virtual ~MockSystemState() {
+    delete mock_gpio_handler_;
+  }
 
   MOCK_METHOD0(IsOOBEComplete, bool());
   MOCK_METHOD1(set_device_policy, void(const policy::DevicePolicy*));
   MOCK_CONST_METHOD0(device_policy, const policy::DevicePolicy*());
 
-  virtual ConnectionManager* connection_manager() {
+  inline virtual ConnectionManager* connection_manager() {
     return connection_manager_;
   }
 
-  virtual MetricsLibraryInterface* metrics_lib() {
+  inline virtual MetricsLibraryInterface* metrics_lib() {
     return &mock_metrics_lib_;
   }
 
-  virtual PrefsInterface* prefs() {
+  inline virtual PrefsInterface* prefs() {
     return prefs_;
   }
 
-  virtual PayloadStateInterface* payload_state() {
+  inline virtual PayloadStateInterface* payload_state() {
     return &mock_payload_state_;
   }
 
+  inline virtual GpioHandler* gpio_handler() const {
+    return mock_gpio_handler_;
+  }
+
   // MockSystemState-specific public method.
-  void set_connection_manager(ConnectionManager* connection_manager) {
+  inline void set_connection_manager(ConnectionManager* connection_manager) {
     connection_manager_ = connection_manager;
   }
 
-  MetricsLibraryMock* mock_metrics_lib() {
+  inline MetricsLibraryMock* mock_metrics_lib() {
     return &mock_metrics_lib_;
   }
 
-  void set_prefs(PrefsInterface* prefs) {
+  inline void set_prefs(PrefsInterface* prefs) {
     prefs_ = prefs;
   }
 
-  testing::NiceMock<PrefsMock> *mock_prefs() {
+  inline testing::NiceMock<PrefsMock> *mock_prefs() {
     return &mock_prefs_;
   }
 
-  MockPayloadState* mock_payload_state() {
+  inline MockPayloadState* mock_payload_state() {
     return &mock_payload_state_;
   }
 
@@ -71,6 +79,7 @@
   MetricsLibraryMock mock_metrics_lib_;
   testing::NiceMock<PrefsMock> mock_prefs_;
   testing::NiceMock<MockPayloadState> mock_payload_state_;
+  testing::NiceMock<MockGpioHandler>* mock_gpio_handler_;
 
   // These are pointers to objects which caller can override.
   PrefsInterface* prefs_;