OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> |
| 6 |
5 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
6 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
8 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 13 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
12 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 14 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
13 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 15 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
14 #include "chrome/browser/chromeos/login/users/user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/user_manager.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 220 |
219 bool AddUserToSession(const std::string& username, | 221 bool AddUserToSession(const std::string& username, |
220 const std::string& password) { | 222 const std::string& password) { |
221 ExistingUserController* controller = | 223 ExistingUserController* controller = |
222 ExistingUserController::current_controller(); | 224 ExistingUserController::current_controller(); |
223 if (!controller) { | 225 if (!controller) { |
224 ADD_FAILURE(); | 226 ADD_FAILURE(); |
225 return false; | 227 return false; |
226 } | 228 } |
227 | 229 |
228 controller->Login(UserContext(username, password, std::string())); | 230 UserContext user_context(username); |
| 231 user_context.SetPassword(password); |
| 232 controller->Login(user_context); |
229 content::WindowedNotificationObserver( | 233 content::WindowedNotificationObserver( |
230 chrome::NOTIFICATION_SESSION_STARTED, | 234 chrome::NOTIFICATION_SESSION_STARTED, |
231 content::NotificationService::AllSources()).Wait(); | 235 content::NotificationService::AllSources()).Wait(); |
232 const UserList& logged_users = UserManager::Get()->GetLoggedInUsers(); | 236 const UserList& logged_users = UserManager::Get()->GetLoggedInUsers(); |
233 for (UserList::const_iterator it = logged_users.begin(); | 237 for (UserList::const_iterator it = logged_users.begin(); |
234 it != logged_users.end(); ++it) { | 238 it != logged_users.end(); ++it) { |
235 if ((*it)->email() == username) | 239 if ((*it)->email() == username) |
236 return true; | 240 return true; |
237 } | 241 } |
238 return false; | 242 return false; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 772 |
769 if (!catcher.GetNextResult()) { | 773 if (!catcher.GetNextResult()) { |
770 std::string message = catcher.message(); | 774 std::string message = catcher.message(); |
771 ADD_FAILURE() << "Tests failed: " << message; | 775 ADD_FAILURE() << "Tests failed: " << message; |
772 } | 776 } |
773 | 777 |
774 EXPECT_TRUE(fake_google_.IsPageRequested()); | 778 EXPECT_TRUE(fake_google_.IsPageRequested()); |
775 } | 779 } |
776 | 780 |
777 } // namespace chromeos | 781 } // namespace chromeos |
OLD | NEW |