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

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

Issue 2691803002: Remove ScopedVector in //component/metrics (Closed)
Patch Set: code rebase Created 3 years, 10 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 EXPECT_FALSE(test_provider->provide_stability_metrics_called()); 200 EXPECT_FALSE(test_provider->provide_stability_metrics_called());
201 } 201 }
202 202
203 TEST_F(MetricsServiceTest, InitialStabilityLogAtProviderRequest) { 203 TEST_F(MetricsServiceTest, InitialStabilityLogAtProviderRequest) {
204 EnableMetricsReporting(); 204 EnableMetricsReporting();
205 205
206 // Save an existing system profile to prefs, to correspond to what would be 206 // Save an existing system profile to prefs, to correspond to what would be
207 // saved from a previous session. 207 // saved from a previous session.
208 TestMetricsServiceClient client; 208 TestMetricsServiceClient client;
209 TestMetricsLog log("client", 1, &client, GetLocalState()); 209 TestMetricsLog log("client", 1, &client, GetLocalState());
210 log.RecordEnvironment(std::vector<MetricsProvider*>(), 210 log.RecordEnvironment(std::vector<std::unique_ptr<MetricsProvider>>(),
211 std::vector<variations::ActiveGroupId>(), 0, 0); 211 std::vector<variations::ActiveGroupId>(), 0, 0);
212 212
213 // Record stability build time and version from previous session, so that 213 // Record stability build time and version from previous session, so that
214 // stability metrics (including exited cleanly flag) won't be cleared. 214 // stability metrics (including exited cleanly flag) won't be cleared.
215 GetLocalState()->SetInt64(prefs::kStabilityStatsBuildTime, 215 GetLocalState()->SetInt64(prefs::kStabilityStatsBuildTime,
216 MetricsLog::GetBuildTime()); 216 MetricsLog::GetBuildTime());
217 GetLocalState()->SetString(prefs::kStabilityStatsVersion, 217 GetLocalState()->SetString(prefs::kStabilityStatsVersion,
218 client.GetVersionString()); 218 client.GetVersionString());
219 219
220 // Set the clean exit flag, as that will otherwise cause a stabilty 220 // Set the clean exit flag, as that will otherwise cause a stabilty
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 TEST_F(MetricsServiceTest, InitialStabilityLogAfterCrash) { 272 TEST_F(MetricsServiceTest, InitialStabilityLogAfterCrash) {
273 EnableMetricsReporting(); 273 EnableMetricsReporting();
274 GetLocalState()->ClearPref(prefs::kStabilityExitedCleanly); 274 GetLocalState()->ClearPref(prefs::kStabilityExitedCleanly);
275 275
276 // Set up prefs to simulate restarting after a crash. 276 // Set up prefs to simulate restarting after a crash.
277 277
278 // Save an existing system profile to prefs, to correspond to what would be 278 // Save an existing system profile to prefs, to correspond to what would be
279 // saved from a previous session. 279 // saved from a previous session.
280 TestMetricsServiceClient client; 280 TestMetricsServiceClient client;
281 TestMetricsLog log("client", 1, &client, GetLocalState()); 281 TestMetricsLog log("client", 1, &client, GetLocalState());
282 log.RecordEnvironment(std::vector<MetricsProvider*>(), 282 log.RecordEnvironment(std::vector<std::unique_ptr<MetricsProvider>>(),
283 std::vector<variations::ActiveGroupId>(), 0, 0); 283 std::vector<variations::ActiveGroupId>(), 0, 0);
284 284
285 // Record stability build time and version from previous session, so that 285 // Record stability build time and version from previous session, so that
286 // stability metrics (including exited cleanly flag) won't be cleared. 286 // stability metrics (including exited cleanly flag) won't be cleared.
287 GetLocalState()->SetInt64(prefs::kStabilityStatsBuildTime, 287 GetLocalState()->SetInt64(prefs::kStabilityStatsBuildTime,
288 MetricsLog::GetBuildTime()); 288 MetricsLog::GetBuildTime());
289 GetLocalState()->SetString(prefs::kStabilityStatsVersion, 289 GetLocalState()->SetString(prefs::kStabilityStatsVersion,
290 client.GetVersionString()); 290 client.GetVersionString());
291 291
292 GetLocalState()->SetBoolean(prefs::kStabilityExitedCleanly, false); 292 GetLocalState()->SetBoolean(prefs::kStabilityExitedCleanly, false);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 client.uploader()->CompleteUpload(200); 548 client.uploader()->CompleteUpload(200);
549 EXPECT_FALSE(client.uploader()->is_uploading()); 549 EXPECT_FALSE(client.uploader()->is_uploading());
550 EXPECT_EQ(1U, task_runner_->NumPendingTasks()); 550 EXPECT_EQ(1U, task_runner_->NumPendingTasks());
551 // Upload should start. 551 // Upload should start.
552 task_runner_->RunPendingTasks(); 552 task_runner_->RunPendingTasks();
553 EXPECT_TRUE(client.uploader()->is_uploading()); 553 EXPECT_TRUE(client.uploader()->is_uploading());
554 EXPECT_EQ(0U, task_runner_->NumPendingTasks()); 554 EXPECT_EQ(0U, task_runner_->NumPendingTasks());
555 } 555 }
556 556
557 } // namespace metrics 557 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_service.cc ('k') | components/metrics/serialization/serialization_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698