Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/chromeos/login/ui/user_adding_screen_browsertest.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ash/session/session_state_delegate.h" 5 #include "ash/session/session_state_delegate.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
10 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" 10 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
11 #include "chrome/browser/chromeos/login/login_manager_test.h" 11 #include "chrome/browser/chromeos/login/login_manager_test.h"
12 #include "chrome/browser/chromeos/login/startup_utils.h" 12 #include "chrome/browser/chromeos/login/startup_utils.h"
13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
14 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 14 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
16 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 16 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
17 #include "chrome/browser/chromeos/login/users/user_manager.h"
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
19 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
20 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
20 #include "components/user_manager/user_manager.h"
21 #include "content/public/test/test_utils.h" 21 #include "content/public/test/test_utils.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 using namespace testing; 24 using namespace testing;
25 25
26 namespace { 26 namespace {
27 27
28 const char* kTestUsers[] = {"test-user1@gmail.com", 28 const char* kTestUsers[] = {"test-user1@gmail.com",
29 "test-user2@gmail.com", 29 "test-user2@gmail.com",
30 "test-user3@gmail.com"}; 30 "test-user3@gmail.com"};
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_CancelAdding) { 86 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_CancelAdding) {
87 RegisterUser(kTestUsers[0]); 87 RegisterUser(kTestUsers[0]);
88 RegisterUser(kTestUsers[1]); 88 RegisterUser(kTestUsers[1]);
89 RegisterUser(kTestUsers[2]); 89 RegisterUser(kTestUsers[2]);
90 StartupUtils::MarkOobeCompleted(); 90 StartupUtils::MarkOobeCompleted();
91 } 91 }
92 92
93 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, CancelAdding) { 93 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, CancelAdding) {
94 EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(1); 94 EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(1);
95 EXPECT_EQ(3u, UserManager::Get()->GetUsers().size()); 95 EXPECT_EQ(3u, user_manager::UserManager::Get()->GetUsers().size());
96 EXPECT_EQ(0u, UserManager::Get()->GetLoggedInUsers().size()); 96 EXPECT_EQ(0u, user_manager::UserManager::Get()->GetLoggedInUsers().size());
97 97
98 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY, 98 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY,
99 ash::Shell::GetInstance()->session_state_delegate()-> 99 ash::Shell::GetInstance()->session_state_delegate()->
100 GetSessionState()); 100 GetSessionState());
101 101
102 LoginUser(kTestUsers[0]); 102 LoginUser(kTestUsers[0]);
103 EXPECT_EQ(1u, UserManager::Get()->GetLoggedInUsers().size()); 103 EXPECT_EQ(1u, user_manager::UserManager::Get()->GetLoggedInUsers().size());
104 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE, 104 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
105 ash::Shell::GetInstance()->session_state_delegate()-> 105 ash::Shell::GetInstance()->session_state_delegate()->
106 GetSessionState()); 106 GetSessionState());
107 107
108 UserAddingScreen::Get()->Start(); 108 UserAddingScreen::Get()->Start();
109 content::RunAllPendingInMessageLoop(); 109 content::RunAllPendingInMessageLoop();
110 EXPECT_EQ(1, user_adding_started()); 110 EXPECT_EQ(1, user_adding_started());
111 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY, 111 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY,
112 ash::Shell::GetInstance()->session_state_delegate()-> 112 ash::Shell::GetInstance()->session_state_delegate()->
113 GetSessionState()); 113 GetSessionState());
114 114
115 UserAddingScreen::Get()->Cancel(); 115 UserAddingScreen::Get()->Cancel();
116 content::RunAllPendingInMessageLoop(); 116 content::RunAllPendingInMessageLoop();
117 EXPECT_EQ(1, user_adding_finished()); 117 EXPECT_EQ(1, user_adding_finished());
118 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE, 118 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
119 ash::Shell::GetInstance()->session_state_delegate()-> 119 ash::Shell::GetInstance()->session_state_delegate()->
120 GetSessionState()); 120 GetSessionState());
121 121
122 EXPECT_TRUE(LoginDisplayHostImpl::default_host() == NULL); 122 EXPECT_TRUE(LoginDisplayHostImpl::default_host() == NULL);
123 EXPECT_EQ(1u, UserManager::Get()->GetLoggedInUsers().size()); 123 EXPECT_EQ(1u, user_manager::UserManager::Get()->GetLoggedInUsers().size());
124 EXPECT_EQ(kTestUsers[0], UserManager::Get()->GetActiveUser()->email()); 124 EXPECT_EQ(kTestUsers[0],
125 user_manager::UserManager::Get()->GetActiveUser()->email());
125 } 126 }
126 127
127 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_AddingSeveralUsers) { 128 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_AddingSeveralUsers) {
128 RegisterUser(kTestUsers[0]); 129 RegisterUser(kTestUsers[0]);
129 RegisterUser(kTestUsers[1]); 130 RegisterUser(kTestUsers[1]);
130 RegisterUser(kTestUsers[2]); 131 RegisterUser(kTestUsers[2]);
131 StartupUtils::MarkOobeCompleted(); 132 StartupUtils::MarkOobeCompleted();
132 } 133 }
133 134
134 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, AddingSeveralUsers) { 135 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, AddingSeveralUsers) {
135 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY, 136 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY,
136 ash::Shell::GetInstance()->session_state_delegate()-> 137 ash::Shell::GetInstance()->session_state_delegate()->
137 GetSessionState()); 138 GetSessionState());
138 EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(3); 139 EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(3);
139 LoginUser(kTestUsers[0]); 140 LoginUser(kTestUsers[0]);
140 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE, 141 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
141 ash::Shell::GetInstance()->session_state_delegate()-> 142 ash::Shell::GetInstance()->session_state_delegate()->
142 GetSessionState()); 143 GetSessionState());
143 144
144 UserManager* user_manager = UserManager::Get(); 145 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
145 146
146 for (int i = 1; i < 3; ++i) { 147 for (int i = 1; i < 3; ++i) {
147 UserAddingScreen::Get()->Start(); 148 UserAddingScreen::Get()->Start();
148 content::RunAllPendingInMessageLoop(); 149 content::RunAllPendingInMessageLoop();
149 EXPECT_EQ(i, user_adding_started()); 150 EXPECT_EQ(i, user_adding_started());
150 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY, 151 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY,
151 ash::Shell::GetInstance()->session_state_delegate()-> 152 ash::Shell::GetInstance()->session_state_delegate()->
152 GetSessionState()); 153 GetSessionState());
153 AddUser(kTestUsers[i]); 154 AddUser(kTestUsers[i]);
154 EXPECT_EQ(i, user_adding_finished()); 155 EXPECT_EQ(i, user_adding_finished());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 content::NotificationService::AllSources()).Wait(); 264 content::NotificationService::AllSources()).Wait();
264 265
265 UserAddingScreen::Get()->Start(); 266 UserAddingScreen::Get()->Start();
266 content::RunAllPendingInMessageLoop(); 267 content::RunAllPendingInMessageLoop();
267 CheckScreenIsVisible(); 268 CheckScreenIsVisible();
268 UserAddingScreen::Get()->Cancel(); 269 UserAddingScreen::Get()->Cancel();
269 content::RunAllPendingInMessageLoop(); 270 content::RunAllPendingInMessageLoop();
270 } 271 }
271 272
272 } // namespace chromeos 273 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/user_adding_screen.cc ('k') | chrome/browser/chromeos/login/ui/webui_login_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698