| OLD | NEW |
| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 TestMetricsService service( | 182 TestMetricsService service( |
| 183 GetMetricsStateManager(), &client, GetLocalState()); | 183 GetMetricsStateManager(), &client, GetLocalState()); |
| 184 | 184 |
| 185 TestMetricsProvider* test_provider = new TestMetricsProvider(); | 185 TestMetricsProvider* test_provider = new TestMetricsProvider(); |
| 186 service.RegisterMetricsProvider( | 186 service.RegisterMetricsProvider( |
| 187 std::unique_ptr<MetricsProvider>(test_provider)); | 187 std::unique_ptr<MetricsProvider>(test_provider)); |
| 188 | 188 |
| 189 service.InitializeMetricsRecordingState(); | 189 service.InitializeMetricsRecordingState(); |
| 190 | 190 |
| 191 // No initial stability log should be generated. | 191 // No initial stability log should be generated. |
| 192 EXPECT_FALSE(service.log_store()->has_unsent_logs()); | 192 EXPECT_FALSE(service.has_unsent_logs()); |
| 193 EXPECT_FALSE(service.log_store()->has_staged_log()); | |
| 194 | 193 |
| 195 // Ensure that HasInitialStabilityMetrics() is always called on providers, | 194 // Ensure that HasInitialStabilityMetrics() is always called on providers, |
| 196 // for consistency, even if other conditions already indicate their presence. | 195 // for consistency, even if other conditions already indicate their presence. |
| 197 EXPECT_TRUE(test_provider->has_initial_stability_metrics_called()); | 196 EXPECT_TRUE(test_provider->has_initial_stability_metrics_called()); |
| 198 | 197 |
| 199 // The test provider should not have been called upon to provide initial | 198 // The test provider should not have been called upon to provide initial |
| 200 // stability nor regular stability metrics. | 199 // stability nor regular stability metrics. |
| 201 EXPECT_FALSE(test_provider->provide_initial_stability_metrics_called()); | 200 EXPECT_FALSE(test_provider->provide_initial_stability_metrics_called()); |
| 202 EXPECT_FALSE(test_provider->provide_stability_metrics_called()); | 201 EXPECT_FALSE(test_provider->provide_stability_metrics_called()); |
| 203 } | 202 } |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 client.uploader()->CompleteUpload(200); | 521 client.uploader()->CompleteUpload(200); |
| 523 EXPECT_FALSE(client.uploader()->is_uploading()); | 522 EXPECT_FALSE(client.uploader()->is_uploading()); |
| 524 EXPECT_EQ(1U, task_runner_->NumPendingTasks()); | 523 EXPECT_EQ(1U, task_runner_->NumPendingTasks()); |
| 525 // Upload should start. | 524 // Upload should start. |
| 526 task_runner_->RunPendingTasks(); | 525 task_runner_->RunPendingTasks(); |
| 527 EXPECT_TRUE(client.uploader()->is_uploading()); | 526 EXPECT_TRUE(client.uploader()->is_uploading()); |
| 528 EXPECT_EQ(0U, task_runner_->NumPendingTasks()); | 527 EXPECT_EQ(0U, task_runner_->NumPendingTasks()); |
| 529 } | 528 } |
| 530 | 529 |
| 531 } // namespace metrics | 530 } // namespace metrics |
| OLD | NEW |