Chromium Code Reviews| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 return observers_.HasObserver(observer); | 39 return observers_.HasObserver(observer); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void FakeSessionManagerClient::EmitLoginPromptVisible() { | 42 void FakeSessionManagerClient::EmitLoginPromptVisible() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FakeSessionManagerClient::RestartJob(int pid, | 45 void FakeSessionManagerClient::RestartJob(int pid, |
| 46 const std::string& command_line) { | 46 const std::string& command_line) { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void FakeSessionManagerClient::StartSession(const std::string& user_email) { | 49 void FakeSessionManagerClient::StartSession( |
| 50 const std::string& user_email, | |
| 51 const StartSessionCallback& callback) { | |
| 50 DCHECK_EQ(0UL, user_sessions_.count(user_email)); | 52 DCHECK_EQ(0UL, user_sessions_.count(user_email)); |
| 51 std::string user_id_hash = | 53 std::string user_id_hash = |
| 52 CryptohomeClient::GetStubSanitizedUsername(user_email); | 54 CryptohomeClient::GetStubSanitizedUsername(user_email); |
| 53 user_sessions_[user_email] = user_id_hash; | 55 user_sessions_[user_email] = user_id_hash; |
| 56 base::MessageLoop* loop = base::MessageLoop::current(); | |
| 57 // We need to check cause in some testing environments there is no loop and | |
| 58 // MessageLoop::current() returns NULL. | |
|
oshima
2014/04/22 10:03:32
Isn't it possible to create a message lop in such
Roman Sorokin (ftl)
2014/04/24 11:49:25
Yes, it is. In this browser test we need to start
| |
| 59 if (loop) | |
| 60 loop->PostTask(FROM_HERE, base::Bind(callback, true)); | |
| 61 else | |
| 62 callback.Run(true); | |
| 54 } | 63 } |
| 55 | 64 |
| 56 void FakeSessionManagerClient::StopSession() { | 65 void FakeSessionManagerClient::StopSession() { |
| 57 } | 66 } |
| 58 | 67 |
| 59 void FakeSessionManagerClient::StartDeviceWipe() { | 68 void FakeSessionManagerClient::StartDeviceWipe() { |
| 60 start_device_wipe_call_count_++; | 69 start_device_wipe_call_count_++; |
| 61 } | 70 } |
| 62 | 71 |
| 63 void FakeSessionManagerClient::RequestLockScreen() { | 72 void FakeSessionManagerClient::RequestLockScreen() { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 const std::string& account_id, | 175 const std::string& account_id, |
| 167 const std::string& policy_blob) { | 176 const std::string& policy_blob) { |
| 168 device_local_account_policy_[account_id] = policy_blob; | 177 device_local_account_policy_[account_id] = policy_blob; |
| 169 } | 178 } |
| 170 | 179 |
| 171 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) { | 180 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) { |
| 172 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); | 181 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); |
| 173 } | 182 } |
| 174 | 183 |
| 175 } // namespace chromeos | 184 } // namespace chromeos |
| OLD | NEW |