Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -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_UPDATE_MANAGER_H_ |
| 6 | #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATE_MANAGER_H_ |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 7 | |
| 8 | #include "update_engine/update_manager/update_manager.h" |
| 9 | |
| 10 | #include "update_engine/update_manager/default_policy.h" |
| 11 | #include "update_engine/update_manager/fake_state.h" |
| 12 | |
| 13 | namespace chromeos_update_manager { |
| 14 | |
| 15 | class FakeUpdateManager : public UpdateManager { |
| 16 | public: |
| 17 | explicit FakeUpdateManager(chromeos_update_engine::ClockInterface* clock) |
Gilad Arnold | fd45a73 | 2014-08-07 15:53:46 -0700 | [diff] [blame^] | 18 | : UpdateManager(clock, base::TimeDelta::FromSeconds(5), |
| 19 | base::TimeDelta::FromHours(1), new FakeState()) { |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 20 | // The FakeUpdateManager uses a DefaultPolicy. |
Gilad Arnold | a23e408 | 2014-07-17 11:40:43 -0700 | [diff] [blame] | 21 | set_policy(new DefaultPolicy(clock)); |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | // UpdateManager overrides. |
| 25 | using UpdateManager::set_policy; |
| 26 | |
| 27 | FakeState* state() { |
| 28 | return reinterpret_cast<FakeState*>(UpdateManager::state()); |
| 29 | } |
| 30 | |
| 31 | private: |
| 32 | DISALLOW_COPY_AND_ASSIGN(FakeUpdateManager); |
| 33 | }; |
| 34 | |
| 35 | } // namespace chromeos_update_manager |
| 36 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 37 | #endif // UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATE_MANAGER_H_ |