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: FakeDevicePolicyProvider()31 FakeDevicePolicyProvider() {} 32 var_device_policy_is_loaded()33 FakeVariable<bool>* var_device_policy_is_loaded() override { 34 return &var_device_policy_is_loaded_; 35 } 36 var_release_channel()37 FakeVariable<std::string>* var_release_channel() override { 38 return &var_release_channel_; 39 } 40 var_release_channel_delegated()41 FakeVariable<bool>* var_release_channel_delegated() override { 42 return &var_release_channel_delegated_; 43 } 44 var_update_disabled()45 FakeVariable<bool>* var_update_disabled() override { 46 return &var_update_disabled_; 47 } 48 var_target_version_prefix()49 FakeVariable<std::string>* var_target_version_prefix() override { 50 return &var_target_version_prefix_; 51 } 52 var_scatter_factor()53 FakeVariable<base::TimeDelta>* var_scatter_factor() override { 54 return &var_scatter_factor_; 55 } 56 57 FakeVariable<std::set<ConnectionType>>* var_allowed_connection_types_for_update()58 var_allowed_connection_types_for_update() override { 59 return &var_allowed_connection_types_for_update_; 60 } 61 var_owner()62 FakeVariable<std::string>* var_owner() override { 63 return &var_owner_; 64 } 65 var_http_downloads_enabled()66 FakeVariable<bool>* var_http_downloads_enabled() override { 67 return &var_http_downloads_enabled_; 68 } 69 var_au_p2p_enabled()70 FakeVariable<bool>* var_au_p2p_enabled() override { 71 return &var_au_p2p_enabled_; 72 } 73 74 private: 75 FakeVariable<bool> var_device_policy_is_loaded_{ 76 "policy_is_loaded", kVariableModePoll}; 77 FakeVariable<std::string> var_release_channel_{ 78 "release_channel", kVariableModePoll}; 79 FakeVariable<bool> var_release_channel_delegated_{ 80 "release_channel_delegated", kVariableModePoll}; 81 FakeVariable<bool> var_update_disabled_{ 82 "update_disabled", kVariableModePoll}; 83 FakeVariable<std::string> var_target_version_prefix_{ 84 "target_version_prefix", kVariableModePoll}; 85 FakeVariable<base::TimeDelta> var_scatter_factor_{ 86 "scatter_factor", kVariableModePoll}; 87 FakeVariable<std::set<ConnectionType>> 88 var_allowed_connection_types_for_update_{ 89 "allowed_connection_types_for_update", kVariableModePoll}; 90 FakeVariable<std::string> var_owner_{"owner", kVariableModePoll}; 91 FakeVariable<bool> var_http_downloads_enabled_{ 92 "http_downloads_enabled", kVariableModePoll}; 93 FakeVariable<bool> var_au_p2p_enabled_{"au_p2p_enabled", kVariableModePoll}; 94 95 DISALLOW_COPY_AND_ASSIGN(FakeDevicePolicyProvider); 96 }; 97 98 } // namespace chromeos_update_manager 99 100 #endif // UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_ 101