| 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(); |
| 204 } | 206 } |
| 205 | 207 |
| 206 void LoginManagerTest::AddUser(const std::string& user_id) { | 208 void LoginManagerTest::AddUser(const std::string& user_id) { |
| 207 const UserContext user_context = CreateUserContext(user_id); | 209 const UserContext user_context = CreateUserContext(user_id); |
| 208 SetExpectedCredentials(user_context); | 210 SetExpectedCredentials(user_context); |
| 209 EXPECT_TRUE(AddUserToSession(user_context)); | 211 EXPECT_TRUE(AddUserToSession(user_context)); |
| 210 } | 212 } |
| 211 | 213 |
| 212 // static | 214 // static |
| 213 std::string LoginManagerTest::GetGaiaIDForUserID(const std::string& user_id) { | 215 std::string LoginManagerTest::GetGaiaIDForUserID(const std::string& user_id) { |
| 214 return "gaia-id-" + user_id; | 216 return "gaia-id-" + user_id; |
| 215 } | 217 } |
| 216 | 218 |
| 217 void LoginManagerTest::JSExpect(const std::string& expression) { | 219 void LoginManagerTest::JSExpect(const std::string& expression) { |
| 218 js_checker_.ExpectTrue(expression); | 220 js_checker_.ExpectTrue(expression); |
| 219 } | 221 } |
| 220 | 222 |
| 221 void LoginManagerTest::InitializeWebContents() { | 223 void LoginManagerTest::InitializeWebContents() { |
| 222 LoginDisplayHost* host = LoginDisplayHost::default_host(); | 224 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
| 223 EXPECT_TRUE(host != NULL); | 225 EXPECT_TRUE(host != NULL); |
| 224 | 226 |
| 225 content::WebContents* web_contents = | 227 content::WebContents* web_contents = |
| 226 host->GetWebUILoginView()->GetWebContents(); | 228 host->GetWebUILoginView()->GetWebContents(); |
| 227 EXPECT_TRUE(web_contents != NULL); | 229 EXPECT_TRUE(web_contents != NULL); |
| 228 set_web_contents(web_contents); | 230 set_web_contents(web_contents); |
| 229 js_checker_.set_web_contents(web_contents); | 231 js_checker_.set_web_contents(web_contents); |
| 230 } | 232 } |
| 231 | 233 |
| 232 } // namespace chromeos | 234 } // namespace chromeos |
| OLD | NEW |