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

Side by Side Diff: chrome/browser/chromeos/login/test/oobe_base_test.cc

Issue 2668043002: Reland cros: Test for overlapping ContinueSessionRestore calls (Closed)
Patch Set: for comments in #4 Created 3 years, 10 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
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 "chrome/browser/chromeos/login/test/oobe_base_test.h" 5 #include "chrome/browser/chromeos/login/test/oobe_base_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return static_cast<WebUILoginDisplay*>( 221 return static_cast<WebUILoginDisplay*>(
222 controller->login_display()); 222 controller->login_display());
223 } 223 }
224 224
225 void OobeBaseTest::WaitForGaiaPageLoad() { 225 void OobeBaseTest::WaitForGaiaPageLoad() {
226 WaitForSigninScreen(); 226 WaitForSigninScreen();
227 WaitForGaiaPageReload(); 227 WaitForGaiaPageReload();
228 } 228 }
229 229
230 void OobeBaseTest::WaitForGaiaPageReload() { 230 void OobeBaseTest::WaitForGaiaPageReload() {
231 JS() 231 // Starts listening to message before executing the JS code that generates
232 .Evaluate( 232 // the message below.
233 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready'," 233 content::DOMMessageQueue message_queue;
234 "function f() {"
235 "$(\'gaia-signin\').gaiaAuthHost_.removeEventListener(\'ready\', f);"
236 "window.domAutomationController.setAutomationId(0);"
237 "window.domAutomationController.send('GaiaReady');"
238 "});");
239 234
240 content::DOMMessageQueue message_queue; 235 JS().Evaluate(
236 "(function() {"
237 " var authenticator = $('gaia-signin').gaiaAuthHost_;"
238 " var f = function() {"
239 " authenticator.removeEventListener('ready', f);"
240 " window.domAutomationController.setAutomationId(0);"
241 " window.domAutomationController.send('GaiaReady');"
242 " };"
243 " authenticator.addEventListener('ready', f);"
244 "})();");
245
241 std::string message; 246 std::string message;
242 do { 247 do {
243 ASSERT_TRUE(message_queue.WaitForMessage(&message)); 248 ASSERT_TRUE(message_queue.WaitForMessage(&message));
244 } while (message != "\"GaiaReady\""); 249 } while (message != "\"GaiaReady\"");
245 } 250 }
246 251
247 void OobeBaseTest::WaitForSigninScreen() { 252 void OobeBaseTest::WaitForSigninScreen() {
248 WizardController* wizard_controller = WizardController::default_controller(); 253 WizardController* wizard_controller = WizardController::default_controller();
249 if (wizard_controller) 254 if (wizard_controller)
250 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); 255 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
(...skipping 16 matching lines...) Expand all
267 "document.getElementById('$FieldId').value = '$FieldValue';" 272 "document.getElementById('$FieldId').value = '$FieldValue';"
268 "var e = new Event('input');" 273 "var e = new Event('input');"
269 "document.getElementById('$FieldId').dispatchEvent(e);" 274 "document.getElementById('$FieldId').dispatchEvent(e);"
270 "})();"; 275 "})();";
271 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); 276 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id);
272 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); 277 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value);
273 ExecuteJsInSigninFrame(js); 278 ExecuteJsInSigninFrame(js);
274 } 279 }
275 280
276 } // namespace chromeos 281 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signin/oauth2_browsertest.cc ('k') | google_apis/gaia/fake_gaia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698