| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class DeviceSettingsProviderTest : public DeviceSettingsTestBase { | 45 class DeviceSettingsProviderTest : public DeviceSettingsTestBase { |
| 46 public: | 46 public: |
| 47 MOCK_METHOD1(SettingChanged, void(const std::string&)); | 47 MOCK_METHOD1(SettingChanged, void(const std::string&)); |
| 48 MOCK_METHOD0(GetTrustedCallback, void(void)); | 48 MOCK_METHOD0(GetTrustedCallback, void(void)); |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 DeviceSettingsProviderTest() | 51 DeviceSettingsProviderTest() |
| 52 : local_state_(TestingBrowserProcess::GetGlobal()), | 52 : local_state_(TestingBrowserProcess::GetGlobal()), |
| 53 user_data_dir_override_(chrome::DIR_USER_DATA) {} | 53 user_data_dir_override_(chrome::DIR_USER_DATA) {} |
| 54 | 54 |
| 55 virtual void SetUp() override { | 55 void SetUp() override { |
| 56 DeviceSettingsTestBase::SetUp(); | 56 DeviceSettingsTestBase::SetUp(); |
| 57 | 57 |
| 58 EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber()); | 58 EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber()); |
| 59 provider_.reset( | 59 provider_.reset( |
| 60 new DeviceSettingsProvider( | 60 new DeviceSettingsProvider( |
| 61 base::Bind(&DeviceSettingsProviderTest::SettingChanged, | 61 base::Bind(&DeviceSettingsProviderTest::SettingChanged, |
| 62 base::Unretained(this)), | 62 base::Unretained(this)), |
| 63 &device_settings_service_)); | 63 &device_settings_service_)); |
| 64 Mock::VerifyAndClearExpectations(this); | 64 Mock::VerifyAndClearExpectations(this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void TearDown() override { | 67 void TearDown() override { DeviceSettingsTestBase::TearDown(); } |
| 68 DeviceSettingsTestBase::TearDown(); | |
| 69 } | |
| 70 | 68 |
| 71 // Helper routine to enable/disable all reporting settings in policy. | 69 // Helper routine to enable/disable all reporting settings in policy. |
| 72 void SetReportingSettings(bool enable_reporting, int frequency) { | 70 void SetReportingSettings(bool enable_reporting, int frequency) { |
| 73 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); | 71 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); |
| 74 em::DeviceReportingProto* proto = | 72 em::DeviceReportingProto* proto = |
| 75 device_policy_.payload().mutable_device_reporting(); | 73 device_policy_.payload().mutable_device_reporting(); |
| 76 proto->set_report_version_info(enable_reporting); | 74 proto->set_report_version_info(enable_reporting); |
| 77 proto->set_report_activity_times(enable_reporting); | 75 proto->set_report_activity_times(enable_reporting); |
| 78 proto->set_report_boot_mode(enable_reporting); | 76 proto->set_report_boot_mode(enable_reporting); |
| 79 proto->set_report_location(enable_reporting); | 77 proto->set_report_location(enable_reporting); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 VerifyDomainAutoComplete(nullptr); | 472 VerifyDomainAutoComplete(nullptr); |
| 475 | 473 |
| 476 // Check some meaningful value. Policy should be set. | 474 // Check some meaningful value. Policy should be set. |
| 477 const std::string domain = "domain.test"; | 475 const std::string domain = "domain.test"; |
| 478 const base::StringValue domain_value(domain); | 476 const base::StringValue domain_value(domain); |
| 479 SetDomainAutoComplete(domain); | 477 SetDomainAutoComplete(domain); |
| 480 VerifyDomainAutoComplete(&domain_value); | 478 VerifyDomainAutoComplete(&domain_value); |
| 481 } | 479 } |
| 482 | 480 |
| 483 } // namespace chromeos | 481 } // namespace chromeos |
| OLD | NEW |