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/base_login_display_host.h" | 8 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
9 #include "chrome/browser/chromeos/login/wizard_controller.h" | 9 #include "chrome/browser/chromeos/login/wizard_controller.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/views/browser_dialogs.h" | 11 #include "chrome/browser/ui/views/browser_dialogs.h" |
12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
| 14 #include "content/public/browser/notification_service.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 WizardInProcessBrowserTest::WizardInProcessBrowserTest(const char* screen_name) | 18 WizardInProcessBrowserTest::WizardInProcessBrowserTest(const char* screen_name) |
18 : screen_name_(screen_name), | 19 : screen_name_(screen_name), |
19 controller_(NULL), | 20 controller_(NULL), |
20 host_(NULL) { | 21 host_(NULL) { |
21 } | 22 } |
22 | 23 |
23 Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { | 24 Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { |
24 SetUpWizard(); | 25 SetUpWizard(); |
25 | 26 |
26 WizardController::SetZeroDelays(); | 27 WizardController::SetZeroDelays(); |
27 | 28 |
28 if (!screen_name_.empty()) { | 29 if (!screen_name_.empty()) { |
29 browser::ShowLoginWizard(screen_name_.c_str(), gfx::Size(1024, 600)); | 30 browser::ShowLoginWizard(screen_name_.c_str(), gfx::Size(1024, 600)); |
30 controller_ = WizardController::default_controller(); | 31 controller_ = WizardController::default_controller(); |
31 host_ = BaseLoginDisplayHost::default_host(); | 32 host_ = BaseLoginDisplayHost::default_host(); |
32 } | 33 } |
33 return NULL; | 34 return NULL; |
34 } | 35 } |
35 | 36 |
36 void WizardInProcessBrowserTest::CleanUpOnMainThread() { | 37 void WizardInProcessBrowserTest::CleanUpOnMainThread() { |
37 ui_test_utils::WindowedNotificationObserver wizard_destroyed_observer( | 38 ui_test_utils::WindowedNotificationObserver wizard_destroyed_observer( |
38 chrome::NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED, | 39 chrome::NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED, |
39 NotificationService::AllSources()); | 40 content::NotificationService::AllSources()); |
40 | 41 |
41 // LoginDisplayHost owns controllers and all windows. | 42 // LoginDisplayHost owns controllers and all windows. |
42 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); | 43 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); |
43 | 44 |
44 // Observers and what not are notified after the views are deleted, which | 45 // Observers and what not are notified after the views are deleted, which |
45 // happens after a delay (because they are contained in a NativeWidgetGtk | 46 // happens after a delay (because they are contained in a NativeWidgetGtk |
46 // which delays deleting itself). Run the message loop until we know the | 47 // which delays deleting itself). Run the message loop until we know the |
47 // wizard has been deleted. | 48 // wizard has been deleted. |
48 wizard_destroyed_observer.Wait(); | 49 wizard_destroyed_observer.Wait(); |
49 } | 50 } |
50 | 51 |
51 } // namespace chromeos | 52 } // namespace chromeos |
OLD | NEW |