• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h"
6 
7 #include "base/message_loop.h"
8 #include "chrome/browser/chromeos/login/base_login_display_host.h"
9 #include "chrome/browser/chromeos/login/wizard_controller.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/views/browser_dialogs.h"
12 #include "chrome/test/ui_test_utils.h"
13 
14 namespace chromeos {
15 
WizardInProcessBrowserTest(const char * screen_name)16 WizardInProcessBrowserTest::WizardInProcessBrowserTest(const char* screen_name)
17     : screen_name_(screen_name),
18       controller_(NULL),
19       host_(NULL) {
20 }
21 
CreateBrowser(Profile * profile)22 Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) {
23   SetUpWizard();
24 
25   WizardController::SetZeroDelays();
26 
27   if (!screen_name_.empty()) {
28     browser::ShowLoginWizard(screen_name_.c_str(), gfx::Size(1024, 600));
29     controller_ = WizardController::default_controller();
30     host_ = BaseLoginDisplayHost::default_host();
31   }
32   return NULL;
33 }
34 
CleanUpOnMainThread()35 void WizardInProcessBrowserTest::CleanUpOnMainThread() {
36   // LoginDisplayHost owns controllers and all windows.
37   delete host_;
38 
39   // Observers and what not are notified after the views are deleted, which
40   // happens after a delay (because they are contained in a WidgetGtk which
41   // delays deleting itself). Run the message loop until we know the wizard
42   // has been deleted.
43   ui_test_utils::WaitForNotification(
44       NotificationType::WIZARD_CONTENT_VIEW_DESTROYED);
45 }
46 
47 }  // namespace chromeos
48