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