blob: 0f0b5f1857f0e27279567e05766e9ddc87b60e5e [file] [log] [blame]
Alex Deymo2de23f52014-02-26 14:30:13 -08001// 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
Alex Deymo2de23f52014-02-26 14:30:13 -08005#include "update_engine/policy_manager/fake_state.h"
Alex Deymo94c06162014-03-21 20:34:46 -07006
7#include "base/memory/scoped_ptr.h"
Alex Deymo2de23f52014-02-26 14:30:13 -08008
9namespace chromeos_policy_manager {
10
Alex Deymo94c06162014-03-21 20:34:46 -070011FakeState::FakeState() : State(new FakeRandomProvider(),
12 new FakeShillProvider(),
13 new FakeSystemProvider(),
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070014 new FakeTimeProvider(),
15 new FakeUpdaterProvider()) {
Alex Deymo94c06162014-03-21 20:34:46 -070016}
17
18FakeState* FakeState::Construct() {
19 scoped_ptr<FakeState> fake_state(new FakeState());
20 if (!(fake_state->random_provider()->Init() &&
21 fake_state->shill_provider()->Init() &&
22 fake_state->system_provider()->Init() &&
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070023 fake_state->time_provider()->Init() &&
24 fake_state->updater_provider()->Init())) {
Alex Deymo94c06162014-03-21 20:34:46 -070025 return NULL;
26 }
27 return fake_state.release();
Alex Deymo2de23f52014-02-26 14:30:13 -080028}
29
30} // namespace chromeos_policy_manager