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

Unified Diff: components/metrics/metrics_service_unittest.cc

Issue 1985733002: Always check if providers have initial stability metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed order of test expectations Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/metrics/metrics_service.cc ('k') | components/metrics/test_metrics_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/metrics_service_unittest.cc
diff --git a/components/metrics/metrics_service_unittest.cc b/components/metrics/metrics_service_unittest.cc
index a19e27b83a8f47b704fb973c68361f7df10893df..96e62f141c09a3406bde6d999b949f11761c8ba7 100644
--- a/components/metrics/metrics_service_unittest.cc
+++ b/components/metrics/metrics_service_unittest.cc
@@ -176,10 +176,15 @@ TEST_F(MetricsServiceTest, InitialStabilityLogAfterCleanShutDown) {
std::unique_ptr<MetricsProvider>(test_provider));
service.InitializeMetricsRecordingState();
+
// No initial stability log should be generated.
EXPECT_FALSE(service.log_manager()->has_unsent_logs());
EXPECT_FALSE(service.log_manager()->has_staged_log());
+ // Ensure that HasInitialStabilityMetrics() is always called on providers,
+ // for consistency, even if other conditions already indicate their presence.
+ EXPECT_TRUE(test_provider->has_initial_stability_metrics_called());
+
// The test provider should not have been called upon to provide initial
// stability nor regular stability metrics.
EXPECT_FALSE(test_provider->provide_initial_stability_metrics_called());
@@ -222,6 +227,10 @@ TEST_F(MetricsServiceTest, InitialStabilityLogAtProviderRequest) {
EXPECT_TRUE(log_manager->has_unsent_logs());
EXPECT_FALSE(log_manager->has_staged_log());
+ // Ensure that HasInitialStabilityMetrics() is always called on providers,
+ // for consistency, even if other conditions already indicate their presence.
+ EXPECT_TRUE(test_provider->has_initial_stability_metrics_called());
+
// The test provider should have been called upon to provide initial
// stability and regular stability metrics.
EXPECT_TRUE(test_provider->provide_initial_stability_metrics_called());
@@ -286,6 +295,10 @@ TEST_F(MetricsServiceTest, InitialStabilityLogAfterCrash) {
EXPECT_TRUE(log_manager->has_unsent_logs());
EXPECT_FALSE(log_manager->has_staged_log());
+ // Ensure that HasInitialStabilityMetrics() is always called on providers,
+ // for consistency, even if other conditions already indicate their presence.
+ EXPECT_TRUE(test_provider->has_initial_stability_metrics_called());
+
// The test provider should have been called upon to provide initial
// stability and regular stability metrics.
EXPECT_TRUE(test_provider->provide_initial_stability_metrics_called());
« no previous file with comments | « components/metrics/metrics_service.cc ('k') | components/metrics/test_metrics_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698