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 14 matching lines...) Expand all Loading... |
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(); |
58 return last_status; | 60 return last_status; |
59 } | 61 } |
60 | 62 |
| 63 void FakeUpdateEngineClient::NotifyObserversThatStatusChanged( |
| 64 const UpdateEngineClient::Status& status) { |
| 65 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(status)); |
| 66 } |
| 67 |
61 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel, | 68 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel, |
62 bool is_powerwash_allowed) { | 69 bool is_powerwash_allowed) { |
63 } | 70 } |
64 | 71 |
65 void FakeUpdateEngineClient::GetChannel(bool get_current_channel, | 72 void FakeUpdateEngineClient::GetChannel(bool get_current_channel, |
66 const GetChannelCallback& callback) { | 73 const GetChannelCallback& callback) { |
67 } | 74 } |
68 | 75 |
69 void FakeUpdateEngineClient::set_default_status( | 76 void FakeUpdateEngineClient::set_default_status( |
70 const UpdateEngineClient::Status& status) { | 77 const UpdateEngineClient::Status& status) { |
71 default_status_ = status; | 78 default_status_ = status; |
72 } | 79 } |
73 | 80 |
74 void FakeUpdateEngineClient::set_update_check_result( | 81 void FakeUpdateEngineClient::set_update_check_result( |
75 const UpdateEngineClient::UpdateCheckResult& result) { | 82 const UpdateEngineClient::UpdateCheckResult& result) { |
76 update_check_result_ = result; | 83 update_check_result_ = result; |
77 } | 84 } |
78 | 85 |
79 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |