OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/fake_update_engine_client.h" | 5 #include "chromeos/dbus/fake_update_engine_client.h" |
6 | 6 |
7 namespace chromeos { | 7 namespace chromeos { |
8 | 8 |
9 FakeUpdateEngineClient::FakeUpdateEngineClient() | 9 FakeUpdateEngineClient::FakeUpdateEngineClient() |
10 : update_check_result_(UpdateEngineClient::UPDATE_RESULT_SUCCESS), | 10 : update_check_result_(UpdateEngineClient::UPDATE_RESULT_SUCCESS), |
11 can_rollback_stub_result_(false), | 11 can_rollback_stub_result_(false), |
12 reboot_after_update_call_count_(0), | 12 reboot_after_update_call_count_(0), |
13 rollback_call_count_(0), | 13 rollback_call_count_(0), |
14 can_rollback_call_count_(0) { | 14 can_rollback_call_count_(0) { |
15 } | 15 } |
16 | 16 |
17 FakeUpdateEngineClient::~FakeUpdateEngineClient() { | 17 FakeUpdateEngineClient::~FakeUpdateEngineClient() { |
18 } | 18 } |
19 | 19 |
20 void FakeUpdateEngineClient::Init(dbus::Bus* bus) { | 20 void FakeUpdateEngineClient::Init(dbus::Bus* bus) { |
21 } | 21 } |
22 | 22 |
23 void FakeUpdateEngineClient::AddObserver(Observer* observer) { | 23 void FakeUpdateEngineClient::AddObserver(Observer* observer) { |
24 observers_.AddObserver(observer); | |
24 } | 25 } |
25 | 26 |
26 void FakeUpdateEngineClient::RemoveObserver(Observer* observer) { | 27 void FakeUpdateEngineClient::RemoveObserver(Observer* observer) { |
28 observers_.RemoveObserver(observer); | |
27 } | 29 } |
28 | 30 |
29 bool FakeUpdateEngineClient::HasObserver(Observer* observer) { | 31 bool FakeUpdateEngineClient::HasObserver(Observer* observer) { |
30 return false; | 32 return false; |
31 } | 33 } |
32 | 34 |
33 void FakeUpdateEngineClient::RequestUpdateCheck( | 35 void FakeUpdateEngineClient::RequestUpdateCheck( |
34 const UpdateCheckCallback& callback) { | 36 const UpdateCheckCallback& callback) { |
35 callback.Run(update_check_result_); | 37 callback.Run(update_check_result_); |
36 } | 38 } |
(...skipping 11 matching lines...) Expand all Loading... | |
48 void FakeUpdateEngineClient::RebootAfterUpdate() { | 50 void FakeUpdateEngineClient::RebootAfterUpdate() { |
49 reboot_after_update_call_count_++; | 51 reboot_after_update_call_count_++; |
50 } | 52 } |
51 | 53 |
52 UpdateEngineClient::Status FakeUpdateEngineClient::GetLastStatus() { | 54 UpdateEngineClient::Status FakeUpdateEngineClient::GetLastStatus() { |
53 if (status_queue_.empty()) | 55 if (status_queue_.empty()) |
54 return default_status_; | 56 return default_status_; |
55 | 57 |
56 UpdateEngineClient::Status last_status = status_queue_.front(); | 58 UpdateEngineClient::Status last_status = status_queue_.front(); |
57 status_queue_.pop(); | 59 status_queue_.pop(); |
60 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(last_status)); | |
Daniel Erat
2014/05/06 14:49:00
this shouldn't be triggered by GetLastStatus() --
| |
58 return last_status; | 61 return last_status; |
59 } | 62 } |
60 | 63 |
61 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel, | 64 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel, |
62 bool is_powerwash_allowed) { | 65 bool is_powerwash_allowed) { |
63 } | 66 } |
64 | 67 |
65 void FakeUpdateEngineClient::GetChannel(bool get_current_channel, | 68 void FakeUpdateEngineClient::GetChannel(bool get_current_channel, |
66 const GetChannelCallback& callback) { | 69 const GetChannelCallback& callback) { |
67 } | 70 } |
68 | 71 |
69 void FakeUpdateEngineClient::set_default_status( | 72 void FakeUpdateEngineClient::set_default_status( |
70 const UpdateEngineClient::Status& status) { | 73 const UpdateEngineClient::Status& status) { |
71 default_status_ = status; | 74 default_status_ = status; |
72 } | 75 } |
73 | 76 |
74 void FakeUpdateEngineClient::set_update_check_result( | 77 void FakeUpdateEngineClient::set_update_check_result( |
75 const UpdateEngineClient::UpdateCheckResult& result) { | 78 const UpdateEngineClient::UpdateCheckResult& result) { |
76 update_check_result_ = result; | 79 update_check_result_ = result; |
77 } | 80 } |
78 | 81 |
79 } // namespace chromeos | 82 } // namespace chromeos |
OLD | NEW |