diff options
author | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 21:01:17 +0000 |
---|---|---|
committer | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 21:01:17 +0000 |
commit | e1a64ca263731e00a8629e97f9bbc8027cafdb5b (patch) | |
tree | 808f0416426b129f515c1e578696df21499e0a64 /chrome/test/ui | |
parent | d13701900a71240fe1b4074b778133ba9a3461e9 (diff) | |
download | chromium_src-e1a64ca263731e00a8629e97f9bbc8027cafdb5b.zip chromium_src-e1a64ca263731e00a8629e97f9bbc8027cafdb5b.tar.gz chromium_src-e1a64ca263731e00a8629e97f9bbc8027cafdb5b.tar.bz2 |
Send the close browser window command via a automation message
instead of directly posting a WM_CLOSE to the browser window.
This is a speculative fix to avoid the crash during automated
UI tests. The theory is that the automation message will arrive
after the other automation commands and would give a chance for
graceful shutdown.
BUG=1145714
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1465 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui')
-rw-r--r-- | chrome/test/ui/ui_test.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index dec0ff2..22678ff 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -14,6 +14,7 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/time.h" +#include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/url_fixer_upper.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" @@ -249,12 +250,12 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) { } void UITest::QuitBrowser() { - typedef std::vector<HWND> HandleVector; + typedef std::vector<BrowserProxy*> BrowserVector; // There's nothing to do here if the browser is not running. if (IsBrowserRunning()) { automation()->SetFilteredInet(false); - HandleVector handles; + BrowserVector browsers; // Build up a list of HWNDs; we do this as a separate step so that closing // the windows doesn't mess up the iteration. @@ -262,19 +263,18 @@ void UITest::QuitBrowser() { EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); for (int i = 0; i < window_count; ++i) { - HWND window_handle; - scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(i)); - scoped_ptr<WindowProxy> window( - automation()->GetWindowForBrowser(browser.get())); - EXPECT_TRUE(window->GetHWND(&window_handle)); - handles.push_back(window_handle); + BrowserProxy* browser_proxy = automation()->GetBrowserWindow(i); + browsers.push_back(browser_proxy); } - for (HandleVector::iterator iter = handles.begin(); iter != handles.end(); - ++iter) { - ::PostMessage(*iter, WM_CLOSE, 0, 0); + //for (HandleVector::iterator iter = handles.begin(); iter != handles.end(); + for (BrowserVector::iterator iter = browsers.begin(); + iter != browsers.end(); ++iter) { + // Use ApplyAccelerator since it doesn't wait + (*iter)->ApplyAccelerator(IDC_CLOSEWINDOW); + delete (*iter); } - + // Now, drop the automation IPC channel so that the automation provider in // the browser notices and drops its reference to the browser process. server_->Disconnect(); |