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_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/observer_list.h"
14 #include "chromeos/dbus/session_manager_client.h"
18 // A fake implementation of session_manager. Accepts policy blobs to be set and
19 // returns them unmodified.
20 class FakeSessionManagerClient
: public chromeos::SessionManagerClient
{
22 FakeSessionManagerClient();
23 virtual ~FakeSessionManagerClient();
25 // SessionManagerClient:
26 virtual void AddObserver(Observer
* observer
) OVERRIDE
;
27 virtual void RemoveObserver(Observer
* observer
) OVERRIDE
;
28 virtual bool HasObserver(Observer
* observer
) OVERRIDE
;
29 virtual void EmitLoginPromptReady() OVERRIDE
;
30 virtual void EmitLoginPromptVisible() OVERRIDE
;
31 virtual void RestartJob(int pid
, const std::string
& command_line
) OVERRIDE
;
32 virtual void RestartEntd() OVERRIDE
;
33 virtual void StartSession(const std::string
& user_email
) OVERRIDE
;
34 virtual void StopSession() OVERRIDE
;
35 virtual void StartDeviceWipe() OVERRIDE
;
36 virtual void RequestLockScreen() OVERRIDE
;
37 virtual void NotifyLockScreenShown() OVERRIDE
;
38 virtual void RequestUnlockScreen() OVERRIDE
;
39 virtual void NotifyLockScreenDismissed() OVERRIDE
;
40 virtual void RetrieveDevicePolicy(
41 const RetrievePolicyCallback
& callback
) OVERRIDE
;
42 virtual void RetrieveUserPolicy(
43 const RetrievePolicyCallback
& callback
) OVERRIDE
;
44 virtual void RetrieveDeviceLocalAccountPolicy(
45 const std::string
& account_id
,
46 const RetrievePolicyCallback
& callback
) OVERRIDE
;
47 virtual void StoreDevicePolicy(const std::string
& policy_blob
,
48 const StorePolicyCallback
& callback
) OVERRIDE
;
49 virtual void StoreUserPolicy(const std::string
& policy_blob
,
50 const StorePolicyCallback
& callback
) OVERRIDE
;
51 virtual void StoreDeviceLocalAccountPolicy(
52 const std::string
& account_id
,
53 const std::string
& policy_blob
,
54 const StorePolicyCallback
& callback
) OVERRIDE
;
56 const std::string
& device_policy() const;
57 void set_device_policy(const std::string
& policy_blob
);
59 const std::string
& user_policy() const;
60 void set_user_policy(const std::string
& policy_blob
);
62 const std::string
& device_local_account_policy(
63 const std::string
& account_id
) const;
64 void set_device_local_account_policy(const std::string
& account_id
,
65 const std::string
& policy_blob
);
67 // Notify observers about a property change completion.
68 void OnPropertyChangeComplete(bool success
);
71 std::string device_policy_
;
72 std::string user_policy_
;
73 std::map
<std::string
, std::string
> device_local_account_policy_
;
74 ObserverList
<Observer
> observers_
;
76 DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient
);
79 } // namespace chromeos
81 #endif // CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_