diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-22 15:24:14 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-22 15:24:14 +0000 |
commit | 459773c256a5d5f7d001298481c8e503a5a1f588 (patch) | |
tree | 485d9611ad1b22cdb5c76c2130a9f20819948eaa /chrome/browser/chromeos | |
parent | be8751c1fe155a0c7405ccda69458b0902b97440 (diff) | |
download | chromium_src-459773c256a5d5f7d001298481c8e503a5a1f588.zip chromium_src-459773c256a5d5f7d001298481c8e503a5a1f588.tar.gz chromium_src-459773c256a5d5f7d001298481c8e503a5a1f588.tar.bz2 |
Makes tests on chromeos not run a nested message loop.
I had to do two changes to existing tests to get these to work:
. Wizard tests wait until all the wizard related classes have been destroyed. At the time the tests want to quit the wizard classes haven't been shut down, so I needed to add an event to know when this happens. See comment as to why this is the case.
. PanelBrowserTests were flakey because they were waiting for page to load, which can happen before javascript finishes completing.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1735001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
3 files changed, 25 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 7748e5c..42793fe 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -25,6 +25,7 @@ #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/wm_ipc.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/notification_service.h" #include "views/accelerator.h" #include "views/painter.h" #include "views/screen.h" @@ -56,6 +57,13 @@ class ContentView : public views::View { AddAccelerator(accel_login_screen_); } + ~ContentView() { + NotificationService::current()->Notify( + NotificationType::WIZARD_CONTENT_VIEW_DESTROYED, + NotificationService::AllSources(), + NotificationService::NoDetails()); + } + bool AcceleratorPressed(const views::Accelerator& accel) { if (accel == accel_login_screen_) { WizardController* controller = WizardController::default_controller(); diff --git a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc index ae94f0e..dc87e97 100644 --- a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc +++ b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc @@ -8,6 +8,7 @@ #include "chrome/browser/browser.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/views/browser_dialogs.h" +#include "chrome/test/ui_test_utils.h" namespace chromeos { @@ -26,6 +27,13 @@ Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { void WizardInProcessBrowserTest::CleanUpOnMainThread() { delete controller_; + + // Observers and what not are notified after the views are deleted, which + // happens after a delay (because they are contained in a WidgetGtk which + // delays deleting itself). Run the message loop until we know the wizard + // has been deleted. + ui_test_utils::WaitForNotification( + NotificationType::WIZARD_CONTENT_VIEW_DESTROYED); } } // namespace chromeos diff --git a/chrome/browser/chromeos/panels/panel_browsertest.cc b/chrome/browser/chromeos/panels/panel_browsertest.cc index 6126a45e4..1ec09b2 100644 --- a/chrome/browser/chromeos/panels/panel_browsertest.cc +++ b/chrome/browser/chromeos/panels/panel_browsertest.cc @@ -43,7 +43,11 @@ IN_PROC_BROWSER_TEST_F(PanelTest, PanelOpenSmall) { GURL url("data:text/html," + HTML); CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisablePopupBlocking); - ui_test_utils::NavigateToURL(browser(), url); + + browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); + + // Wait for notification that window.open has been processed. + ui_test_utils::WaitForNotification(NotificationType::TAB_ADDED); // Find the new browser. Browser* new_browser = NULL; @@ -78,7 +82,10 @@ IN_PROC_BROWSER_TEST_F(PanelTest, PanelOpenLarge) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisablePopupBlocking); int old_tab_count = browser()->tab_count(); - ui_test_utils::NavigateToURL(browser(), url); + browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); + + // Wait for notification that window.open has been processed. + ui_test_utils::WaitForNotification(NotificationType::TAB_ADDED); // Shouldn't find a new browser. Browser* new_browser = NULL; |