shill: Move Metrics from singleton to Shill daemon
While implementing chromium-os:24810, it was discovered that Metrics is
cleaner if it is passed around like ControlInterface, Dispatcher,
Manager, etc. This approach also makes Metrics more testable.
BUG=chromium-os:24810
TEST=Unit tests, network_WiFiManager suite
Change-Id: I556a1bd11f21f0b93ecfeaae8855dfb99ed5e5f9
Reviewed-on: https://gerrit.chromium.org/gerrit/14099
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/profile_unittest.cc b/profile_unittest.cc
index e7ab645..d7ef54f 100644
--- a/profile_unittest.cc
+++ b/profile_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// 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.
@@ -41,6 +41,7 @@
MockService *CreateMockService() {
return new StrictMock<MockService>(control_interface(),
dispatcher(),
+ metrics(),
manager());
}
@@ -180,6 +181,7 @@
TEST_F(ProfileTest, ServiceConfigure) {
ServiceRefPtr service1(new ServiceUnderTest(control_interface(),
dispatcher(),
+ metrics(),
manager()));
service1->set_priority(service1->priority() + 1); // Change from default.
ASSERT_TRUE(profile_->AdoptService(service1));
@@ -189,6 +191,7 @@
// service; ensure that settings from |service1| wind up in |service2|.
ServiceRefPtr service2(new ServiceUnderTest(control_interface(),
dispatcher(),
+ metrics(),
manager()));
int32 orig_priority = service2->priority();
ASSERT_TRUE(profile_->ConfigureService(service2));