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 #ifndef CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 virtual void GetChannel(bool get_current_channel, | 37 virtual void GetChannel(bool get_current_channel, |
38 const GetChannelCallback& callback) OVERRIDE; | 38 const GetChannelCallback& callback) OVERRIDE; |
39 | 39 |
40 // Pushes UpdateEngineClient::Status in the queue to test changing status. | 40 // Pushes UpdateEngineClient::Status in the queue to test changing status. |
41 // GetLastStatus() returns the status set by this method in FIFO order. | 41 // GetLastStatus() returns the status set by this method in FIFO order. |
42 // See set_default_status(). | 42 // See set_default_status(). |
43 void PushLastStatus(const UpdateEngineClient::Status& status) { | 43 void PushLastStatus(const UpdateEngineClient::Status& status) { |
44 status_queue_.push(status); | 44 status_queue_.push(status); |
45 } | 45 } |
46 | 46 |
| 47 // Sends status change notification. |
| 48 void NotifyObserversThatStatusChanged( |
| 49 const UpdateEngineClient::Status& status); |
| 50 |
47 // Sets the default UpdateEngineClient::Status. GetLastStatus() returns the | 51 // Sets the default UpdateEngineClient::Status. GetLastStatus() returns the |
48 // value set here if |status_queue_| is empty. | 52 // value set here if |status_queue_| is empty. |
49 void set_default_status(const UpdateEngineClient::Status& status); | 53 void set_default_status(const UpdateEngineClient::Status& status); |
50 | 54 |
51 // Sets a value returned by RequestUpdateCheck(). | 55 // Sets a value returned by RequestUpdateCheck(). |
52 void set_update_check_result( | 56 void set_update_check_result( |
53 const UpdateEngineClient::UpdateCheckResult& result); | 57 const UpdateEngineClient::UpdateCheckResult& result); |
54 | 58 |
55 void set_can_rollback_check_result(bool result) { | 59 void set_can_rollback_check_result(bool result) { |
56 can_rollback_stub_result_ = result; | 60 can_rollback_stub_result_ = result; |
57 } | 61 } |
58 | 62 |
59 // Returns how many times RebootAfterUpdate() is called. | 63 // Returns how many times RebootAfterUpdate() is called. |
60 int reboot_after_update_call_count() const { | 64 int reboot_after_update_call_count() const { |
61 return reboot_after_update_call_count_; | 65 return reboot_after_update_call_count_; |
62 } | 66 } |
63 | 67 |
64 // Returns how many times Rollback() is called. | 68 // Returns how many times Rollback() is called. |
65 int rollback_call_count() const { return rollback_call_count_; } | 69 int rollback_call_count() const { return rollback_call_count_; } |
66 | 70 |
67 // Returns how many times Rollback() is called. | 71 // Returns how many times Rollback() is called. |
68 int can_rollback_call_count() const { return can_rollback_call_count_; } | 72 int can_rollback_call_count() const { return can_rollback_call_count_; } |
69 | 73 |
70 private: | 74 private: |
| 75 ObserverList<Observer> observers_; |
71 std::queue<UpdateEngineClient::Status> status_queue_; | 76 std::queue<UpdateEngineClient::Status> status_queue_; |
72 UpdateEngineClient::Status default_status_; | 77 UpdateEngineClient::Status default_status_; |
73 UpdateEngineClient::UpdateCheckResult update_check_result_; | 78 UpdateEngineClient::UpdateCheckResult update_check_result_; |
74 bool can_rollback_stub_result_; | 79 bool can_rollback_stub_result_; |
75 int reboot_after_update_call_count_; | 80 int reboot_after_update_call_count_; |
76 int rollback_call_count_; | 81 int rollback_call_count_; |
77 int can_rollback_call_count_; | 82 int can_rollback_call_count_; |
78 }; | 83 }; |
79 | 84 |
80 } // namespace chromeos | 85 } // namespace chromeos |
81 | 86 |
82 #endif // CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ | 87 #endif // CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ |
OLD | NEW |