| 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 "base/prefs/scoped_user_pref_update.h" | 7 #include "base/prefs/scoped_user_pref_update.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 10 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool LoginManagerTest::AddUserToSession(const std::string& username, | 76 bool LoginManagerTest::AddUserToSession(const std::string& username, |
| 77 const std::string& password) { | 77 const std::string& password) { |
| 78 ExistingUserController* controller = | 78 ExistingUserController* controller = |
| 79 ExistingUserController::current_controller(); | 79 ExistingUserController::current_controller(); |
| 80 if (!controller) { | 80 if (!controller) { |
| 81 ADD_FAILURE(); | 81 ADD_FAILURE(); |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 controller->Login(UserContext(username, password, std::string())); | 84 UserContext user_context(username); |
| 85 user_context.SetPassword(password); |
| 86 controller->Login(user_context); |
| 85 content::WindowedNotificationObserver( | 87 content::WindowedNotificationObserver( |
| 86 chrome::NOTIFICATION_SESSION_STARTED, | 88 chrome::NOTIFICATION_SESSION_STARTED, |
| 87 content::NotificationService::AllSources()).Wait(); | 89 content::NotificationService::AllSources()).Wait(); |
| 88 const UserList& logged_users = UserManager::Get()->GetLoggedInUsers(); | 90 const UserList& logged_users = UserManager::Get()->GetLoggedInUsers(); |
| 89 for (UserList::const_iterator it = logged_users.begin(); | 91 for (UserList::const_iterator it = logged_users.begin(); |
| 90 it != logged_users.end(); ++it) { | 92 it != logged_users.end(); ++it) { |
| 91 if ((*it)->email() == username) | 93 if ((*it)->email() == username) |
| 92 return true; | 94 return true; |
| 93 } | 95 } |
| 94 return false; | 96 return false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 113 EXPECT_TRUE(host != NULL); | 115 EXPECT_TRUE(host != NULL); |
| 114 | 116 |
| 115 content::WebContents* web_contents = | 117 content::WebContents* web_contents = |
| 116 host->GetWebUILoginView()->GetWebContents(); | 118 host->GetWebUILoginView()->GetWebContents(); |
| 117 EXPECT_TRUE(web_contents != NULL); | 119 EXPECT_TRUE(web_contents != NULL); |
| 118 set_web_contents(web_contents); | 120 set_web_contents(web_contents); |
| 119 js_checker_.set_web_contents(web_contents); | 121 js_checker_.set_web_contents(web_contents); |
| 120 } | 122 } |
| 121 | 123 |
| 122 } // namespace chromeos | 124 } // namespace chromeos |
| OLD | NEW |