Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: components/metrics/metrics_service_unittest.cc

Issue 370813003: Move kInstallDate from chrome/common/pref_names.h to components/metrics/metrics_pref_names.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review:isherman Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/metrics_service.h" 5 #include "components/metrics/metrics_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 EnableMetricsReporting(); 154 EnableMetricsReporting();
155 GetLocalState()->ClearPref(metrics::prefs::kStabilityExitedCleanly); 155 GetLocalState()->ClearPref(metrics::prefs::kStabilityExitedCleanly);
156 156
157 // Set up prefs to simulate restarting after a crash. 157 // Set up prefs to simulate restarting after a crash.
158 158
159 // Save an existing system profile to prefs, to correspond to what would be 159 // Save an existing system profile to prefs, to correspond to what would be
160 // saved from a previous session. 160 // saved from a previous session.
161 metrics::TestMetricsServiceClient client; 161 metrics::TestMetricsServiceClient client;
162 TestMetricsLog log("client", 1, &client, GetLocalState()); 162 TestMetricsLog log("client", 1, &client, GetLocalState());
163 log.RecordEnvironment(std::vector<metrics::MetricsProvider*>(), 163 log.RecordEnvironment(std::vector<metrics::MetricsProvider*>(),
164 std::vector<variations::ActiveGroupId>()); 164 std::vector<variations::ActiveGroupId>(),
165 0);
165 166
166 // Record stability build time and version from previous session, so that 167 // Record stability build time and version from previous session, so that
167 // stability metrics (including exited cleanly flag) won't be cleared. 168 // stability metrics (including exited cleanly flag) won't be cleared.
168 GetLocalState()->SetInt64(metrics::prefs::kStabilityStatsBuildTime, 169 GetLocalState()->SetInt64(metrics::prefs::kStabilityStatsBuildTime,
169 MetricsLog::GetBuildTime()); 170 MetricsLog::GetBuildTime());
170 GetLocalState()->SetString(metrics::prefs::kStabilityStatsVersion, 171 GetLocalState()->SetString(metrics::prefs::kStabilityStatsVersion,
171 client.GetVersionString()); 172 client.GetVersionString());
172 173
173 GetLocalState()->SetBoolean(metrics::prefs::kStabilityExitedCleanly, false); 174 GetLocalState()->SetBoolean(metrics::prefs::kStabilityExitedCleanly, false);
174 175
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 296
296 service.RemoveObserver(&observer1); 297 service.RemoveObserver(&observer1);
297 298
298 service.OpenNewLog(); 299 service.OpenNewLog();
299 EXPECT_EQ(2, observer1.observed()); 300 EXPECT_EQ(2, observer1.observed());
300 EXPECT_EQ(2, observer2.observed()); 301 EXPECT_EQ(2, observer2.observed());
301 service.log_manager_.FinishCurrentLog(); 302 service.log_manager_.FinishCurrentLog();
302 303
303 service.RemoveObserver(&observer2); 304 service.RemoveObserver(&observer2);
304 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698