• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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()10 FakePowerManagerClient::FakePowerManagerClient()
11     : request_restart_call_count_(0) {
12 }
13 
~FakePowerManagerClient()14 FakePowerManagerClient::~FakePowerManagerClient() {
15 }
16 
Init(dbus::Bus * bus)17 void FakePowerManagerClient::Init(dbus::Bus* bus) {
18 }
19 
AddObserver(Observer * observer)20 void FakePowerManagerClient::AddObserver(Observer* observer) {
21   observers_.AddObserver(observer);
22 }
23 
RemoveObserver(Observer * observer)24 void FakePowerManagerClient::RemoveObserver(Observer* observer) {
25   observers_.RemoveObserver(observer);
26 }
27 
RequestStatusUpdate()28 void FakePowerManagerClient::RequestStatusUpdate() {
29 }
30 
SetPolicy(const power_manager::PowerManagementPolicy & policy)31 void FakePowerManagerClient::SetPolicy(
32     const power_manager::PowerManagementPolicy& policy) {
33   policy_ = policy;
34 }
35 
RequestShutdown()36 void FakePowerManagerClient::RequestShutdown() {
37 }
38 
DecreaseScreenBrightness(bool allow_off)39 void FakePowerManagerClient::DecreaseScreenBrightness(bool allow_off) {
40 }
41 
SetScreenBrightnessPercent(double percent,bool gradual)42 void FakePowerManagerClient::SetScreenBrightnessPercent(double percent,
43                                                         bool gradual) {
44 }
45 
GetScreenBrightnessPercent(const GetScreenBrightnessPercentCallback & callback)46 void FakePowerManagerClient::GetScreenBrightnessPercent(
47     const GetScreenBrightnessPercentCallback& callback) {
48 }
49 
GetSuspendReadinessCallback()50 base::Closure FakePowerManagerClient::GetSuspendReadinessCallback() {
51   return base::Closure();
52 }
53 
GetNumPendingSuspendReadinessCallbacks()54 int FakePowerManagerClient::GetNumPendingSuspendReadinessCallbacks() {
55   return 0;
56 }
57 
HasObserver(Observer * observer)58 bool FakePowerManagerClient::HasObserver(Observer* observer) {
59   return false;
60 }
61 
RequestRestart()62 void FakePowerManagerClient::RequestRestart() {
63   ++request_restart_call_count_;
64 }
65 
IncreaseKeyboardBrightness()66 void FakePowerManagerClient::IncreaseKeyboardBrightness() {
67 }
68 
IncreaseScreenBrightness()69 void FakePowerManagerClient::IncreaseScreenBrightness() {
70 }
71 
NotifyVideoActivity(bool is_fullscreen)72 void FakePowerManagerClient::NotifyVideoActivity(bool is_fullscreen) {
73 }
74 
DecreaseKeyboardBrightness()75 void FakePowerManagerClient::DecreaseKeyboardBrightness() {
76 }
77 
SetIsProjecting(bool is_projecting)78 void FakePowerManagerClient::SetIsProjecting(bool is_projecting) {
79 }
80 
NotifyUserActivity(power_manager::UserActivityType type)81 void FakePowerManagerClient::NotifyUserActivity(
82     power_manager::UserActivityType type) {
83 }
84 
SendSuspendImminent()85 void FakePowerManagerClient::SendSuspendImminent() {
86   FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent());
87 }
88 
SendSuspendStateChanged(const power_manager::SuspendState & suspend_state)89 void 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