Fix compilation error triggered with -Werror=sign-compare
[chromium-blink-merge.git] / chromeos / dbus / fake_power_manager_client.h
blob74aad415f5ad3005ca95bc089f513b3fec720ccd
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.
5 #ifndef CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/observer_list.h"
12 #include "chromeos/dbus/power_manager/policy.pb.h"
13 #include "chromeos/dbus/power_manager/suspend.pb.h"
14 #include "chromeos/dbus/power_manager_client.h"
16 namespace chromeos {
18 // A fake implementation of PowerManagerClient. This remembers the policy passed
19 // to SetPolicy() and the user of this class can inspect the last set policy by
20 // get_policy().
21 class FakePowerManagerClient : public PowerManagerClient {
22 public:
23 FakePowerManagerClient();
24 virtual ~FakePowerManagerClient();
26 power_manager::PowerManagementPolicy& policy() { return policy_; }
27 int num_request_restart_calls() const {
28 return num_request_restart_calls_;
30 int num_set_policy_calls() const {
31 return num_set_policy_calls_;
33 int num_set_is_projecting_calls() const {
34 return num_set_is_projecting_calls_;
36 bool is_projecting() const {
37 return is_projecting_;
40 // PowerManagerClient overrides
41 virtual void Init(dbus::Bus* bus) OVERRIDE;
42 virtual void AddObserver(Observer* observer) OVERRIDE;
43 virtual void RemoveObserver(Observer* observer) OVERRIDE;
44 virtual bool HasObserver(Observer* observer) OVERRIDE;
45 virtual void DecreaseScreenBrightness(bool allow_off) OVERRIDE;
46 virtual void IncreaseScreenBrightness() OVERRIDE;
47 virtual void SetScreenBrightnessPercent(
48 double percent, bool gradual) OVERRIDE;
49 virtual void GetScreenBrightnessPercent(
50 const GetScreenBrightnessPercentCallback& callback) OVERRIDE;
51 virtual void DecreaseKeyboardBrightness() OVERRIDE;
52 virtual void IncreaseKeyboardBrightness() OVERRIDE;
53 virtual void RequestStatusUpdate() OVERRIDE;
54 virtual void RequestRestart() OVERRIDE;
55 virtual void RequestShutdown() OVERRIDE;
56 virtual void NotifyUserActivity(
57 power_manager::UserActivityType type) OVERRIDE;
58 virtual void NotifyVideoActivity(bool is_fullscreen) OVERRIDE;
59 virtual void SetPolicy(
60 const power_manager::PowerManagementPolicy& policy) OVERRIDE;
61 virtual void SetIsProjecting(bool is_projecting) OVERRIDE;
62 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE;
63 virtual int GetNumPendingSuspendReadinessCallbacks() OVERRIDE;
65 // Emulates the power manager announcing that the system is starting or
66 // completing a suspend attempt.
67 void SendSuspendImminent();
68 void SendSuspendDone();
70 private:
71 ObserverList<Observer> observers_;
73 // Last policy passed to SetPolicy().
74 power_manager::PowerManagementPolicy policy_;
76 // Number of times that RequestRestart() has been called.
77 int num_request_restart_calls_;
79 // Number of times that SetPolicy() has been called.
80 int num_set_policy_calls_;
82 // Count the number of times SetIsProjecting() has been called.
83 int num_set_is_projecting_calls_;
85 // Last projecting state set in SetIsProjecting().
86 bool is_projecting_;
88 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient);
91 } // namespace chromeos
93 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_