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 |
11 #include "chromeos/dbus/update_engine_client.h" | 11 #include "chromeos/dbus/update_engine_client.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 // A fake implementation of UpdateEngineClient. The user of this class can | 15 // A fake implementation of UpdateEngineClient. The user of this class can |
16 // use set_update_engine_client_status() to set a fake last Status and | 16 // use set_update_engine_client_status() to set a fake last Status and |
17 // GetLastStatus() returns the fake with no modification. Other methods do | 17 // GetLastStatus() returns the fake with no modification. Other methods do |
18 // nothing. | 18 // nothing. |
19 class FakeUpdateEngineClient : public UpdateEngineClient { | 19 class FakeUpdateEngineClient : public UpdateEngineClient { |
20 public: | 20 public: |
21 FakeUpdateEngineClient(); | 21 FakeUpdateEngineClient(); |
22 virtual ~FakeUpdateEngineClient(); | 22 virtual ~FakeUpdateEngineClient(); |
23 | 23 |
24 // Overrides | 24 // Overrides |
25 virtual void AddObserver(Observer* observer) OVERRIDE; | 25 virtual void AddObserver(Observer* observer) OVERRIDE; |
26 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 26 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
27 virtual bool HasObserver(Observer* observer) OVERRIDE; | 27 virtual bool HasObserver(Observer* observer) OVERRIDE; |
28 virtual void RequestUpdateCheck(const UpdateCheckCallback& callback) OVERRIDE; | 28 virtual void RequestUpdateCheck(const UpdateCheckCallback& callback) OVERRIDE; |
29 virtual void RebootAfterUpdate() OVERRIDE; | 29 virtual void RebootAfterUpdate() OVERRIDE; |
30 virtual void SetReleaseTrack(const std::string& track) OVERRIDE; | |
31 virtual void GetReleaseTrack(const GetReleaseTrackCallback& callback) | |
32 OVERRIDE; | |
33 virtual Status GetLastStatus() OVERRIDE; | 30 virtual Status GetLastStatus() OVERRIDE; |
34 virtual void SetChannel(const std::string& target_channel, | 31 virtual void SetChannel(const std::string& target_channel, |
35 bool is_powerwash_allowed) OVERRIDE; | 32 bool is_powerwash_allowed) OVERRIDE; |
36 virtual void GetChannel(bool get_current_channel, | 33 virtual void GetChannel(bool get_current_channel, |
37 const GetChannelCallback& callback) OVERRIDE; | 34 const GetChannelCallback& callback) OVERRIDE; |
38 | 35 |
39 // Pushes UpdateEngineClient::Status in the queue to test changing status. | 36 // Pushes UpdateEngineClient::Status in the queue to test changing status. |
40 // GetLastStatus() returns the status set by this method in FIFO order. | 37 // GetLastStatus() returns the status set by this method in FIFO order. |
41 // See set_default_status(). | 38 // See set_default_status(). |
42 void PushLastStatus(const UpdateEngineClient::Status& status) { | 39 void PushLastStatus(const UpdateEngineClient::Status& status) { |
(...skipping 16 matching lines...) Expand all Loading... |
59 private: | 56 private: |
60 std::queue<UpdateEngineClient::Status> status_queue_; | 57 std::queue<UpdateEngineClient::Status> status_queue_; |
61 UpdateEngineClient::Status default_status_; | 58 UpdateEngineClient::Status default_status_; |
62 UpdateEngineClient::UpdateCheckResult update_check_result_; | 59 UpdateEngineClient::UpdateCheckResult update_check_result_; |
63 int reboot_after_update_call_count_; | 60 int reboot_after_update_call_count_; |
64 }; | 61 }; |
65 | 62 |
66 } // namespace chromeos | 63 } // namespace chromeos |
67 | 64 |
68 #endif // CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ | 65 #endif // CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ |
OLD | NEW |