1 // Copyright (c) 2013 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_power_manager_client.h" 6 #include "chromeos/dbus/power_manager/policy.pb.h" 7 8 namespace chromeos { 9 FakePowerManagerClient()10FakePowerManagerClient::FakePowerManagerClient() 11 : request_restart_call_count_(0) { 12 } 13 ~FakePowerManagerClient()14FakePowerManagerClient::~FakePowerManagerClient() { 15 } 16 Init(dbus::Bus * bus)17void FakePowerManagerClient::Init(dbus::Bus* bus) { 18 } 19 AddObserver(Observer * observer)20void FakePowerManagerClient::AddObserver(Observer* observer) { 21 observers_.AddObserver(observer); 22 } 23 RemoveObserver(Observer * observer)24void FakePowerManagerClient::RemoveObserver(Observer* observer) { 25 observers_.RemoveObserver(observer); 26 } 27 RequestStatusUpdate()28void FakePowerManagerClient::RequestStatusUpdate() { 29 } 30 SetPolicy(const power_manager::PowerManagementPolicy & policy)31void FakePowerManagerClient::SetPolicy( 32 const power_manager::PowerManagementPolicy& policy) { 33 policy_ = policy; 34 } 35 RequestShutdown()36void FakePowerManagerClient::RequestShutdown() { 37 } 38 DecreaseScreenBrightness(bool allow_off)39void FakePowerManagerClient::DecreaseScreenBrightness(bool allow_off) { 40 } 41 SetScreenBrightnessPercent(double percent,bool gradual)42void FakePowerManagerClient::SetScreenBrightnessPercent(double percent, 43 bool gradual) { 44 } 45 GetScreenBrightnessPercent(const GetScreenBrightnessPercentCallback & callback)46void FakePowerManagerClient::GetScreenBrightnessPercent( 47 const GetScreenBrightnessPercentCallback& callback) { 48 } 49 GetSuspendReadinessCallback()50base::Closure FakePowerManagerClient::GetSuspendReadinessCallback() { 51 return base::Closure(); 52 } 53 GetNumPendingSuspendReadinessCallbacks()54int FakePowerManagerClient::GetNumPendingSuspendReadinessCallbacks() { 55 return 0; 56 } 57 HasObserver(Observer * observer)58bool FakePowerManagerClient::HasObserver(Observer* observer) { 59 return false; 60 } 61 RequestRestart()62void FakePowerManagerClient::RequestRestart() { 63 ++request_restart_call_count_; 64 } 65 IncreaseKeyboardBrightness()66void FakePowerManagerClient::IncreaseKeyboardBrightness() { 67 } 68 IncreaseScreenBrightness()69void FakePowerManagerClient::IncreaseScreenBrightness() { 70 } 71 NotifyVideoActivity(bool is_fullscreen)72void FakePowerManagerClient::NotifyVideoActivity(bool is_fullscreen) { 73 } 74 DecreaseKeyboardBrightness()75void FakePowerManagerClient::DecreaseKeyboardBrightness() { 76 } 77 SetIsProjecting(bool is_projecting)78void FakePowerManagerClient::SetIsProjecting(bool is_projecting) { 79 } 80 NotifyUserActivity(power_manager::UserActivityType type)81void FakePowerManagerClient::NotifyUserActivity( 82 power_manager::UserActivityType type) { 83 } 84 SendSuspendImminent()85void FakePowerManagerClient::SendSuspendImminent() { 86 FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent()); 87 } 88 SendSuspendStateChanged(const power_manager::SuspendState & suspend_state)89void FakePowerManagerClient::SendSuspendStateChanged( 90 const power_manager::SuspendState& suspend_state) { 91 base::Time wall_time = 92 base::Time::FromInternalValue(suspend_state.wall_time()); 93 switch (suspend_state.type()) { 94 case power_manager::SuspendState_Type_SUSPEND_TO_MEMORY: 95 last_suspend_wall_time_ = wall_time; 96 break; 97 case power_manager::SuspendState_Type_RESUME: 98 FOR_EACH_OBSERVER(Observer, observers_, 99 SystemResumed(wall_time - last_suspend_wall_time_)); 100 break; 101 } 102 } 103 104 } // namespace chromeos 105