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 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 5 | #ifndef UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATER_PROVIDER_H_ |
| 6 | #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATER_PROVIDER_H_ |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 7 | |
Alex Deymo | c7ab616 | 2014-04-25 18:32:50 -0700 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 10 | #include "update_engine/update_manager/fake_variable.h" |
| 11 | #include "update_engine/update_manager/updater_provider.h" |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 12 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 13 | namespace chromeos_update_manager { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 14 | |
| 15 | // Fake implementation of the UpdaterProvider base class. |
| 16 | class FakeUpdaterProvider : public UpdaterProvider { |
| 17 | public: |
| 18 | FakeUpdaterProvider() {} |
| 19 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 20 | FakeVariable<base::Time>* var_updater_started_time() override { |
Alex Deymo | c7ab616 | 2014-04-25 18:32:50 -0700 | [diff] [blame] | 21 | return &var_updater_started_time_; |
| 22 | } |
| 23 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 24 | FakeVariable<base::Time>* var_last_checked_time() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 25 | return &var_last_checked_time_; |
| 26 | } |
| 27 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 28 | FakeVariable<base::Time>* var_update_completed_time() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 29 | return &var_update_completed_time_; |
| 30 | } |
| 31 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 32 | FakeVariable<double>* var_progress() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 33 | return &var_progress_; |
| 34 | } |
| 35 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 36 | FakeVariable<Stage>* var_stage() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 37 | return &var_stage_; |
| 38 | } |
| 39 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 40 | FakeVariable<std::string>* var_new_version() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 41 | return &var_new_version_; |
| 42 | } |
| 43 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 44 | FakeVariable<int64_t>* var_payload_size() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 45 | return &var_payload_size_; |
| 46 | } |
| 47 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 48 | FakeVariable<std::string>* var_curr_channel() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 49 | return &var_curr_channel_; |
| 50 | } |
| 51 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 52 | FakeVariable<std::string>* var_new_channel() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 53 | return &var_new_channel_; |
| 54 | } |
| 55 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 56 | FakeVariable<bool>* var_p2p_enabled() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 57 | return &var_p2p_enabled_; |
| 58 | } |
| 59 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 60 | FakeVariable<bool>* var_cellular_enabled() override { |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 61 | return &var_cellular_enabled_; |
| 62 | } |
| 63 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 64 | FakeVariable<unsigned int>* var_consecutive_failed_update_checks() override { |
Gilad Arnold | a6dab94 | 2014-04-25 11:46:03 -0700 | [diff] [blame] | 65 | return &var_consecutive_failed_update_checks_; |
| 66 | } |
| 67 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 68 | FakeVariable<unsigned int>* var_server_dictated_poll_interval() override { |
Gilad Arnold | a0258a5 | 2014-07-10 16:21:19 -0700 | [diff] [blame] | 69 | return &var_server_dictated_poll_interval_; |
| 70 | } |
| 71 | |
Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame^] | 72 | FakeVariable<bool>* var_interactive_update_requested() override { |
Gilad Arnold | 44dc3bf | 2014-07-18 23:39:38 -0700 | [diff] [blame] | 73 | return &var_interactive_update_requested_; |
| 74 | } |
| 75 | |
David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 76 | private: |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 77 | FakeVariable<base::Time> |
| 78 | var_updater_started_time_{ // NOLINT(whitespace/braces) |
| 79 | "updater_started_time", kVariableModePoll}; |
| 80 | FakeVariable<base::Time> var_last_checked_time_{ // NOLINT(whitespace/braces) |
| 81 | "last_checked_time", kVariableModePoll}; |
| 82 | FakeVariable<base::Time> |
| 83 | var_update_completed_time_{ // NOLINT(whitespace/braces) |
| 84 | "update_completed_time", kVariableModePoll}; |
| 85 | FakeVariable<double> var_progress_{ // NOLINT(whitespace/braces) |
| 86 | "progress", kVariableModePoll}; |
| 87 | FakeVariable<Stage> var_stage_{ // NOLINT(whitespace/braces) |
| 88 | "stage", kVariableModePoll}; |
| 89 | FakeVariable<std::string> var_new_version_{ // NOLINT(whitespace/braces) |
| 90 | "new_version", kVariableModePoll}; |
| 91 | FakeVariable<int64_t> var_payload_size_{ // NOLINT(whitespace/braces) |
| 92 | "payload_size", kVariableModePoll}; |
| 93 | FakeVariable<std::string> var_curr_channel_{ // NOLINT(whitespace/braces) |
| 94 | "curr_channel", kVariableModePoll}; |
| 95 | FakeVariable<std::string> var_new_channel_{ // NOLINT(whitespace/braces) |
| 96 | "new_channel", kVariableModePoll}; |
| 97 | FakeVariable<bool> var_p2p_enabled_{ // NOLINT(whitespace/braces) |
| 98 | "p2p_enabled", kVariableModePoll}; |
| 99 | FakeVariable<bool> var_cellular_enabled_{ // NOLINT(whitespace/braces) |
| 100 | "cellular_enabled", kVariableModePoll}; |
| 101 | FakeVariable<unsigned int> |
| 102 | var_consecutive_failed_update_checks_{ // NOLINT(whitespace/braces) |
| 103 | "consecutive_failed_update_checks", kVariableModePoll}; |
Gilad Arnold | a0258a5 | 2014-07-10 16:21:19 -0700 | [diff] [blame] | 104 | FakeVariable<unsigned int> |
| 105 | var_server_dictated_poll_interval_{ // NOLINT(whitespace/braces) |
| 106 | "server_dictated_poll_interval", kVariableModePoll}; |
Gilad Arnold | 44dc3bf | 2014-07-18 23:39:38 -0700 | [diff] [blame] | 107 | FakeVariable<bool> |
| 108 | var_interactive_update_requested_{ // NOLINT(whitespace/braces) |
| 109 | "interactive_update_requested", kVariableModeAsync}; |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 110 | |
| 111 | DISALLOW_COPY_AND_ASSIGN(FakeUpdaterProvider); |
| 112 | }; |
| 113 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 114 | } // namespace chromeos_update_manager |
Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame] | 115 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 116 | #endif // UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATER_PROVIDER_H_ |