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

Side by Side Diff: chrome/browser/chromeos/system/device_disabling_browsertest.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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" 13 #include "chrome/browser/chromeos/login/test/oobe_base_test.h"
14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" 14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 15 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
16 #include "chrome/browser/chromeos/login/ui/oobe_display.h" 16 #include "chrome/browser/chromeos/login/ui/oobe_display.h"
17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
18 #include "chrome/browser/chromeos/login/wizard_controller.h" 18 #include "chrome/browser/chromeos/login/wizard_controller.h"
19 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 19 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
20 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 20 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
21 #include "chrome/browser/chromeos/profiles/profile_helper.h" 21 #include "chrome/browser/chromeos/profiles/profile_helper.h"
22 #include "chrome/browser/chromeos/settings/cros_settings.h" 22 #include "chrome/browser/chromeos/settings/cros_settings.h"
23 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" 23 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
25 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 25 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ASSERT_TRUE(wizard_controller); 168 ASSERT_TRUE(wizard_controller);
169 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); 169 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
170 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait(); 170 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait();
171 171
172 // Mark the device as disabled and wait until cros settings update. 172 // Mark the device as disabled and wait until cros settings update.
173 MarkDisabledAndWaitForPolicyFetch(); 173 MarkDisabledAndWaitForPolicyFetch();
174 174
175 // When the ephemeral users policy is enabled, Chrome OS removes any non-owner 175 // When the ephemeral users policy is enabled, Chrome OS removes any non-owner
176 // cryptohomes on startup. At the end of that process, JavaScript attempts to 176 // cryptohomes on startup. At the end of that process, JavaScript attempts to
177 // show the login screen. Simulate this. 177 // show the login screen. Simulate this.
178 const LoginDisplayHostImpl* const host = 178 const LoginDisplayHost* const host = LoginDisplayHost::default_host();
achuithb 2016/01/21 23:14:31 Maybe drop all the consts here?
jdufault 2016/01/22 21:14:11 Done.
179 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host());
180 ASSERT_TRUE(host); 179 ASSERT_TRUE(host);
181 WebUILoginView* const webui_login_view = host->GetWebUILoginView(); 180 WebUILoginView* const webui_login_view = host->GetWebUILoginView();
182 ASSERT_TRUE(webui_login_view); 181 ASSERT_TRUE(webui_login_view);
183 content::WebContents* const web_contents = webui_login_view->GetWebContents(); 182 content::WebContents* const web_contents = webui_login_view->GetWebContents();
184 ASSERT_TRUE(web_contents); 183 ASSERT_TRUE(web_contents);
185 ASSERT_TRUE(content::ExecuteScript(web_contents, 184 ASSERT_TRUE(content::ExecuteScript(web_contents,
186 "Oobe.showAddUserForTesting();")); 185 "Oobe.showAddUserForTesting();"));
187 186
188 // The login profile is scrubbed before attempting to show the login screen. 187 // The login profile is scrubbed before attempting to show the login screen.
189 // Wait for the scrubbing to finish. 188 // Wait for the scrubbing to finish.
(...skipping 22 matching lines...) Expand all
212 network_state_informer->RemoveObserver(this); 211 network_state_informer->RemoveObserver(this);
213 base::RunLoop().RunUntilIdle(); 212 base::RunLoop().RunUntilIdle();
214 213
215 // Verify that the offline error screen was not shown and the device disabled 214 // Verify that the offline error screen was not shown and the device disabled
216 // screen is still being shown instead. 215 // screen is still being shown instead.
217 EXPECT_EQ(OobeUI::kScreenDeviceDisabled, GetCurrentScreenName(web_contents)); 216 EXPECT_EQ(OobeUI::kScreenDeviceDisabled, GetCurrentScreenName(web_contents));
218 } 217 }
219 218
220 } // namespace system 219 } // namespace system
221 } // namespace chromeos 220 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698