| 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 // UpdateEngineClient overrides | 24 // UpdateEngineClient overrides |
| 25 virtual void Init(dbus::Bus* bus) OVERRIDE; | 25 virtual void Init(dbus::Bus* bus) override; |
| 26 virtual void AddObserver(Observer* observer) OVERRIDE; | 26 virtual void AddObserver(Observer* observer) override; |
| 27 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 27 virtual void RemoveObserver(Observer* observer) override; |
| 28 virtual bool HasObserver(Observer* observer) OVERRIDE; | 28 virtual bool HasObserver(Observer* observer) override; |
| 29 virtual void RequestUpdateCheck(const UpdateCheckCallback& callback) OVERRIDE; | 29 virtual void RequestUpdateCheck(const UpdateCheckCallback& callback) override; |
| 30 virtual void RebootAfterUpdate() OVERRIDE; | 30 virtual void RebootAfterUpdate() override; |
| 31 virtual void Rollback() OVERRIDE; | 31 virtual void Rollback() override; |
| 32 virtual void CanRollbackCheck( | 32 virtual void CanRollbackCheck( |
| 33 const RollbackCheckCallback& callback) OVERRIDE; | 33 const RollbackCheckCallback& callback) override; |
| 34 virtual Status GetLastStatus() OVERRIDE; | 34 virtual Status GetLastStatus() override; |
| 35 virtual void SetChannel(const std::string& target_channel, | 35 virtual void SetChannel(const std::string& target_channel, |
| 36 bool is_powerwash_allowed) OVERRIDE; | 36 bool is_powerwash_allowed) override; |
| 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. | 47 // Sends status change notification. |
| 48 void NotifyObserversThatStatusChanged( | 48 void NotifyObserversThatStatusChanged( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool can_rollback_stub_result_; | 84 bool can_rollback_stub_result_; |
| 85 int reboot_after_update_call_count_; | 85 int reboot_after_update_call_count_; |
| 86 int request_update_check_call_count_; | 86 int request_update_check_call_count_; |
| 87 int rollback_call_count_; | 87 int rollback_call_count_; |
| 88 int can_rollback_call_count_; | 88 int can_rollback_call_count_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace chromeos | 91 } // namespace chromeos |
| 92 | 92 |
| 93 #endif // CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ | 93 #endif // CHROMEOS_DBUS_FAKE_UPDATE_ENGINE_CLIENT_H_ |
| OLD | NEW |