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.cc b/mock_system_state.cc
new file mode 100644
index 0000000..13017b9
--- /dev/null
+++ b/mock_system_state.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "update_engine/mock_system_state.h"
+#include "update_engine/update_attempter_mock.h"
+
+namespace chromeos_update_engine {
+
+// Mock the SystemStateInterface so that we could lie that
+// OOBE is completed even when there's no such marker file, etc.
+MockSystemState::MockSystemState() : prefs_(&mock_prefs_) {
+ mock_payload_state_.Initialize(&mock_prefs_);
+ mock_gpio_handler_ = new testing::NiceMock<MockGpioHandler>();
+ mock_update_attempter_ = new testing::NiceMock<UpdateAttempterMock>(
+ this, &dbus_);
+}
+
+MockSystemState::~MockSystemState() {
+ delete mock_gpio_handler_;
+}
+
+UpdateAttempter* MockSystemState::update_attempter() {
+ return mock_update_attempter_;
+}
+
+} // namespeace chromeos_update_engine
+