| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/metrics/metrics_service.h" | 5 #include "chrome/browser/metrics/metrics_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 TEST_F(MetricsServiceTest, InitialStabilityLogAfterCrash) { | 187 TEST_F(MetricsServiceTest, InitialStabilityLogAfterCrash) { |
| 188 EnableMetricsReporting(); | 188 EnableMetricsReporting(); |
| 189 GetLocalState()->ClearPref(prefs::kStabilityExitedCleanly); | 189 GetLocalState()->ClearPref(prefs::kStabilityExitedCleanly); |
| 190 | 190 |
| 191 // Set up prefs to simulate restarting after a crash. | 191 // Set up prefs to simulate restarting after a crash. |
| 192 | 192 |
| 193 // Save an existing system profile to prefs, to correspond to what would be | 193 // Save an existing system profile to prefs, to correspond to what would be |
| 194 // saved from a previous session. | 194 // saved from a previous session. |
| 195 TestMetricsLog log("client", 1); | 195 TestMetricsLog log("client", 1); |
| 196 log.RecordEnvironment(std::vector<content::WebPluginInfo>(), | 196 log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>(), |
| 197 std::vector<content::WebPluginInfo>(), |
| 197 GoogleUpdateMetrics(), | 198 GoogleUpdateMetrics(), |
| 198 std::vector<chrome_variations::ActiveGroupId>()); | 199 std::vector<chrome_variations::ActiveGroupId>()); |
| 199 | 200 |
| 200 // Record stability build time and version from previous session, so that | 201 // Record stability build time and version from previous session, so that |
| 201 // stability metrics (including exited cleanly flag) won't be cleared. | 202 // stability metrics (including exited cleanly flag) won't be cleared. |
| 202 GetLocalState()->SetInt64(prefs::kStabilityStatsBuildTime, | 203 GetLocalState()->SetInt64(prefs::kStabilityStatsBuildTime, |
| 203 MetricsLog::GetBuildTime()); | 204 MetricsLog::GetBuildTime()); |
| 204 GetLocalState()->SetString(prefs::kStabilityStatsVersion, | 205 GetLocalState()->SetString(prefs::kStabilityStatsVersion, |
| 205 MetricsLog::GetVersionString()); | 206 MetricsLog::GetVersionString()); |
| 206 | 207 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 355 |
| 355 service.RemoveObserver(&observer1); | 356 service.RemoveObserver(&observer1); |
| 356 | 357 |
| 357 service.OpenNewLog(); | 358 service.OpenNewLog(); |
| 358 EXPECT_EQ(2, observer1.observed()); | 359 EXPECT_EQ(2, observer1.observed()); |
| 359 EXPECT_EQ(2, observer2.observed()); | 360 EXPECT_EQ(2, observer2.observed()); |
| 360 service.log_manager_.FinishCurrentLog(); | 361 service.log_manager_.FinishCurrentLog(); |
| 361 | 362 |
| 362 service.RemoveObserver(&observer2); | 363 service.RemoveObserver(&observer2); |
| 363 } | 364 } |
| OLD | NEW |