1 // Copyright (c) 2012 The Chromium 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.
5 #include "chromeos/dbus/fake_update_engine_client.h"
9 FakeUpdateEngineClient::FakeUpdateEngineClient()
10 : update_check_result_(UpdateEngineClient::UPDATE_RESULT_SUCCESS
),
11 reboot_after_update_call_count_(0) {
14 FakeUpdateEngineClient::~FakeUpdateEngineClient() {
17 void FakeUpdateEngineClient::Init(dbus::Bus
* bus
) {
20 void FakeUpdateEngineClient::AddObserver(Observer
* observer
) {
23 void FakeUpdateEngineClient::RemoveObserver(Observer
* observer
) {
26 bool FakeUpdateEngineClient::HasObserver(Observer
* observer
) {
30 void FakeUpdateEngineClient::RequestUpdateCheck(
31 const UpdateCheckCallback
& callback
) {
32 callback
.Run(update_check_result_
);
35 void FakeUpdateEngineClient::RebootAfterUpdate() {
36 reboot_after_update_call_count_
++;
39 UpdateEngineClient::Status
FakeUpdateEngineClient::GetLastStatus() {
40 if (status_queue_
.empty())
41 return default_status_
;
43 UpdateEngineClient::Status last_status
= status_queue_
.front();
48 void FakeUpdateEngineClient::SetChannel(const std::string
& target_channel
,
49 bool is_powerwash_allowed
) {
52 void FakeUpdateEngineClient::GetChannel(bool get_current_channel
,
53 const GetChannelCallback
& callback
) {
56 void FakeUpdateEngineClient::set_default_status(
57 const UpdateEngineClient::Status
& status
) {
58 default_status_
= status
;
61 void FakeUpdateEngineClient::set_update_check_result(
62 const UpdateEngineClient::UpdateCheckResult
& result
) {
63 update_check_result_
= result
;
66 } // namespace chromeos