Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 1 | // Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_UPDATER_PROVIDER_H_ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_UPDATER_PROVIDER_H_ |
| 7 | |
| 8 | #include "update_engine/policy_manager/fake_variable.h" |
| 9 | #include "update_engine/policy_manager/updater_provider.h" |
| 10 | |
| 11 | namespace chromeos_policy_manager { |
| 12 | |
| 13 | // Fake implementation of the UpdaterProvider base class. |
| 14 | class FakeUpdaterProvider : public UpdaterProvider { |
| 15 | public: |
| 16 | FakeUpdaterProvider() {} |
| 17 | |
| 18 | virtual FakeVariable<base::Time>* var_last_checked_time() override { |
| 19 | return &var_last_checked_time_; |
| 20 | } |
| 21 | |
| 22 | virtual FakeVariable<base::Time>* var_update_completed_time() override { |
| 23 | return &var_update_completed_time_; |
| 24 | } |
| 25 | |
| 26 | virtual FakeVariable<double>* var_progress() override { |
| 27 | return &var_progress_; |
| 28 | } |
| 29 | |
| 30 | virtual FakeVariable<Stage>* var_stage() override { |
| 31 | return &var_stage_; |
| 32 | } |
| 33 | |
| 34 | virtual FakeVariable<std::string>* var_new_version() override { |
| 35 | return &var_new_version_; |
| 36 | } |
| 37 | |
| 38 | virtual FakeVariable<size_t>* var_payload_size() override { |
| 39 | return &var_payload_size_; |
| 40 | } |
| 41 | |
| 42 | virtual FakeVariable<std::string>* var_curr_channel() override { |
| 43 | return &var_curr_channel_; |
| 44 | } |
| 45 | |
| 46 | virtual FakeVariable<std::string>* var_new_channel() override { |
| 47 | return &var_new_channel_; |
| 48 | } |
| 49 | |
| 50 | virtual FakeVariable<bool>* var_p2p_enabled() override { |
| 51 | return &var_p2p_enabled_; |
| 52 | } |
| 53 | |
| 54 | virtual FakeVariable<bool>* var_cellular_enabled() override { |
| 55 | return &var_cellular_enabled_; |
| 56 | } |
| 57 | |
David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame^] | 58 | private: |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 59 | virtual bool DoInit() { return true; } |
| 60 | |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 61 | FakeVariable<base::Time> var_last_checked_time_{ |
| 62 | "last_checked_time", kVariableModePoll}; |
| 63 | FakeVariable<base::Time> var_update_completed_time_{ |
| 64 | "update_completed_time", kVariableModePoll}; |
| 65 | FakeVariable<double> var_progress_{"progress", kVariableModePoll}; |
| 66 | FakeVariable<Stage> var_stage_{"stage", kVariableModePoll}; |
| 67 | FakeVariable<std::string> var_new_version_{"new_version", kVariableModePoll}; |
| 68 | FakeVariable<size_t> var_payload_size_{"payload_size", kVariableModePoll}; |
| 69 | FakeVariable<std::string> var_curr_channel_{ |
| 70 | "curr_channel", kVariableModePoll}; |
| 71 | FakeVariable<std::string> var_new_channel_{"new_channel", kVariableModePoll}; |
| 72 | FakeVariable<bool> var_p2p_enabled_{"p2p_enabled", kVariableModePoll}; |
| 73 | FakeVariable<bool> var_cellular_enabled_{ |
| 74 | "cellular_enabled", kVariableModePoll}; |
| 75 | |
| 76 | DISALLOW_COPY_AND_ASSIGN(FakeUpdaterProvider); |
| 77 | }; |
| 78 | |
| 79 | } // namespace chromeos_policy_manager |
| 80 | |
| 81 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_UPDATER_PROVIDER_H_ |