Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chromeos/dbus/fake_power_manager_client.h

Issue 23484021: Implement SendSuspendImminent() and SendSuspendStateChanged() of FakePowerManagerClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chromeos/dbus/fake_power_manager_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
11 #include "base/observer_list.h"
12 #include "base/time/time.h"
10 #include "chromeos/dbus/power_manager/policy.pb.h" 13 #include "chromeos/dbus/power_manager/policy.pb.h"
14 #include "chromeos/dbus/power_manager/suspend.pb.h"
11 #include "chromeos/dbus/power_manager_client.h" 15 #include "chromeos/dbus/power_manager_client.h"
12 16
13 namespace chromeos { 17 namespace chromeos {
14 18
15 // A fake implementation of PowerManagerClient. This remembers the policy passed 19 // A fake implementation of PowerManagerClient. This remembers the policy passed
16 // to SetPolicy() and the user of this class can inspect the last set policy by 20 // to SetPolicy() and the user of this class can inspect the last set policy by
17 // get_policy(). 21 // get_policy().
18 class FakePowerManagerClient : public PowerManagerClient { 22 class FakePowerManagerClient : public PowerManagerClient {
19 public: 23 public:
20 FakePowerManagerClient(); 24 FakePowerManagerClient();
(...skipping 24 matching lines...) Expand all
45 virtual void SetIsProjecting(bool is_projecting) OVERRIDE; 49 virtual void SetIsProjecting(bool is_projecting) OVERRIDE;
46 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE; 50 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE;
47 51
48 power_manager::PowerManagementPolicy& get_policy() { return policy_; } 52 power_manager::PowerManagementPolicy& get_policy() { return policy_; }
49 53
50 // Returns how many times RequestRestart() was called. 54 // Returns how many times RequestRestart() was called.
51 int request_restart_call_count() const { 55 int request_restart_call_count() const {
52 return request_restart_call_count_; 56 return request_restart_call_count_;
53 } 57 }
54 58
59 // Emulates that the dbus server sends a message "SuspendImminent" to the
60 // client.
61 void SendSuspendImminent();
62
63 // Emulates that the dbus server sends a message "SuspendStateChanged" to the
64 // client.
65 void SendSuspendStateChanged(
66 const power_manager::SuspendState& suspend_state);
67
55 private: 68 private:
56 power_manager::PowerManagementPolicy policy_; 69 power_manager::PowerManagementPolicy policy_;
57 70 base::Time last_suspend_wall_time_;
71 ObserverList<Observer> observers_;
58 int request_restart_call_count_; 72 int request_restart_call_count_;
59 73
60 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); 74 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient);
61 }; 75 };
62 76
63 } // namespace chromeos 77 } // namespace chromeos
64 78
65 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ 79 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/fake_power_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698