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

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

Issue 1610823003: Migrate call sites LoginDisplayHostImpl::default_host to LoginDisplayHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-add-supervised-user
Patch Set: Created 4 years, 11 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/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 "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 // Start the accept thread as the sandbox host process has already been 97 // Start the accept thread as the sandbox host process has already been
98 // spawned. 98 // spawned.
99 embedded_test_server()->StartAcceptingConnections(); 99 embedded_test_server()->StartAcceptingConnections();
100 100
101 login_screen_load_observer_.reset(new content::WindowedNotificationObserver( 101 login_screen_load_observer_.reset(new content::WindowedNotificationObserver(
102 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, 102 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
103 content::NotificationService::AllSources())); 103 content::NotificationService::AllSources()));
104 104
105 js_checker_.set_web_contents(LoginDisplayHostImpl::default_host() 105 js_checker_.set_web_contents(
106 ->GetWebUILoginView() 106 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents());
107 ->GetWebContents());
108 107
109 test::UserSessionManagerTestApi session_manager_test_api( 108 test::UserSessionManagerTestApi session_manager_test_api(
110 UserSessionManager::GetInstance()); 109 UserSessionManager::GetInstance());
111 session_manager_test_api.SetShouldObtainTokenHandleInTests(false); 110 session_manager_test_api.SetShouldObtainTokenHandleInTests(false);
112 111
113 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest(); 112 LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest();
114 113
115 ExtensionApiTest::SetUpOnMainThread(); 114 ExtensionApiTest::SetUpOnMainThread();
116 } 115 }
117 116
118 void OobeBaseTest::TearDownOnMainThread() { 117 void OobeBaseTest::TearDownOnMainThread() {
119 // If the login display is still showing, exit gracefully. 118 // If the login display is still showing, exit gracefully.
120 if (LoginDisplayHostImpl::default_host()) { 119 if (LoginDisplayHost::default_host()) {
121 base::MessageLoop::current()->PostTask(FROM_HERE, 120 base::MessageLoop::current()->PostTask(FROM_HERE,
122 base::Bind(&chrome::AttemptExit)); 121 base::Bind(&chrome::AttemptExit));
123 content::RunMessageLoop(); 122 content::RunMessageLoop();
124 } 123 }
125 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); 124 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
126 125
127 ExtensionApiTest::TearDownOnMainThread(); 126 ExtensionApiTest::TearDownOnMainThread();
128 } 127 }
129 128
130 void OobeBaseTest::SetUpCommandLine(base::CommandLine* command_line) { 129 void OobeBaseTest::SetUpCommandLine(base::CommandLine* command_line) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 base::Closure OobeBaseTest::SimulateNetworkPortalClosure() { 194 base::Closure OobeBaseTest::SimulateNetworkPortalClosure() {
196 return base::Bind(&OobeBaseTest::SimulateNetworkPortal, 195 return base::Bind(&OobeBaseTest::SimulateNetworkPortal,
197 base::Unretained(this)); 196 base::Unretained(this));
198 } 197 }
199 198
200 void OobeBaseTest::JsExpect(const std::string& expression) { 199 void OobeBaseTest::JsExpect(const std::string& expression) {
201 JS().ExpectTrue(expression); 200 JS().ExpectTrue(expression);
202 } 201 }
203 202
204 content::WebUI* OobeBaseTest::GetLoginUI() { 203 content::WebUI* OobeBaseTest::GetLoginUI() {
205 return static_cast<chromeos::LoginDisplayHostImpl*>( 204 return chromeos::LoginDisplayHost::default_host()->GetOobeUI()->web_ui();
achuithb 2016/01/21 23:14:31 drop chromeos::
jdufault 2016/01/22 21:14:11 Done.
206 chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()->web_ui();
207 } 205 }
208 206
209 WebUILoginDisplay* OobeBaseTest::GetLoginDisplay() { 207 WebUILoginDisplay* OobeBaseTest::GetLoginDisplay() {
210 ExistingUserController* controller = 208 ExistingUserController* controller =
211 ExistingUserController::current_controller(); 209 ExistingUserController::current_controller();
212 CHECK(controller); 210 CHECK(controller);
213 return static_cast<WebUILoginDisplay*>( 211 return static_cast<WebUILoginDisplay*>(
214 controller->login_display()); 212 controller->login_display());
215 } 213 }
216 214
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 "document.getElementById('$FieldId').value = '$FieldValue';" 257 "document.getElementById('$FieldId').value = '$FieldValue';"
260 "var e = new Event('input');" 258 "var e = new Event('input');"
261 "document.getElementById('$FieldId').dispatchEvent(e);" 259 "document.getElementById('$FieldId').dispatchEvent(e);"
262 "})();"; 260 "})();";
263 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); 261 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id);
264 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); 262 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value);
265 ExecuteJsInSigninFrame(js); 263 ExecuteJsInSigninFrame(js);
266 } 264 }
267 265
268 } // namespace chromeos 266 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698