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> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/chromeos/login/auth/key.h" |
13 #include "chrome/browser/chromeos/login/auth/user_context.h" | 14 #include "chrome/browser/chromeos/login/auth/user_context.h" |
14 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 16 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
16 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 17 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
17 #include "chrome/browser/chromeos/login/users/user.h" | 18 #include "chrome/browser/chromeos/login/users/user.h" |
18 #include "chrome/browser/chromeos/login/users/user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/user_manager.h" |
19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
20 #include "chrome/browser/extensions/extension_test_message_listener.h" | 21 #include "chrome/browser/extensions/extension_test_message_listener.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 bool AddUserToSession(const std::string& username, | 224 bool AddUserToSession(const std::string& username, |
224 const std::string& password) { | 225 const std::string& password) { |
225 ExistingUserController* controller = | 226 ExistingUserController* controller = |
226 ExistingUserController::current_controller(); | 227 ExistingUserController::current_controller(); |
227 if (!controller) { | 228 if (!controller) { |
228 ADD_FAILURE(); | 229 ADD_FAILURE(); |
229 return false; | 230 return false; |
230 } | 231 } |
231 | 232 |
232 UserContext user_context(username); | 233 UserContext user_context(username); |
233 user_context.SetPassword(password); | 234 user_context.SetKey(Key(password)); |
234 controller->Login(user_context); | 235 controller->Login(user_context); |
235 content::WindowedNotificationObserver( | 236 content::WindowedNotificationObserver( |
236 chrome::NOTIFICATION_SESSION_STARTED, | 237 chrome::NOTIFICATION_SESSION_STARTED, |
237 content::NotificationService::AllSources()).Wait(); | 238 content::NotificationService::AllSources()).Wait(); |
238 const UserList& logged_users = UserManager::Get()->GetLoggedInUsers(); | 239 const UserList& logged_users = UserManager::Get()->GetLoggedInUsers(); |
239 for (UserList::const_iterator it = logged_users.begin(); | 240 for (UserList::const_iterator it = logged_users.begin(); |
240 it != logged_users.end(); ++it) { | 241 it != logged_users.end(); ++it) { |
241 if ((*it)->email() == username) | 242 if ((*it)->email() == username) |
242 return true; | 243 return true; |
243 } | 244 } |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 775 |
775 if (!catcher.GetNextResult()) { | 776 if (!catcher.GetNextResult()) { |
776 std::string message = catcher.message(); | 777 std::string message = catcher.message(); |
777 ADD_FAILURE() << "Tests failed: " << message; | 778 ADD_FAILURE() << "Tests failed: " << message; |
778 } | 779 } |
779 | 780 |
780 EXPECT_TRUE(fake_google_.IsPageRequested()); | 781 EXPECT_TRUE(fake_google_.IsPageRequested()); |
781 } | 782 } |
782 | 783 |
783 } // namespace chromeos | 784 } // namespace chromeos |
OLD | NEW |