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

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

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests. Created 4 years, 9 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
« no previous file with comments | « chromeos/dbus/fake_cryptohome_client.cc ('k') | chromeos/dbus/fake_session_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 2013 The Chromium Authors. All rights reserved. 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 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_SESSION_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "chromeos/cryptohome/cryptohome_parameters.h"
15 #include "chromeos/dbus/session_manager_client.h" 16 #include "chromeos/dbus/session_manager_client.h"
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 // A fake implementation of session_manager. Accepts policy blobs to be set and 20 // A fake implementation of session_manager. Accepts policy blobs to be set and
20 // returns them unmodified. 21 // returns them unmodified.
21 class FakeSessionManagerClient : public SessionManagerClient { 22 class FakeSessionManagerClient : public SessionManagerClient {
22 public: 23 public:
23 FakeSessionManagerClient(); 24 FakeSessionManagerClient();
24 ~FakeSessionManagerClient() override; 25 ~FakeSessionManagerClient() override;
25 26
26 // SessionManagerClient overrides 27 // SessionManagerClient overrides
27 void Init(dbus::Bus* bus) override; 28 void Init(dbus::Bus* bus) override;
28 void SetStubDelegate(StubDelegate* delegate) override; 29 void SetStubDelegate(StubDelegate* delegate) override;
29 void AddObserver(Observer* observer) override; 30 void AddObserver(Observer* observer) override;
30 void RemoveObserver(Observer* observer) override; 31 void RemoveObserver(Observer* observer) override;
31 bool HasObserver(const Observer* observer) const override; 32 bool HasObserver(const Observer* observer) const override;
32 bool IsScreenLocked() const override; 33 bool IsScreenLocked() const override;
33 void EmitLoginPromptVisible() override; 34 void EmitLoginPromptVisible() override;
34 void RestartJob(const std::vector<std::string>& argv) override; 35 void RestartJob(const std::vector<std::string>& argv) override;
35 void StartSession(const std::string& user_email) override; 36 void StartSession(const cryptohome::Identification& cryptohome_id) override;
36 void StopSession() override; 37 void StopSession() override;
37 void NotifySupervisedUserCreationStarted() override; 38 void NotifySupervisedUserCreationStarted() override;
38 void NotifySupervisedUserCreationFinished() override; 39 void NotifySupervisedUserCreationFinished() override;
39 void StartDeviceWipe() override; 40 void StartDeviceWipe() override;
40 void RequestLockScreen() override; 41 void RequestLockScreen() override;
41 void NotifyLockScreenShown() override; 42 void NotifyLockScreenShown() override;
42 void NotifyLockScreenDismissed() override; 43 void NotifyLockScreenDismissed() override;
43 void RetrieveActiveSessions(const ActiveSessionsCallback& callback) override; 44 void RetrieveActiveSessions(const ActiveSessionsCallback& callback) override;
44 void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) override; 45 void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) override;
45 void RetrievePolicyForUser(const std::string& username, 46 void RetrievePolicyForUser(const cryptohome::Identification& cryptohome_id,
46 const RetrievePolicyCallback& callback) override; 47 const RetrievePolicyCallback& callback) override;
47 std::string BlockingRetrievePolicyForUser( 48 std::string BlockingRetrievePolicyForUser(
48 const std::string& username) override; 49 const cryptohome::Identification& cryptohome_id) override;
49 void RetrieveDeviceLocalAccountPolicy( 50 void RetrieveDeviceLocalAccountPolicy(
50 const std::string& account_id, 51 const std::string& account_id,
51 const RetrievePolicyCallback& callback) override; 52 const RetrievePolicyCallback& callback) override;
52 void StoreDevicePolicy(const std::string& policy_blob, 53 void StoreDevicePolicy(const std::string& policy_blob,
53 const StorePolicyCallback& callback) override; 54 const StorePolicyCallback& callback) override;
54 void StorePolicyForUser(const std::string& username, 55 void StorePolicyForUser(const cryptohome::Identification& cryptohome_id,
55 const std::string& policy_blob, 56 const std::string& policy_blob,
56 const StorePolicyCallback& callback) override; 57 const StorePolicyCallback& callback) override;
57 void StoreDeviceLocalAccountPolicy( 58 void StoreDeviceLocalAccountPolicy(
58 const std::string& account_id, 59 const std::string& account_id,
59 const std::string& policy_blob, 60 const std::string& policy_blob,
60 const StorePolicyCallback& callback) override; 61 const StorePolicyCallback& callback) override;
61 void SetFlagsForUser(const std::string& username, 62 void SetFlagsForUser(const cryptohome::Identification& cryptohome_id,
62 const std::vector<std::string>& flags) override; 63 const std::vector<std::string>& flags) override;
63 void GetServerBackedStateKeys(const StateKeysCallback& callback) override; 64 void GetServerBackedStateKeys(const StateKeysCallback& callback) override;
64 65
65 void CheckArcAvailability(const ArcCallback& callback) override; 66 void CheckArcAvailability(const ArcCallback& callback) override;
66 void StartArcInstance(const std::string& socket_path, 67 void StartArcInstance(const std::string& socket_path,
67 const ArcCallback& callback) override; 68 const ArcCallback& callback) override;
68 void StopArcInstance(const ArcCallback& callback) override; 69 void StopArcInstance(const ArcCallback& callback) override;
69 70
70 const std::string& device_policy() const; 71 const std::string& device_policy() const;
71 void set_device_policy(const std::string& policy_blob); 72 void set_device_policy(const std::string& policy_blob);
72 73
73 const std::string& user_policy(const std::string& username) const; 74 const std::string& user_policy(
74 void set_user_policy(const std::string& username, 75 const cryptohome::Identification& cryptohome_id) const;
76 void set_user_policy(const cryptohome::Identification& cryptohome_id,
75 const std::string& policy_blob); 77 const std::string& policy_blob);
76 78
77 const std::string& device_local_account_policy( 79 const std::string& device_local_account_policy(
78 const std::string& account_id) const; 80 const std::string& account_id) const;
79 void set_device_local_account_policy(const std::string& account_id, 81 void set_device_local_account_policy(const std::string& account_id,
80 const std::string& policy_blob); 82 const std::string& policy_blob);
81 83
82 // Notify observers about a property change completion. 84 // Notify observers about a property change completion.
83 void OnPropertyChangeComplete(bool success); 85 void OnPropertyChangeComplete(bool success);
84 86
(...skipping 13 matching lines...) Expand all
98 return notify_lock_screen_shown_call_count_; 100 return notify_lock_screen_shown_call_count_;
99 } 101 }
100 102
101 // Returns how many times LockScreenDismissed() was called. 103 // Returns how many times LockScreenDismissed() was called.
102 int notify_lock_screen_dismissed_call_count() const { 104 int notify_lock_screen_dismissed_call_count() const {
103 return notify_lock_screen_dismissed_call_count_; 105 return notify_lock_screen_dismissed_call_count_;
104 } 106 }
105 107
106 private: 108 private:
107 std::string device_policy_; 109 std::string device_policy_;
108 std::map<std::string, std::string> user_policies_; 110 std::map<cryptohome::Identification, std::string> user_policies_;
109 std::map<std::string, std::string> device_local_account_policy_; 111 std::map<std::string, std::string> device_local_account_policy_;
110 base::ObserverList<Observer> observers_; 112 base::ObserverList<Observer> observers_;
111 SessionManagerClient::ActiveSessionsMap user_sessions_; 113 SessionManagerClient::ActiveSessionsMap user_sessions_;
112 std::vector<std::string> server_backed_state_keys_; 114 std::vector<std::string> server_backed_state_keys_;
113 115
114 int start_device_wipe_call_count_; 116 int start_device_wipe_call_count_;
115 int notify_lock_screen_shown_call_count_; 117 int notify_lock_screen_shown_call_count_;
116 int notify_lock_screen_dismissed_call_count_; 118 int notify_lock_screen_dismissed_call_count_;
117 119
118 DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient); 120 DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient);
119 }; 121 };
120 122
121 } // namespace chromeos 123 } // namespace chromeos
122 124
123 #endif // CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_ 125 #endif // CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_cryptohome_client.cc ('k') | chromeos/dbus/fake_session_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698