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

Unified Diff: components/metrics/metrics_log_unittest.cc

Issue 2296543002: Quantify initial stability report edge cases. (Closed)
Patch Set: Change a metric's name Created 4 years, 3 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_log.cc ('k') | components/metrics/metrics_pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/metrics_log_unittest.cc
diff --git a/components/metrics/metrics_log_unittest.cc b/components/metrics/metrics_log_unittest.cc
index 807328cb1da4bfab270afc0395d816878ce7b71d..57a1209f1adfe809dee1b014bff7da3596ea43fb 100644
--- a/components/metrics/metrics_log_unittest.cc
+++ b/components/metrics/metrics_log_unittest.cc
@@ -276,12 +276,15 @@ TEST_F(MetricsLogTest, LoadSavedEnvironmentFromPrefs) {
prefs::kStabilitySavedSystemProfileHash;
TestMetricsServiceClient client;
+ client.set_version_string("bogus version");
// The pref value is empty, so loading it from prefs should fail.
{
TestMetricsLog log(
kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_);
- EXPECT_FALSE(log.LoadSavedEnvironmentFromPrefs());
+ std::string app_version;
+ EXPECT_FALSE(log.LoadSavedEnvironmentFromPrefs(&app_version));
+ EXPECT_TRUE(app_version.empty());
}
// Do a RecordEnvironment() call and check whether the pref is recorded.
@@ -298,7 +301,9 @@ TEST_F(MetricsLogTest, LoadSavedEnvironmentFromPrefs) {
{
TestMetricsLog log(
kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_);
- EXPECT_TRUE(log.LoadSavedEnvironmentFromPrefs());
+ std::string app_version;
+ EXPECT_TRUE(log.LoadSavedEnvironmentFromPrefs(&app_version));
+ EXPECT_EQ("bogus version", app_version);
// Check some values in the system profile.
EXPECT_EQ(kInstallDateExpected, log.system_profile().install_date());
EXPECT_EQ(kEnabledDateExpected, log.system_profile().uma_enabled_date());
@@ -322,7 +327,9 @@ TEST_F(MetricsLogTest, LoadSavedEnvironmentFromPrefs) {
prefs_.SetString(kSystemProfileHashPref, "deadbeef");
TestMetricsLog log(
kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_);
- EXPECT_FALSE(log.LoadSavedEnvironmentFromPrefs());
+ std::string app_version;
+ EXPECT_FALSE(log.LoadSavedEnvironmentFromPrefs(&app_version));
+ EXPECT_TRUE(app_version.empty());
// Ensure that the prefs are cleared, even if the call failed.
EXPECT_TRUE(prefs_.GetString(kSystemProfilePref).empty());
EXPECT_TRUE(prefs_.GetString(kSystemProfileHashPref).empty());
« no previous file with comments | « components/metrics/metrics_log.cc ('k') | components/metrics/metrics_pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698