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

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: Change FIXME to TODO. 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
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 "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest, 157 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest,
158 PRE_PRE_CreateAndCancelSupervisedUser) { 158 PRE_PRE_CreateAndCancelSupervisedUser) {
159 PrepareUsers(); 159 PrepareUsers();
160 } 160 }
161 161
162 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest, 162 IN_PROC_BROWSER_TEST_F(SupervisedUserTransactionCleanupTest,
163 PRE_CreateAndCancelSupervisedUser) { 163 PRE_CreateAndCancelSupervisedUser) {
164 StartFlowLoginAsManager(); 164 StartFlowLoginAsManager();
165 FillNewUserData(kTestSupervisedUserDisplayName); 165 FillNewUserData(kTestSupervisedUserDisplayName);
166 166
167 base::RunLoop mount_wait_loop;
168 base::RunLoop add_key_wait_loop;
achuithb 2016/11/30 22:39:52 Any reason to not put both on the same line?
Alexander Semashko 2016/12/01 12:24:59 Done. I thought it was discouraged by the style gu
169 mock_homedir_methods_->set_mount_callback(mount_wait_loop.QuitClosure());
170 mock_homedir_methods_->set_add_key_callback(add_key_wait_loop.QuitClosure());
167 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1); 171 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1);
168 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); 172 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1);
169 173
170 JSEval("$('supervised-user-creation-next-button').click()"); 174 JSEval("$('supervised-user-creation-next-button').click()");
171 175
176 mount_wait_loop.Run();
177 add_key_wait_loop.Run();
172 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); 178 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_);
179 mock_homedir_methods_->set_mount_callback(base::Closure());
180 mock_homedir_methods_->set_add_key_callback(base::Closure());
173 181
174 EXPECT_TRUE(registration_utility_stub_->register_was_called()); 182 EXPECT_TRUE(registration_utility_stub_->register_was_called());
175 EXPECT_EQ(registration_utility_stub_->display_name(), 183 EXPECT_EQ(registration_utility_stub_->display_name(),
176 base::UTF8ToUTF16(kTestSupervisedUserDisplayName)); 184 base::UTF8ToUTF16(kTestSupervisedUserDisplayName));
177 185
178 std::string user_id = registration_utility_stub_->supervised_user_id(); 186 std::string user_id = registration_utility_stub_->supervised_user_id();
179 187
180 // Make sure user is already in list. 188 // Make sure user is already in list.
181 ASSERT_EQ(3UL, user_manager::UserManager::Get()->GetUsers().size()); 189 ASSERT_EQ(3UL, user_manager::UserManager::Get()->GetUsers().size());
182 190
183 // We wait for token now. Press cancel button at this point. 191 // We wait for token now. Press cancel button at this point.
184 JSEvalOrExitBrowser("$('supervised-user-creation').cancel()"); 192 JSEvalOrExitBrowser("$('supervised-user-creation').cancel()");
193
194 // TODO(achuith): There should probably be a wait for a specific event.
195 content::RunAllPendingInMessageLoop();
185 } 196 }
186 197
187 IN_PROC_BROWSER_TEST_( 198 IN_PROC_BROWSER_TEST_(
188 SupervisedUserTransactionCleanupTest, 199 SupervisedUserTransactionCleanupTest,
189 CreateAndCancelSupervisedUser, 200 CreateAndCancelSupervisedUser,
190 SupervisedUserTransactionCleanupTest2, 201 SupervisedUserTransactionCleanupTest2,
191 testing::internal::GetTypeId<SupervisedUserTransactionCleanupTest>()) { 202 testing::internal::GetTypeId<SupervisedUserTransactionCleanupTest>()) {
192 // Make sure there is no supervised user in list. 203 // Make sure there is no supervised user in list.
193 ASSERT_EQ(2UL, user_manager::UserManager::Get()->GetUsers().size()); 204 ASSERT_EQ(2UL, user_manager::UserManager::Get()->GetUsers().size());
194 } 205 }
195 206
196 } // namespace chromeos 207 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698