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

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

Issue 1987053003: Wait for OobeWebUI to finish loading before running tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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 "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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h"
10 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/chromeos/login/existing_user_controller.h" 12 #include "chrome/browser/chromeos/login/existing_user_controller.h"
12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 13 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
13 #include "chrome/browser/chromeos/login/session/user_session_manager_test_api.h" 14 #include "chrome/browser/chromeos/login/session/user_session_manager_test_api.h"
14 #include "chrome/browser/chromeos/login/test/https_forwarder.h" 15 #include "chrome/browser/chromeos/login/test/https_forwarder.h"
15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
16 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" 17 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
17 #include "chrome/browser/lifetime/application_lifetime.h" 18 #include "chrome/browser/lifetime/application_lifetime.h"
18 #include "chrome/browser/ui/webui/signin/get_auth_frame.h" 19 #include "chrome/browser/ui/webui/signin/get_auth_frame.h"
19 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 js_checker_.set_web_contents( 106 js_checker_.set_web_contents(
106 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents()); 107 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents());
107 108
108 test::UserSessionManagerTestApi session_manager_test_api( 109 test::UserSessionManagerTestApi session_manager_test_api(
109 UserSessionManager::GetInstance()); 110 UserSessionManager::GetInstance());
110 session_manager_test_api.SetShouldObtainTokenHandleInTests(false); 111 session_manager_test_api.SetShouldObtainTokenHandleInTests(false);
111 112
112 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest(); 113 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest();
113 114
115 // Wait for OobeUI to finish loading.
116 base::RunLoop run_loop;
117 if (!LoginDisplayHost::default_host()->GetOobeUI()->IsJSReady(
118 run_loop.QuitClosure())) {
119 run_loop.Run();
120 }
121
114 ExtensionApiTest::SetUpOnMainThread(); 122 ExtensionApiTest::SetUpOnMainThread();
115 } 123 }
116 124
117 void OobeBaseTest::TearDownOnMainThread() { 125 void OobeBaseTest::TearDownOnMainThread() {
118 // If the login display is still showing, exit gracefully. 126 // If the login display is still showing, exit gracefully.
119 if (LoginDisplayHost::default_host()) { 127 if (LoginDisplayHost::default_host()) {
120 base::MessageLoop::current()->PostTask(FROM_HERE, 128 base::MessageLoop::current()->PostTask(FROM_HERE,
121 base::Bind(&chrome::AttemptExit)); 129 base::Bind(&chrome::AttemptExit));
122 content::RunMessageLoop(); 130 content::RunMessageLoop();
123 } 131 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 "document.getElementById('$FieldId').value = '$FieldValue';" 265 "document.getElementById('$FieldId').value = '$FieldValue';"
258 "var e = new Event('input');" 266 "var e = new Event('input');"
259 "document.getElementById('$FieldId').dispatchEvent(e);" 267 "document.getElementById('$FieldId').dispatchEvent(e);"
260 "})();"; 268 "})();";
261 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); 269 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id);
262 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); 270 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value);
263 ExecuteJsInSigninFrame(js); 271 ExecuteJsInSigninFrame(js);
264 } 272 }
265 273
266 } // namespace chromeos 274 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698