summaryrefslogtreecommitdiffstats
path: root/chrome/browser/unload_uitest.cc
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 17:58:27 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 17:58:27 +0000
commit15020393fcd7ece49ee6bfb3f3507a117e36b5d2 (patch)
treea03f1d95061655f82928dc65c2cc306dbcf11f74 /chrome/browser/unload_uitest.cc
parent2253121715b9ba8438caea82f3882315add755bf (diff)
downloadchromium_src-15020393fcd7ece49ee6bfb3f3507a117e36b5d2.zip
chromium_src-15020393fcd7ece49ee6bfb3f3507a117e36b5d2.tar.gz
chromium_src-15020393fcd7ece49ee6bfb3f3507a117e36b5d2.tar.bz2
Adds a UI test for WebKit fix to beforeunload bug.
The issue with Gmail warnings on cross-site navigations has been fixed upstream, and a recent WebKit DEPS roll pulled it in. This just adds an automated test for it in Chrome. BUG=32615 TEST=UnloadTest.BrowserCloseWithInnerFocusedFrame Review URL: http://codereview.chromium.org/594014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/unload_uitest.cc')
-rw-r--r--chrome/browser/unload_uitest.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index 86d0a82..880d180 100644
--- a/chrome/browser/unload_uitest.cc
+++ b/chrome/browser/unload_uitest.cc
@@ -24,6 +24,14 @@ const std::string BEFORE_UNLOAD_HTML =
"<script>window.onbeforeunload=function(e){return 'foo'}</script>"
"</body></html>";
+const std::string INNER_FRAME_WITH_FOCUS_HTML =
+ "<html><head><title>innerframewithfocus</title></head><body>"
+ "<script>window.onbeforeunload=function(e){return 'foo'}</script>"
+ "<iframe src=\"data:text/html,<html><head><script>window.onload="
+ "function(){document.getElementById('box').focus()}</script>"
+ "<body><input id='box'></input></body></html>\"></iframe>"
+ "</body></html>";
+
const std::string TWO_SECOND_BEFORE_UNLOAD_HTML =
"<html><head><title>twosecondbeforeunload</title></head><body>"
"<script>window.onbeforeunload=function(e){"
@@ -270,6 +278,18 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) {
WaitForBrowserClosed();
EXPECT_FALSE(IsBrowserRunning());
}
+
+// Tests closing the browser and clicking OK in the beforeunload confirm dialog
+// if an inner frame has the focus. See crbug.com/32615.
+TEST_F(UnloadTest, BrowserCloseWithInnerFocusedFrame) {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ NavigateToDataURL(INNER_FRAME_WITH_FOCUS_HTML, L"innerframewithfocus");
+
+ CloseBrowserAsync(browser.get());
+ ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK);
+ WaitForBrowserClosed();
+ EXPECT_FALSE(IsBrowserRunning());
+}
#endif // !defined(OS_LINUX)
// Tests closing the browser with a beforeunload handler that takes