fake_device_policy_provider.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. #ifndef UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
  17. #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
  18. #include <set>
  19. #include <string>
  20. #include "update_engine/update_manager/device_policy_provider.h"
  21. #include "update_engine/update_manager/fake_variable.h"
  22. namespace chromeos_update_manager {
  23. // Fake implementation of the DevicePolicyProvider base class.
  24. class FakeDevicePolicyProvider : public DevicePolicyProvider {
  25. public:
  26. FakeDevicePolicyProvider() {}
  27. FakeVariable<bool>* var_device_policy_is_loaded() override {
  28. return &var_device_policy_is_loaded_;
  29. }
  30. FakeVariable<std::string>* var_release_channel() override {
  31. return &var_release_channel_;
  32. }
  33. FakeVariable<bool>* var_release_channel_delegated() override {
  34. return &var_release_channel_delegated_;
  35. }
  36. FakeVariable<bool>* var_update_disabled() override {
  37. return &var_update_disabled_;
  38. }
  39. FakeVariable<std::string>* var_target_version_prefix() override {
  40. return &var_target_version_prefix_;
  41. }
  42. FakeVariable<RollbackToTargetVersion>* var_rollback_to_target_version()
  43. override {
  44. return &var_rollback_to_target_version_;
  45. }
  46. FakeVariable<int>* var_rollback_allowed_milestones() override {
  47. return &var_rollback_allowed_milestones_;
  48. }
  49. FakeVariable<base::TimeDelta>* var_scatter_factor() override {
  50. return &var_scatter_factor_;
  51. }
  52. FakeVariable<std::set<chromeos_update_engine::ConnectionType>>*
  53. var_allowed_connection_types_for_update() override {
  54. return &var_allowed_connection_types_for_update_;
  55. }
  56. FakeVariable<std::string>* var_owner() override { return &var_owner_; }
  57. FakeVariable<bool>* var_http_downloads_enabled() override {
  58. return &var_http_downloads_enabled_;
  59. }
  60. FakeVariable<bool>* var_au_p2p_enabled() override {
  61. return &var_au_p2p_enabled_;
  62. }
  63. FakeVariable<bool>* var_allow_kiosk_app_control_chrome_version() override {
  64. return &var_allow_kiosk_app_control_chrome_version_;
  65. }
  66. FakeVariable<std::string>* var_auto_launched_kiosk_app_id() override {
  67. return &var_auto_launched_kiosk_app_id_;
  68. }
  69. FakeVariable<WeeklyTimeIntervalVector>* var_disallowed_time_intervals()
  70. override {
  71. return &var_disallowed_time_intervals_;
  72. }
  73. private:
  74. FakeVariable<bool> var_device_policy_is_loaded_{"policy_is_loaded",
  75. kVariableModePoll};
  76. FakeVariable<std::string> var_release_channel_{"release_channel",
  77. kVariableModePoll};
  78. FakeVariable<bool> var_release_channel_delegated_{"release_channel_delegated",
  79. kVariableModePoll};
  80. FakeVariable<bool> var_update_disabled_{"update_disabled", kVariableModePoll};
  81. FakeVariable<std::string> var_target_version_prefix_{"target_version_prefix",
  82. kVariableModePoll};
  83. FakeVariable<RollbackToTargetVersion> var_rollback_to_target_version_{
  84. "rollback_to_target_version", kVariableModePoll};
  85. FakeVariable<int> var_rollback_allowed_milestones_{
  86. "rollback_allowed_milestones", kVariableModePoll};
  87. FakeVariable<base::TimeDelta> var_scatter_factor_{"scatter_factor",
  88. kVariableModePoll};
  89. FakeVariable<std::set<chromeos_update_engine::ConnectionType>>
  90. var_allowed_connection_types_for_update_{
  91. "allowed_connection_types_for_update", kVariableModePoll};
  92. FakeVariable<std::string> var_owner_{"owner", kVariableModePoll};
  93. FakeVariable<bool> var_http_downloads_enabled_{"http_downloads_enabled",
  94. kVariableModePoll};
  95. FakeVariable<bool> var_au_p2p_enabled_{"au_p2p_enabled", kVariableModePoll};
  96. FakeVariable<bool> var_allow_kiosk_app_control_chrome_version_{
  97. "allow_kiosk_app_control_chrome_version", kVariableModePoll};
  98. FakeVariable<std::string> var_auto_launched_kiosk_app_id_{
  99. "auto_launched_kiosk_app_id", kVariableModePoll};
  100. FakeVariable<WeeklyTimeIntervalVector> var_disallowed_time_intervals_{
  101. "disallowed_time_intervals", kVariableModePoll};
  102. DISALLOW_COPY_AND_ASSIGN(FakeDevicePolicyProvider);
  103. };
  104. } // namespace chromeos_update_manager
  105. #endif // UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_