Add include.
[chromium-blink-merge.git] / chromeos / dbus / fake_session_manager_client.h
blobf69e262c3aa53bcda747ce814d54462b11645c7f
1 // Copyright 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_SESSION_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/observer_list.h"
15 #include "chromeos/dbus/session_manager_client.h"
17 namespace chromeos {
19 // A fake implementation of session_manager. Accepts policy blobs to be set and
20 // returns them unmodified.
21 class FakeSessionManagerClient : public SessionManagerClient {
22 public:
23 FakeSessionManagerClient();
24 virtual ~FakeSessionManagerClient();
26 // SessionManagerClient overrides
27 virtual void Init(dbus::Bus* bus) override;
28 virtual void SetStubDelegate(StubDelegate* delegate) override;
29 virtual void AddObserver(Observer* observer) override;
30 virtual void RemoveObserver(Observer* observer) override;
31 virtual bool HasObserver(Observer* observer) override;
32 virtual void EmitLoginPromptVisible() override;
33 virtual void RestartJob(int pid, const std::string& command_line) override;
34 virtual void StartSession(const std::string& user_email) override;
35 virtual void StopSession() override;
36 virtual void StartDeviceWipe() override;
37 virtual void RequestLockScreen() override;
38 virtual void NotifyLockScreenShown() override;
39 virtual void NotifyLockScreenDismissed() override;
40 virtual void RetrieveActiveSessions(
41 const ActiveSessionsCallback& callback) override;
42 virtual void RetrieveDevicePolicy(
43 const RetrievePolicyCallback& callback) override;
44 virtual void RetrievePolicyForUser(
45 const std::string& username,
46 const RetrievePolicyCallback& callback) override;
47 virtual std::string BlockingRetrievePolicyForUser(
48 const std::string& username) override;
49 virtual void RetrieveDeviceLocalAccountPolicy(
50 const std::string& account_id,
51 const RetrievePolicyCallback& callback) override;
52 virtual void StoreDevicePolicy(const std::string& policy_blob,
53 const StorePolicyCallback& callback) override;
54 virtual void StorePolicyForUser(const std::string& username,
55 const std::string& policy_blob,
56 const StorePolicyCallback& callback) override;
57 virtual void StoreDeviceLocalAccountPolicy(
58 const std::string& account_id,
59 const std::string& policy_blob,
60 const StorePolicyCallback& callback) override;
61 virtual void SetFlagsForUser(const std::string& username,
62 const std::vector<std::string>& flags) override;
63 virtual void GetServerBackedStateKeys(const StateKeysCallback& callback)
64 override;
66 const std::string& device_policy() const;
67 void set_device_policy(const std::string& policy_blob);
69 const std::string& user_policy(const std::string& username) const;
70 void set_user_policy(const std::string& username,
71 const std::string& policy_blob);
73 const std::string& device_local_account_policy(
74 const std::string& account_id) const;
75 void set_device_local_account_policy(const std::string& account_id,
76 const std::string& policy_blob);
78 // Notify observers about a property change completion.
79 void OnPropertyChangeComplete(bool success);
81 // Configures the list of state keys used to satisfy
82 // GetServerBackedStateKeys() requests.
83 void set_server_backed_state_keys(
84 const std::vector<std::string>& state_keys) {
85 server_backed_state_keys_ = state_keys;
88 int start_device_wipe_call_count() const {
89 return start_device_wipe_call_count_;
92 // Returns how many times LockScreenShown() was called.
93 int notify_lock_screen_shown_call_count() const {
94 return notify_lock_screen_shown_call_count_;
97 // Returns how many times LockScreenDismissed() was called.
98 int notify_lock_screen_dismissed_call_count() const {
99 return notify_lock_screen_dismissed_call_count_;
102 private:
103 std::string device_policy_;
104 std::map<std::string, std::string> user_policies_;
105 std::map<std::string, std::string> device_local_account_policy_;
106 ObserverList<Observer> observers_;
107 SessionManagerClient::ActiveSessionsMap user_sessions_;
108 std::vector<std::string> server_backed_state_keys_;
110 int start_device_wipe_call_count_;
111 int notify_lock_screen_shown_call_count_;
112 int notify_lock_screen_dismissed_call_count_;
114 DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient);
117 } // namespace chromeos
119 #endif // CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_