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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 em::DeviceReportingProto* proto = | 73 em::DeviceReportingProto* proto = |
74 device_policy_.payload().mutable_device_reporting(); | 74 device_policy_.payload().mutable_device_reporting(); |
75 proto->set_report_version_info(enable_reporting); | 75 proto->set_report_version_info(enable_reporting); |
76 proto->set_report_activity_times(enable_reporting); | 76 proto->set_report_activity_times(enable_reporting); |
77 proto->set_report_boot_mode(enable_reporting); | 77 proto->set_report_boot_mode(enable_reporting); |
78 proto->set_report_location(enable_reporting); | 78 proto->set_report_location(enable_reporting); |
79 proto->set_report_network_interfaces(enable_reporting); | 79 proto->set_report_network_interfaces(enable_reporting); |
80 proto->set_report_users(enable_reporting); | 80 proto->set_report_users(enable_reporting); |
81 proto->set_report_hardware_status(enable_reporting); | 81 proto->set_report_hardware_status(enable_reporting); |
82 proto->set_report_session_status(enable_reporting); | 82 proto->set_report_session_status(enable_reporting); |
| 83 proto->set_report_os_update_status(enable_reporting); |
| 84 proto->set_report_running_kiosk_app(enable_reporting); |
83 proto->set_device_status_frequency(frequency); | 85 proto->set_device_status_frequency(frequency); |
84 device_policy_.Build(); | 86 device_policy_.Build(); |
85 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); | 87 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); |
86 ReloadDeviceSettings(); | 88 ReloadDeviceSettings(); |
87 Mock::VerifyAndClearExpectations(this); | 89 Mock::VerifyAndClearExpectations(this); |
88 } | 90 } |
89 | 91 |
90 // Helper routine to enable/disable all reporting settings in policy. | 92 // Helper routine to enable/disable all reporting settings in policy. |
91 void SetHeartbeatSettings(bool enable_heartbeat, int frequency) { | 93 void SetHeartbeatSettings(bool enable_heartbeat, int frequency) { |
92 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); | 94 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 int expected_frequency) { | 146 int expected_frequency) { |
145 const char* reporting_settings[] = { | 147 const char* reporting_settings[] = { |
146 kReportDeviceVersionInfo, | 148 kReportDeviceVersionInfo, |
147 kReportDeviceActivityTimes, | 149 kReportDeviceActivityTimes, |
148 kReportDeviceBootMode, | 150 kReportDeviceBootMode, |
149 // Device location reporting is not currently supported. | 151 // Device location reporting is not currently supported. |
150 // kReportDeviceLocation, | 152 // kReportDeviceLocation, |
151 kReportDeviceNetworkInterfaces, | 153 kReportDeviceNetworkInterfaces, |
152 kReportDeviceUsers, | 154 kReportDeviceUsers, |
153 kReportDeviceHardwareStatus, | 155 kReportDeviceHardwareStatus, |
154 kReportDeviceSessionStatus | 156 kReportDeviceSessionStatus, |
| 157 kReportOsUpdateStatus, |
| 158 kReportRunningKioskApp |
155 }; | 159 }; |
156 | 160 |
157 const base::FundamentalValue expected_enable_value(expected_enable_state); | 161 const base::FundamentalValue expected_enable_value(expected_enable_state); |
158 for (const auto& setting : reporting_settings) { | 162 for (const auto& setting : reporting_settings) { |
159 EXPECT_TRUE(base::Value::Equals(provider_->Get(setting), | 163 EXPECT_TRUE(base::Value::Equals(provider_->Get(setting), |
160 &expected_enable_value)) | 164 &expected_enable_value)) |
161 << "Value for " << setting << " does not match expected"; | 165 << "Value for " << setting << " does not match expected"; |
162 } | 166 } |
163 const base::FundamentalValue expected_frequency_value(expected_frequency); | 167 const base::FundamentalValue expected_frequency_value(expected_frequency); |
164 EXPECT_TRUE(base::Value::Equals(provider_->Get(kReportUploadFrequency), | 168 EXPECT_TRUE(base::Value::Equals(provider_->Get(kReportUploadFrequency), |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 502 } |
499 | 503 |
500 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { | 504 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { |
501 SetLogUploadSettings(true); | 505 SetLogUploadSettings(true); |
502 VerifyLogUploadSettings(true); | 506 VerifyLogUploadSettings(true); |
503 | 507 |
504 SetLogUploadSettings(false); | 508 SetLogUploadSettings(false); |
505 VerifyLogUploadSettings(false); | 509 VerifyLogUploadSettings(false); |
506 } | 510 } |
507 } // namespace chromeos | 511 } // namespace chromeos |
OLD | NEW |