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

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_creation_browsertest.cc

Issue 2540683002: Don't defer quitting in ExecuteScript and other helpers that use DOMMessageQueue. (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/supervised/supervised_user_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "ash/common/system/status_area_widget.h" 7 #include "ash/common/system/status_area_widget.h"
8 #include "ash/common/system/web_notification/web_notification_tray.h" 8 #include "ash/common/system/web_notification/web_notification_tray.h"
9 #include "ash/test/status_area_widget_test_helper.h" 9 #include "ash/test/status_area_widget_test_helper.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest, 170 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest,
171 PRE_PRE_CreateAndCancelSupervisedUser) { 171 PRE_PRE_CreateAndCancelSupervisedUser) {
172 PrepareUsers(); 172 PrepareUsers();
173 } 173 }
174 174
175 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest, 175 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest,
176 PRE_CreateAndCancelSupervisedUser) { 176 PRE_CreateAndCancelSupervisedUser) {
177 StartFlowLoginAsManager(); 177 StartFlowLoginAsManager();
178 FillNewUserData(kTestSupervisedUserDisplayName); 178 FillNewUserData(kTestSupervisedUserDisplayName);
179 179
180 base::RunLoop mount_wait_loop, add_key_wait_loop;
181 mock_homedir_methods_->set_mount_callback(mount_wait_loop.QuitClosure());
182 mock_homedir_methods_->set_add_key_callback(add_key_wait_loop.QuitClosure());
180 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1); 183 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1);
181 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); 184 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1);
182 185
183 JSEval("$('supervised-user-creation-next-button').click()"); 186 JSEval("$('supervised-user-creation-next-button').click()");
184 187
188 mount_wait_loop.Run();
189 add_key_wait_loop.Run();
185 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); 190 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_);
191 mock_homedir_methods_->set_mount_callback(base::Closure());
192 mock_homedir_methods_->set_add_key_callback(base::Closure());
186 193
187 EXPECT_TRUE(registration_utility_stub_->register_was_called()); 194 EXPECT_TRUE(registration_utility_stub_->register_was_called());
188 EXPECT_EQ(registration_utility_stub_->display_name(), 195 EXPECT_EQ(registration_utility_stub_->display_name(),
189 base::UTF8ToUTF16(kTestSupervisedUserDisplayName)); 196 base::UTF8ToUTF16(kTestSupervisedUserDisplayName));
190 197
191 std::string user_id = registration_utility_stub_->supervised_user_id(); 198 std::string user_id = registration_utility_stub_->supervised_user_id();
192 199
193 // Make sure user is already in list. 200 // Make sure user is already in list.
194 ASSERT_EQ(3UL, user_manager::UserManager::Get()->GetUsers().size()); 201 ASSERT_EQ(3UL, user_manager::UserManager::Get()->GetUsers().size());
195 202
196 // We wait for token now. Press cancel button at this point. 203 // We wait for token now. Press cancel button at this point.
197 JSEvalOrExitBrowser("$('supervised-user-creation').cancel()"); 204 JSEvalOrExitBrowser("$('supervised-user-creation').cancel()");
205
206 // TODO(achuith): There should probably be a wait for a specific event.
207 content::RunAllPendingInMessageLoop();
198 } 208 }
199 209
200 IN_PROC_BROWSER_TEST_F(SupervisedUserCreationTest, 210 IN_PROC_BROWSER_TEST_F(SupervisedUserCreationTest,
201 PRE_PRE_PRE_CheckNoNotificationTray) { 211 PRE_PRE_PRE_CheckNoNotificationTray) {
202 PrepareUsers(); 212 PrepareUsers();
203 } 213 }
204 214
205 IN_PROC_BROWSER_TEST_F(SupervisedUserCreationTest, 215 IN_PROC_BROWSER_TEST_F(SupervisedUserCreationTest,
206 PRE_PRE_CheckNoNotificationTray) { 216 PRE_PRE_CheckNoNotificationTray) {
207 // Before sign-in, the tray should not be visible. 217 // Before sign-in, the tray should not be visible.
(...skipping 24 matching lines...) Expand all
232 IN_PROC_BROWSER_TEST_( 242 IN_PROC_BROWSER_TEST_(
233 SupervisedUserTransactionCleanupTest, 243 SupervisedUserTransactionCleanupTest,
234 CreateAndCancelSupervisedUser, 244 CreateAndCancelSupervisedUser,
235 SupervisedUserTransactionCleanupTest2, 245 SupervisedUserTransactionCleanupTest2,
236 testing::internal::GetTypeId<SupervisedUserTransactionCleanupTest>()) { 246 testing::internal::GetTypeId<SupervisedUserTransactionCleanupTest>()) {
237 // Make sure there is no supervised user in list. 247 // Make sure there is no supervised user in list.
238 ASSERT_EQ(2UL, user_manager::UserManager::Get()->GetUsers().size()); 248 ASSERT_EQ(2UL, user_manager::UserManager::Get()->GetUsers().size());
239 } 249 }
240 250
241 } // namespace chromeos 251 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/supervised/supervised_user_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698