1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file.
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chrome/browser/chromeos/login/test/oobe_base_test.h"
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/command_line.h"
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/message_loop/message_loop.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/path_service.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/chrome_notification_types.h"
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/chromeos/login/existing_user_controller.h"
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chrome/browser/chromeos/login/users/fake_user_manager.h"
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/lifetime/application_lifetime.h"
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/common/chrome_paths.h"
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/common/chrome_switches.h"
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chromeos/chromeos_switches.h"
1946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "chromeos/dbus/fake_shill_manager_client.h"
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/browser/notification_observer.h"
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/browser/notification_registrar.h"
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/browser/notification_service.h"
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/test/browser_test_utils.h"
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "google_apis/gaia/gaia_switches.h"
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "net/dns/mock_host_resolver.h"
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "net/test/embedded_test_server/http_request.h"
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "net/test/embedded_test_server/http_response.h"
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace chromeos {
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)OobeBaseTest::OobeBaseTest()
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    : fake_gaia_(new FakeGaia()),
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      network_portal_detector_(NULL),
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      needs_background_networking_(false) {
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  set_exit_when_last_browser_closes(false);
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  set_chromeos_user_ = false;
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)OobeBaseTest::~OobeBaseTest() {
405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SetUp() {
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  base::FilePath test_data_dir;
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  embedded_test_server()->RegisterRequestHandler(
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      base::Bind(&FakeGaia::HandleRequest, base::Unretained(fake_gaia_.get())));
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Stop IO thread here because no threads are allowed while
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // spawning sandbox host process. See crbug.com/322732.
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  embedded_test_server()->StopThread();
525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ExtensionApiTest::SetUp();
545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SetUpInProcessBrowserTestFixture() {
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  host_resolver()->AddRule("*", "127.0.0.1");
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_ = new NetworkPortalDetectorTestImpl();
595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  NetworkPortalDetector::InitializeForTesting(network_portal_detector_);
60116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  network_portal_detector_->SetDefaultNetworkForTesting(
61116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      FakeShillManagerClient::kFakeEthernetNetworkGuid);
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ExtensionApiTest::SetUpInProcessBrowserTestFixture();
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SetUpOnMainThread() {
675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Restart the thread as the sandbox host process has already been spawned.
685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  embedded_test_server()->RestartThreadAndListen();
695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ExtensionApiTest::SetUpOnMainThread();
715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
735f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)void OobeBaseTest::TearDownOnMainThread() {
745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // If the login display is still showing, exit gracefully.
755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  if (LoginDisplayHostImpl::default_host()) {
765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    base::MessageLoop::current()->PostTask(FROM_HERE,
775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                           base::Bind(&chrome::AttemptExit));
785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    content::RunMessageLoop();
795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
815f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  ExtensionApiTest::TearDownOnMainThread();
825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SetUpCommandLine(CommandLine* command_line) {
855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ExtensionApiTest::SetUpCommandLine(command_line);
865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  command_line->AppendSwitch(chromeos::switches::kLoginManager);
875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  if (!needs_background_networking_)
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    command_line->AppendSwitch(::switches::kDisableBackgroundNetworking);
905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Create gaia and webstore URL from test server url but using different
935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // host names. This is to avoid gaia response being tagged as from
945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // webstore in chrome_resource_dispatcher_host_delegate.cc.
955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  const GURL& server_url = embedded_test_server()->base_url();
965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  std::string gaia_host("gaia");
985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  GURL::Replacements replace_gaia_host;
995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  replace_gaia_host.SetHostStr(gaia_host);
1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  GURL gaia_url = server_url.ReplaceComponents(replace_gaia_host);
1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  command_line->AppendSwitchASCII(::switches::kGaiaUrl, gaia_url.spec());
1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  command_line->AppendSwitchASCII(::switches::kLsoUrl, gaia_url.spec());
1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  command_line->AppendSwitchASCII(::switches::kGoogleApisUrl,
1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                  gaia_url.spec());
1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  fake_gaia_->Initialize();
1065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SimulateNetworkOffline() {
1095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  NetworkPortalDetector::CaptivePortalState offline_state;
1105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  offline_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
1115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_->SetDetectionResultsForTesting(
112116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      FakeShillManagerClient::kFakeEthernetNetworkGuid,
113116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      offline_state);
1145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_->NotifyObserversForTesting();
1155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)base::Closure OobeBaseTest::SimulateNetworkOfflineClosure() {
1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return base::Bind(&OobeBaseTest::SimulateNetworkOffline,
1195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    base::Unretained(this));
1205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SimulateNetworkOnline() {
1235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  NetworkPortalDetector::CaptivePortalState online_state;
1245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
1255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  online_state.response_code = 204;
1265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_->SetDetectionResultsForTesting(
127116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      FakeShillManagerClient::kFakeEthernetNetworkGuid,
128116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      online_state);
1295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_->NotifyObserversForTesting();
1305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)base::Closure OobeBaseTest::SimulateNetworkOnlineClosure() {
1335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return base::Bind(&OobeBaseTest::SimulateNetworkOnline,
1345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    base::Unretained(this));
1355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::SimulateNetworkPortal() {
1385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  NetworkPortalDetector::CaptivePortalState portal_state;
1395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
1405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_->SetDetectionResultsForTesting(
141116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      FakeShillManagerClient::kFakeEthernetNetworkGuid,
142116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      portal_state);
1435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  network_portal_detector_->NotifyObserversForTesting();
1445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)base::Closure OobeBaseTest::SimulateNetworkPortalClosure() {
1475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return base::Bind(&OobeBaseTest::SimulateNetworkPortal,
1485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    base::Unretained(this));
1495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void OobeBaseTest::JsExpect(const std::string& expression) {
1525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool result;
1535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
1545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      GetLoginUI()->GetWebContents(),
1555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      "window.domAutomationController.send(!!(" + expression + "));",
1565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)       &result));
1575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ASSERT_TRUE(result) << expression;
1585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)content::WebUI* OobeBaseTest::GetLoginUI() {
1615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return static_cast<chromeos::LoginDisplayHostImpl*>(
1625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()->web_ui();
1635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)SigninScreenHandler* OobeBaseTest::GetSigninScreenHandler() {
1665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return static_cast<chromeos::LoginDisplayHostImpl*>(
1675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      chromeos::LoginDisplayHostImpl::default_host())
1685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      ->GetOobeUI()
1695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      ->signin_screen_handler_for_test();
1705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)WebUILoginDisplay* OobeBaseTest::GetLoginDisplay() {
1735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ExistingUserController* controller =
1745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      ExistingUserController::current_controller();
1755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CHECK(controller);
1765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return static_cast<WebUILoginDisplay*>(
1775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      controller->login_display());
1785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
1795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}  // namespace chromeos
181