| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/wizard_in_process_browser_test.h" | 5 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/chromeos/login/wizard_controller.h" | 8 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/views/browser_dialogs.h" | 10 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 11 #include "chrome/test/ui_test_utils.h" | 11 #include "chrome/test/ui_test_utils.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 WizardInProcessBrowserTest::WizardInProcessBrowserTest(const char* screen_name) | 15 WizardInProcessBrowserTest::WizardInProcessBrowserTest(const char* screen_name) |
| 16 : screen_name_(screen_name), | 16 : screen_name_(screen_name), |
| 17 controller_(NULL) { | 17 controller_(NULL) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { | 20 Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { |
| 21 SetUpWizard(); | 21 SetUpWizard(); |
| 22 | 22 |
| 23 browser::ShowLoginWizard(screen_name_.c_str(), gfx::Size(1024, 600)); | 23 if (!screen_name_.empty()) { |
| 24 controller_ = WizardController::default_controller(); | 24 browser::ShowLoginWizard(screen_name_.c_str(), gfx::Size(1024, 600)); |
| 25 controller_ = WizardController::default_controller(); |
| 26 } |
| 25 return NULL; | 27 return NULL; |
| 26 } | 28 } |
| 27 | 29 |
| 28 void WizardInProcessBrowserTest::CleanUpOnMainThread() { | 30 void WizardInProcessBrowserTest::CleanUpOnMainThread() { |
| 29 delete controller_; | 31 delete controller_; |
| 30 | 32 |
| 31 // Observers and what not are notified after the views are deleted, which | 33 // Observers and what not are notified after the views are deleted, which |
| 32 // happens after a delay (because they are contained in a WidgetGtk which | 34 // happens after a delay (because they are contained in a WidgetGtk which |
| 33 // delays deleting itself). Run the message loop until we know the wizard | 35 // delays deleting itself). Run the message loop until we know the wizard |
| 34 // has been deleted. | 36 // has been deleted. |
| 35 ui_test_utils::WaitForNotification( | 37 ui_test_utils::WaitForNotification( |
| 36 NotificationType::WIZARD_CONTENT_VIEW_DESTROYED); | 38 NotificationType::WIZARD_CONTENT_VIEW_DESTROYED); |
| 37 } | 39 } |
| 38 | 40 |
| 39 } // namespace chromeos | 41 } // namespace chromeos |
| OLD | NEW |