| 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 "chrome/browser/chromeos/login/login_manager_test.h" | 5 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if ((*it)->GetAccountId() == user_context.GetAccountId()) | 194 if ((*it)->GetAccountId() == user_context.GetAccountId()) |
| 195 return true; | 195 return true; |
| 196 } | 196 } |
| 197 return false; | 197 return false; |
| 198 } | 198 } |
| 199 | 199 |
| 200 void LoginManagerTest::LoginUser(const std::string& user_id) { | 200 void LoginManagerTest::LoginUser(const std::string& user_id) { |
| 201 const UserContext user_context = CreateUserContext(user_id); | 201 const UserContext user_context = CreateUserContext(user_id); |
| 202 SetExpectedCredentials(user_context); | 202 SetExpectedCredentials(user_context); |
| 203 EXPECT_TRUE(TryToLogin(user_context)); | 203 EXPECT_TRUE(TryToLogin(user_context)); |
| 204 // Let LoginDisplayHostImpl delete itself. | |
| 205 content::RunAllPendingInMessageLoop(); | |
| 206 } | 204 } |
| 207 | 205 |
| 208 void LoginManagerTest::AddUser(const std::string& user_id) { | 206 void LoginManagerTest::AddUser(const std::string& user_id) { |
| 209 const UserContext user_context = CreateUserContext(user_id); | 207 const UserContext user_context = CreateUserContext(user_id); |
| 210 SetExpectedCredentials(user_context); | 208 SetExpectedCredentials(user_context); |
| 211 EXPECT_TRUE(AddUserToSession(user_context)); | 209 EXPECT_TRUE(AddUserToSession(user_context)); |
| 212 } | 210 } |
| 213 | 211 |
| 214 // static | 212 // static |
| 215 std::string LoginManagerTest::GetGaiaIDForUserID(const std::string& user_id) { | 213 std::string LoginManagerTest::GetGaiaIDForUserID(const std::string& user_id) { |
| 216 return "gaia-id-" + user_id; | 214 return "gaia-id-" + user_id; |
| 217 } | 215 } |
| 218 | 216 |
| 219 void LoginManagerTest::JSExpect(const std::string& expression) { | 217 void LoginManagerTest::JSExpect(const std::string& expression) { |
| 220 js_checker_.ExpectTrue(expression); | 218 js_checker_.ExpectTrue(expression); |
| 221 } | 219 } |
| 222 | 220 |
| 223 void LoginManagerTest::InitializeWebContents() { | 221 void LoginManagerTest::InitializeWebContents() { |
| 224 LoginDisplayHost* host = LoginDisplayHost::default_host(); | 222 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
| 225 EXPECT_TRUE(host != NULL); | 223 EXPECT_TRUE(host != NULL); |
| 226 | 224 |
| 227 content::WebContents* web_contents = | 225 content::WebContents* web_contents = |
| 228 host->GetWebUILoginView()->GetWebContents(); | 226 host->GetWebUILoginView()->GetWebContents(); |
| 229 EXPECT_TRUE(web_contents != NULL); | 227 EXPECT_TRUE(web_contents != NULL); |
| 230 set_web_contents(web_contents); | 228 set_web_contents(web_contents); |
| 231 js_checker_.set_web_contents(web_contents); | 229 js_checker_.set_web_contents(web_contents); |
| 232 } | 230 } |
| 233 | 231 |
| 234 } // namespace chromeos | 232 } // namespace chromeos |
| OLD | NEW |