| 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 754e8ff4ed1d821fdb973aa4b0e8cde927066e85..7315a5d4e47a5386174d9d3a07eaa927edd4825a 100644
|
| --- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
|
| +++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
|
| @@ -111,6 +111,18 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
|
| Mock::VerifyAndClearExpectations(this);
|
| }
|
|
|
| + // Helper routine to enable/disable metrics report upload settings in policy.
|
| + void SetMetricsReportingSettings(bool enable_metrics_reporting) {
|
| + EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1));
|
| + em::MetricsEnabledProto* proto =
|
| + device_policy_.payload().mutable_metrics_enabled();
|
| + proto->set_metrics_enabled(enable_metrics_reporting);
|
| + device_policy_.Build();
|
| + device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
|
| + ReloadDeviceSettings();
|
| + Mock::VerifyAndClearExpectations(this);
|
| + }
|
| +
|
| // Helper routine to ensure all heartbeat policies have been correctly
|
| // decoded.
|
| void VerifyHeartbeatSettings(bool expected_enable_state,
|
| @@ -241,6 +253,8 @@ TEST_F(DeviceSettingsProviderTest, InitializationTestUnowned) {
|
| }
|
|
|
| TEST_F(DeviceSettingsProviderTest, SetPrefFailed) {
|
| + SetMetricsReportingSettings(false);
|
| +
|
| // If we are not the owner no sets should work.
|
| base::FundamentalValue value(true);
|
| EXPECT_CALL(*this, SettingChanged(kStatsReportingPref)).Times(1);
|
| @@ -366,26 +380,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 =
|
|
|