1 // 2 // Copyright (C) 2014 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_ 18 #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_ 19 20 #include <set> 21 #include <string> 22 23 #include "update_engine/update_manager/device_policy_provider.h" 24 #include "update_engine/update_manager/fake_variable.h" 25 26 namespace chromeos_update_manager { 27 28 // Fake implementation of the DevicePolicyProvider base class. 29 class FakeDevicePolicyProvider : public DevicePolicyProvider { 30 public: 31 FakeDevicePolicyProvider() {} 32 33 FakeVariable<bool>* var_device_policy_is_loaded() override { 34 return &var_device_policy_is_loaded_; 35 } 36 37 FakeVariable<std::string>* var_release_channel() override { 38 return &var_release_channel_; 39 } 40 41 FakeVariable<bool>* var_release_channel_delegated() override { 42 return &var_release_channel_delegated_; 43 } 44 45 FakeVariable<bool>* var_update_disabled() override { 46 return &var_update_disabled_; 47 } 48 49 FakeVariable<std::string>* var_target_version_prefix() override { 50 return &var_target_version_prefix_; 51 } 52 53 FakeVariable<base::TimeDelta>* var_scatter_factor() override { 54 return &var_scatter_factor_; 55 } 56 57 FakeVariable<std::set<chromeos_update_engine::ConnectionType>>* 58 var_allowed_connection_types_for_update() override { 59 return &var_allowed_connection_types_for_update_; 60 } 61 62 FakeVariable<std::string>* var_owner() override { 63 return &var_owner_; 64 } 65 66 FakeVariable<bool>* var_http_downloads_enabled() override { 67 return &var_http_downloads_enabled_; 68 } 69 70 FakeVariable<bool>* var_au_p2p_enabled() override { 71 return &var_au_p2p_enabled_; 72 } 73 74 FakeVariable<bool>* var_allow_kiosk_app_control_chrome_version() override { 75 return &var_allow_kiosk_app_control_chrome_version_; 76 } 77 78 private: 79 FakeVariable<bool> var_device_policy_is_loaded_{ 80 "policy_is_loaded", kVariableModePoll}; 81 FakeVariable<std::string> var_release_channel_{ 82 "release_channel", kVariableModePoll}; 83 FakeVariable<bool> var_release_channel_delegated_{ 84 "release_channel_delegated", kVariableModePoll}; 85 FakeVariable<bool> var_update_disabled_{ 86 "update_disabled", kVariableModePoll}; 87 FakeVariable<std::string> var_target_version_prefix_{ 88 "target_version_prefix", kVariableModePoll}; 89 FakeVariable<base::TimeDelta> var_scatter_factor_{ 90 "scatter_factor", kVariableModePoll}; 91 FakeVariable<std::set<chromeos_update_engine::ConnectionType>> 92 var_allowed_connection_types_for_update_{ 93 "allowed_connection_types_for_update", kVariableModePoll}; 94 FakeVariable<std::string> var_owner_{"owner", kVariableModePoll}; 95 FakeVariable<bool> var_http_downloads_enabled_{ 96 "http_downloads_enabled", kVariableModePoll}; 97 FakeVariable<bool> var_au_p2p_enabled_{"au_p2p_enabled", kVariableModePoll}; 98 FakeVariable<bool> var_allow_kiosk_app_control_chrome_version_{ 99 "allow_kiosk_app_control_chrome_version", kVariableModePoll}; 100 101 DISALLOW_COPY_AND_ASSIGN(FakeDevicePolicyProvider); 102 }; 103 104 } // namespace chromeos_update_manager 105 106 #endif // UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_ 107