Jay Srinivasan | 55f50c2 | 2013-01-10 19:24:35 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 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 | #include "update_engine/mock_system_state.h" |
Alex Deymo | 94c0616 | 2014-03-21 20:34:46 -0700 | [diff] [blame^] | 6 | #include "update_engine/policy_manager/fake_state.h" |
Jay Srinivasan | 55f50c2 | 2013-01-10 19:24:35 -0800 | [diff] [blame] | 7 | #include "update_engine/update_attempter_mock.h" |
| 8 | |
Alex Deymo | 94c0616 | 2014-03-21 20:34:46 -0700 | [diff] [blame^] | 9 | using chromeos_policy_manager::FakeState; |
| 10 | |
Jay Srinivasan | 55f50c2 | 2013-01-10 19:24:35 -0800 | [diff] [blame] | 11 | namespace chromeos_update_engine { |
| 12 | |
| 13 | // Mock the SystemStateInterface so that we could lie that |
| 14 | // OOBE is completed even when there's no such marker file, etc. |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 15 | MockSystemState::MockSystemState() |
| 16 | : default_request_params_(this), |
Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame] | 17 | clock_(&default_clock_), |
| 18 | hardware_(&default_hardware_), |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 19 | prefs_(&mock_prefs_), |
David Zeuthen | 526cb58 | 2013-08-06 12:26:18 -0700 | [diff] [blame] | 20 | powerwash_safe_prefs_(&mock_powerwash_safe_prefs_), |
| 21 | p2p_manager_(&mock_p2p_manager_), |
Alex Deymo | 94c0616 | 2014-03-21 20:34:46 -0700 | [diff] [blame^] | 22 | payload_state_(&mock_payload_state_), |
| 23 | policy_manager_(&fake_policy_manager_) { |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 24 | request_params_ = &default_request_params_; |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 25 | mock_payload_state_.Initialize(this); |
Jay Srinivasan | 55f50c2 | 2013-01-10 19:24:35 -0800 | [diff] [blame] | 26 | mock_gpio_handler_ = new testing::NiceMock<MockGpioHandler>(); |
| 27 | mock_update_attempter_ = new testing::NiceMock<UpdateAttempterMock>( |
| 28 | this, &dbus_); |
Alex Deymo | 94c0616 | 2014-03-21 20:34:46 -0700 | [diff] [blame^] | 29 | fake_policy_manager_.Init(FakeState::Construct()); |
Jay Srinivasan | 55f50c2 | 2013-01-10 19:24:35 -0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | MockSystemState::~MockSystemState() { |
| 33 | delete mock_gpio_handler_; |
| 34 | } |
| 35 | |
| 36 | UpdateAttempter* MockSystemState::update_attempter() { |
| 37 | return mock_update_attempter_; |
| 38 | } |
| 39 | |
Alex Deymo | 94c0616 | 2014-03-21 20:34:46 -0700 | [diff] [blame^] | 40 | } // namespace chromeos_update_engine |