Segregate UMA metrics for production scenarios from test scenarios.

Currently we separate the UMA metrics only by one category: whether the
device is in dev mode or not. In addition, we need to exclude the noise
from these two categories:
1. Most of our testing on MP-signed images which are performed
with autest.
2. All our hwlab tests run in non-dev mode but they use dev-signed images
with dev-firmware keys.

So this CL defines additional bit fields to represent these states and
if any of these three flags are set, the UMA metric is sent to a
DevModeErrorCodes bucket. Thus the NormalErrorCodes bucket will have only
the production errors and thus we can monitor more effectively.

BUG=chromium-os:37613
TEST=Updated unit tests, ran on ZGB for all scenarios.
Change-Id: Id9cce33f09d1cc50cb15e67c731f7548940cbc24
Reviewed-on: https://gerrit.chromium.org/gerrit/41103
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/mock_system_state.h b/mock_system_state.h
index 2b17ce4..956088b 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_dbus_interface.h"
 #include "update_engine/mock_gpio_handler.h"
 #include "update_engine/mock_payload_state.h"
 #include "update_engine/prefs_mock.h"
@@ -17,17 +18,15 @@
 
 namespace chromeos_update_engine {
 
+class UpdateAttempterMock;
+
 // Mock the SystemStateInterface so that we could lie that
 // OOBE is completed even when there's no such marker file, etc.
 class MockSystemState : public SystemState {
  public:
-  inline MockSystemState() : prefs_(&mock_prefs_) {
-    mock_payload_state_.Initialize(&mock_prefs_);
-    mock_gpio_handler_ = new testing::NiceMock<MockGpioHandler>();
-  }
-  inline virtual ~MockSystemState() {
-    delete mock_gpio_handler_;
-  }
+  MockSystemState();
+
+  virtual ~MockSystemState();
 
   MOCK_METHOD0(IsOOBEComplete, bool());
   MOCK_METHOD1(set_device_policy, void(const policy::DevicePolicy*));
@@ -53,6 +52,8 @@
     return mock_gpio_handler_;
   }
 
+  virtual UpdateAttempter* update_attempter();
+
   // MockSystemState-specific public method.
   inline void set_connection_manager(ConnectionManager* connection_manager) {
     connection_manager_ = connection_manager;
@@ -76,10 +77,13 @@
 
  private:
   // These are Mock objects or objects we own.
-  MetricsLibraryMock mock_metrics_lib_;
+  testing::NiceMock<MetricsLibraryMock> mock_metrics_lib_;
   testing::NiceMock<PrefsMock> mock_prefs_;
   testing::NiceMock<MockPayloadState> mock_payload_state_;
   testing::NiceMock<MockGpioHandler>* mock_gpio_handler_;
+  testing::NiceMock<UpdateAttempterMock>* mock_update_attempter_;
+
+  MockDbusGlib dbus_;
 
   // These are pointers to objects which caller can override.
   PrefsInterface* prefs_;