Home | History | Annotate | Download | only in dbus
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chromeos/dbus/fake_update_engine_client.h"
      6 
      7 namespace chromeos {
      8 
      9 FakeUpdateEngineClient::FakeUpdateEngineClient()
     10     : update_check_result_(UpdateEngineClient::UPDATE_RESULT_SUCCESS),
     11       reboot_after_update_call_count_(0) {
     12 }
     13 
     14 FakeUpdateEngineClient::~FakeUpdateEngineClient() {
     15 }
     16 
     17 void FakeUpdateEngineClient::Init(dbus::Bus* bus) {
     18 }
     19 
     20 void FakeUpdateEngineClient::AddObserver(Observer* observer) {
     21 }
     22 
     23 void FakeUpdateEngineClient::RemoveObserver(Observer* observer) {
     24 }
     25 
     26 bool FakeUpdateEngineClient::HasObserver(Observer* observer) {
     27   return false;
     28 }
     29 
     30 void FakeUpdateEngineClient::RequestUpdateCheck(
     31     const UpdateCheckCallback& callback) {
     32   callback.Run(update_check_result_);
     33 }
     34 
     35 void FakeUpdateEngineClient::RebootAfterUpdate() {
     36   reboot_after_update_call_count_++;
     37 }
     38 
     39 UpdateEngineClient::Status FakeUpdateEngineClient::GetLastStatus() {
     40   if (status_queue_.empty())
     41     return default_status_;
     42 
     43   UpdateEngineClient::Status last_status = status_queue_.front();
     44   status_queue_.pop();
     45   return last_status;
     46 }
     47 
     48 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel,
     49                                         bool is_powerwash_allowed) {
     50 }
     51 
     52 void FakeUpdateEngineClient::GetChannel(bool get_current_channel,
     53                                         const GetChannelCallback& callback) {
     54 }
     55 
     56 void FakeUpdateEngineClient::set_default_status(
     57     const UpdateEngineClient::Status& status) {
     58   default_status_ = status;
     59 }
     60 
     61 void FakeUpdateEngineClient::set_update_check_result(
     62     const UpdateEngineClient::UpdateCheckResult& result) {
     63   update_check_result_ = result;
     64 }
     65 
     66 }  // namespace chromeos
     67