diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 19:21:15 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 19:21:15 +0000 |
commit | 96f81a54c6639515a68ede374707d1301ac3951d (patch) | |
tree | 4286bb64ed4bdafebcafa90866363c0ea9aef68f /chrome/browser/unload_uitest.cc | |
parent | a1fc453a59579f0940076e9e6a229e2db99a7bed (diff) | |
download | chromium_src-96f81a54c6639515a68ede374707d1301ac3951d.zip chromium_src-96f81a54c6639515a68ede374707d1301ac3951d.tar.gz chromium_src-96f81a54c6639515a68ede374707d1301ac3951d.tar.bz2 |
More test enabling.
- RedirectTest.ClientServerServer passes locally so I'm trying re-enabling it.
- file a bug for RedirectTest.ClientCancelledByNewNavigationAfterProvisionalLoad .
- file a bug for SessionHistoryTest.CrossFrameFormBackForward
- mark SessionHistoryTest.LocationReplace as failing rather than disabled
- fix UnloadTest.BrowserCloseTabWhenOtherTabHasListener (the popup was being caught by the popup blocker)
TEST=buildbots
BUG=12913
Review URL: http://codereview.chromium.org/2264001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/unload_uitest.cc')
-rw-r--r-- | chrome/browser/unload_uitest.cc | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc index e0185c8..ec1a58b 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -85,9 +85,9 @@ const std::string TWO_SECOND_BEFORE_UNLOAD_ALERT_HTML = const std::string CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER = "<html><head><title>only_one_unload</title></head>" - "<body onload=\"window.open('data:text/html," + "<body onclick=\"window.open('data:text/html," "<html><head><title>popup</title></head></body>')\" " - "onbeforeunload='return;'" + "onbeforeunload='return;'>" "</body></html>"; class UnloadTest : public UITest { @@ -292,6 +292,7 @@ TEST_F(UnloadTest, BrowserCloseUnload) { #define BrowserCloseWithInnerFocusedFrame \ DISABLED_BrowserCloseWithInnerFocusedFrame #endif + // Tests closing the browser with a beforeunload handler and clicking // OK in the beforeunload confirm dialog. TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) { @@ -396,42 +397,46 @@ TEST_F(UnloadTest, BrowserCloseTwoSecondBeforeUnloadAlert) { L"twosecondbeforeunloadalert"); } -// TODO(brettw) bug 12913 this test was broken by WebKit merge 42202:44252. -// Apparently popup titles are broken somehow. +#if defined(OS_MACOSX) +// http://crbug.com/45162 +#define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ + DISABLED_BrowserCloseTabWhenOtherTabHasListener +#else +#define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ + BrowserCloseTabWhenOtherTabHasListener +#endif // Tests that if there's a renderer process with two tabs, one of which has an // unload handler, and the other doesn't, the tab that doesn't have an unload -// handler can be closed. If this test fails, the Close() call will hang. -TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) { +// handler can be closed. +TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) { NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload"); - int window_count; - ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); - ASSERT_EQ(2, window_count); - - scoped_refptr<BrowserProxy> popup_browser_proxy( - automation()->GetBrowserWindow(1)); - ASSERT_TRUE(popup_browser_proxy.get()); - int popup_tab_count; - EXPECT_TRUE(popup_browser_proxy->GetTabCount(&popup_tab_count)); - EXPECT_EQ(1, popup_tab_count); - scoped_refptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab()); + + scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0); + ASSERT_TRUE(browser.get()); + scoped_refptr<WindowProxy> window = browser->GetWindow(); + ASSERT_TRUE(window.get()); + + gfx::Rect tab_view_bounds; + ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, + &tab_view_bounds, true)); + // Simulate a click to force user_gesture to true; if we don't, the resulting + // popup will be constrained, which isn't what we want to test. + ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(), + views::Event::EF_LEFT_BUTTON_DOWN)); + ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_timeout_ms())); + + scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab()); ASSERT_TRUE(popup_tab.get()); std::wstring popup_title; - ASSERT_TRUE(popup_tab.get() != NULL); EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title)); EXPECT_EQ(std::wstring(L"popup"), popup_title); EXPECT_TRUE(popup_tab->Close(true)); - scoped_refptr<BrowserProxy> main_browser_proxy( - automation()->GetBrowserWindow(0)); - ASSERT_TRUE(main_browser_proxy.get()); - int main_tab_count; - EXPECT_TRUE(main_browser_proxy->GetTabCount(&main_tab_count)); - EXPECT_EQ(1, main_tab_count); - scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); + ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_timeout_ms())); + scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); ASSERT_TRUE(main_tab.get()); std::wstring main_title; - ASSERT_TRUE(main_tab.get() != NULL); EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); } |