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

Unified Diff: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc

Issue 1411863002: Use kMetricsReportingEnabled instead of kStatsReporingPref on metrics side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests Created 5 years, 2 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
Index: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
index e02000cb55667939bea3334d9a10f28f836f6258..0d9f7e043bdf838b58f7c9333e6057d66d15be03 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -241,6 +241,9 @@ TEST_F(DeviceSettingsProviderTest, InitializationTestUnowned) {
}
TEST_F(DeviceSettingsProviderTest, SetPrefFailed) {
+ // Initialize pref.
+ provider_->SetPrefForTesting(kStatsReportingPref, false);
Mattias Nissler (ping if slow) 2015/10/28 09:51:15 This seems fishy - what failure do you get if you
gayane -on leave until 09-2017 2015/10/28 15:00:07 The problem I had was that the test will fail at l
Mattias Nissler (ping if slow) 2015/10/29 10:06:14 OK, I get it now. The previous code would set kSta
+
// If we are not the owner no sets should work.
base::FundamentalValue value(true);
EXPECT_CALL(*this, SettingChanged(kStatsReportingPref)).Times(1);
@@ -364,26 +367,6 @@ TEST_F(DeviceSettingsProviderTest, PolicyLoadNotification) {
Mock::VerifyAndClearExpectations(this);
}
-TEST_F(DeviceSettingsProviderTest, StatsReportingMigration) {
- // Create the legacy consent file.
- base::FilePath consent_file;
- ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_file));
- consent_file = consent_file.AppendASCII("Consent To Send Stats");
- ASSERT_EQ(1, base::WriteFile(consent_file, "0", 1));
-
- // This should trigger migration because the metrics policy isn't in the blob.
- device_settings_test_helper_.set_policy_blob(std::string());
- FlushDeviceSettings();
- EXPECT_EQ(std::string(), device_settings_test_helper_.policy_blob());
-
- // Verify that migration has kicked in.
- const base::Value* saved_value = provider_->Get(kStatsReportingPref);
- ASSERT_TRUE(saved_value);
- bool bool_value;
- EXPECT_TRUE(saved_value->GetAsBoolean(&bool_value));
- EXPECT_FALSE(bool_value);
-}
-
TEST_F(DeviceSettingsProviderTest, LegacyDeviceLocalAccounts) {
EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber());
em::DeviceLocalAccountInfoProto* account =

Powered by Google App Engine
This is Rietveld 408576698