| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/settings/device_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 proto->set_report_version_info(enable_reporting); | 76 proto->set_report_version_info(enable_reporting); |
| 77 proto->set_report_activity_times(enable_reporting); | 77 proto->set_report_activity_times(enable_reporting); |
| 78 proto->set_report_boot_mode(enable_reporting); | 78 proto->set_report_boot_mode(enable_reporting); |
| 79 proto->set_report_location(enable_reporting); | 79 proto->set_report_location(enable_reporting); |
| 80 proto->set_report_network_interfaces(enable_reporting); | 80 proto->set_report_network_interfaces(enable_reporting); |
| 81 proto->set_report_users(enable_reporting); | 81 proto->set_report_users(enable_reporting); |
| 82 proto->set_report_hardware_status(enable_reporting); | 82 proto->set_report_hardware_status(enable_reporting); |
| 83 proto->set_report_session_status(enable_reporting); | 83 proto->set_report_session_status(enable_reporting); |
| 84 proto->set_report_os_update_status(enable_reporting); | 84 proto->set_report_os_update_status(enable_reporting); |
| 85 proto->set_report_running_kiosk_app(enable_reporting); | 85 proto->set_report_running_kiosk_app(enable_reporting); |
| 86 proto->set_report_sound_volume(enable_reporting); |
| 86 proto->set_device_status_frequency(frequency); | 87 proto->set_device_status_frequency(frequency); |
| 87 device_policy_.Build(); | 88 device_policy_.Build(); |
| 88 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); | 89 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); |
| 89 ReloadDeviceSettings(); | 90 ReloadDeviceSettings(); |
| 90 Mock::VerifyAndClearExpectations(this); | 91 Mock::VerifyAndClearExpectations(this); |
| 91 } | 92 } |
| 92 | 93 |
| 93 // Helper routine to enable/disable all reporting settings in policy. | 94 // Helper routine to enable/disable all reporting settings in policy. |
| 94 void SetHeartbeatSettings(bool enable_heartbeat, int frequency) { | 95 void SetHeartbeatSettings(bool enable_heartbeat, int frequency) { |
| 95 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); | 96 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 kReportDeviceVersionInfo, | 149 kReportDeviceVersionInfo, |
| 149 kReportDeviceActivityTimes, | 150 kReportDeviceActivityTimes, |
| 150 kReportDeviceBootMode, | 151 kReportDeviceBootMode, |
| 151 // Device location reporting is not currently supported. | 152 // Device location reporting is not currently supported. |
| 152 // kReportDeviceLocation, | 153 // kReportDeviceLocation, |
| 153 kReportDeviceNetworkInterfaces, | 154 kReportDeviceNetworkInterfaces, |
| 154 kReportDeviceUsers, | 155 kReportDeviceUsers, |
| 155 kReportDeviceHardwareStatus, | 156 kReportDeviceHardwareStatus, |
| 156 kReportDeviceSessionStatus, | 157 kReportDeviceSessionStatus, |
| 157 kReportOsUpdateStatus, | 158 kReportOsUpdateStatus, |
| 158 kReportRunningKioskApp | 159 kReportRunningKioskApp, |
| 160 kReportSoundVolume |
| 159 }; | 161 }; |
| 160 | 162 |
| 161 const base::Value expected_enable_value(expected_enable_state); | 163 const base::Value expected_enable_value(expected_enable_state); |
| 162 for (auto* setting : reporting_settings) { | 164 for (auto* setting : reporting_settings) { |
| 163 EXPECT_TRUE(base::Value::Equals(provider_->Get(setting), | 165 EXPECT_TRUE(base::Value::Equals(provider_->Get(setting), |
| 164 &expected_enable_value)) | 166 &expected_enable_value)) |
| 165 << "Value for " << setting << " does not match expected"; | 167 << "Value for " << setting << " does not match expected"; |
| 166 } | 168 } |
| 167 const base::Value expected_frequency_value(expected_frequency); | 169 const base::Value expected_frequency_value(expected_frequency); |
| 168 EXPECT_TRUE(base::Value::Equals(provider_->Get(kReportUploadFrequency), | 170 EXPECT_TRUE(base::Value::Equals(provider_->Get(kReportUploadFrequency), |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 } | 485 } |
| 484 | 486 |
| 485 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { | 487 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { |
| 486 SetLogUploadSettings(true); | 488 SetLogUploadSettings(true); |
| 487 VerifyLogUploadSettings(true); | 489 VerifyLogUploadSettings(true); |
| 488 | 490 |
| 489 SetLogUploadSettings(false); | 491 SetLogUploadSettings(false); |
| 490 VerifyLogUploadSettings(false); | 492 VerifyLogUploadSettings(false); |
| 491 } | 493 } |
| 492 } // namespace chromeos | 494 } // namespace chromeos |
| OLD | NEW |