| OLD | NEW |
| 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 #include "chromeos/dbus/fake_session_manager_client.h" | 5 #include "chromeos/dbus/fake_session_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chromeos/dbus/cryptohome_client.h" |
| 11 | 12 |
| 12 namespace chromeos { | 13 namespace chromeos { |
| 13 | 14 |
| 14 FakeSessionManagerClient::FakeSessionManagerClient() | 15 FakeSessionManagerClient::FakeSessionManagerClient() |
| 15 : emit_login_prompt_ready_call_count_(0) , | 16 : emit_login_prompt_ready_call_count_(0) , |
| 16 notify_lock_screen_shown_call_count_(0), | 17 notify_lock_screen_shown_call_count_(0), |
| 17 notify_lock_screen_dismissed_call_count_(0){ | 18 notify_lock_screen_dismissed_call_count_(0){ |
| 18 } | 19 } |
| 19 | 20 |
| 20 FakeSessionManagerClient::~FakeSessionManagerClient() { | 21 FakeSessionManagerClient::~FakeSessionManagerClient() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 } | 41 } |
| 41 | 42 |
| 42 void FakeSessionManagerClient::RestartJob(int pid, | 43 void FakeSessionManagerClient::RestartJob(int pid, |
| 43 const std::string& command_line) { | 44 const std::string& command_line) { |
| 44 } | 45 } |
| 45 | 46 |
| 46 void FakeSessionManagerClient::RestartEntd() { | 47 void FakeSessionManagerClient::RestartEntd() { |
| 47 } | 48 } |
| 48 | 49 |
| 49 void FakeSessionManagerClient::StartSession(const std::string& user_email) { | 50 void FakeSessionManagerClient::StartSession(const std::string& user_email) { |
| 51 DCHECK_EQ(0UL, user_sessions_.count(user_email)); |
| 52 std::string user_id_hash = |
| 53 CryptohomeClient::GetStubSanitizedUsername(user_email); |
| 54 user_sessions_[user_email] = user_id_hash; |
| 50 } | 55 } |
| 51 | 56 |
| 52 void FakeSessionManagerClient::StopSession() { | 57 void FakeSessionManagerClient::StopSession() { |
| 53 } | 58 } |
| 54 | 59 |
| 55 void FakeSessionManagerClient::StartDeviceWipe() { | 60 void FakeSessionManagerClient::StartDeviceWipe() { |
| 56 } | 61 } |
| 57 | 62 |
| 58 void FakeSessionManagerClient::RequestLockScreen() { | 63 void FakeSessionManagerClient::RequestLockScreen() { |
| 59 } | 64 } |
| 60 | 65 |
| 61 void FakeSessionManagerClient::NotifyLockScreenShown() { | 66 void FakeSessionManagerClient::NotifyLockScreenShown() { |
| 62 notify_lock_screen_shown_call_count_++; | 67 notify_lock_screen_shown_call_count_++; |
| 63 } | 68 } |
| 64 | 69 |
| 65 void FakeSessionManagerClient::RequestUnlockScreen() { | 70 void FakeSessionManagerClient::RequestUnlockScreen() { |
| 66 } | 71 } |
| 67 | 72 |
| 68 void FakeSessionManagerClient::NotifyLockScreenDismissed() { | 73 void FakeSessionManagerClient::NotifyLockScreenDismissed() { |
| 69 notify_lock_screen_dismissed_call_count_++; | 74 notify_lock_screen_dismissed_call_count_++; |
| 70 } | 75 } |
| 71 | 76 |
| 72 void FakeSessionManagerClient::RetrieveActiveSessions( | 77 void FakeSessionManagerClient::RetrieveActiveSessions( |
| 73 const ActiveSessionsCallback& callback) { | 78 const ActiveSessionsCallback& callback) { |
| 74 ActiveSessionsMap sessions; | |
| 75 MessageLoop::current()->PostTask(FROM_HERE, | 79 MessageLoop::current()->PostTask(FROM_HERE, |
| 76 base::Bind(callback, | 80 base::Bind(callback, |
| 77 sessions, | 81 user_sessions_, |
| 78 true)); | 82 true)); |
| 79 } | 83 } |
| 80 | 84 |
| 81 void FakeSessionManagerClient::RetrieveDevicePolicy( | 85 void FakeSessionManagerClient::RetrieveDevicePolicy( |
| 82 const RetrievePolicyCallback& callback) { | 86 const RetrievePolicyCallback& callback) { |
| 83 MessageLoop::current()->PostTask(FROM_HERE, | 87 MessageLoop::current()->PostTask(FROM_HERE, |
| 84 base::Bind(callback, device_policy_)); | 88 base::Bind(callback, device_policy_)); |
| 85 } | 89 } |
| 86 | 90 |
| 87 void FakeSessionManagerClient::RetrievePolicyForUser( | 91 void FakeSessionManagerClient::RetrievePolicyForUser( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 const std::string& account_id, | 161 const std::string& account_id, |
| 158 const std::string& policy_blob) { | 162 const std::string& policy_blob) { |
| 159 device_local_account_policy_[account_id] = policy_blob; | 163 device_local_account_policy_[account_id] = policy_blob; |
| 160 } | 164 } |
| 161 | 165 |
| 162 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) { | 166 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) { |
| 163 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); | 167 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); |
| 164 } | 168 } |
| 165 | 169 |
| 166 } // namespace chromeos | 170 } // namespace chromeos |
| OLD | NEW |