summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 22:34:30 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 22:34:30 +0000
commit9287786db88d9e05150a796d8aa73131a713453d (patch)
tree5619c53dd1c75ae8270ab72056aac21636f1d86a /chrome
parent2969763caf40459ced64b909f60768a8b991e308 (diff)
downloadchromium_src-9287786db88d9e05150a796d8aa73131a713453d.zip
chromium_src-9287786db88d9e05150a796d8aa73131a713453d.tar.gz
chromium_src-9287786db88d9e05150a796d8aa73131a713453d.tar.bz2
Test to make sure issue 4737 doesn't regress.
Review URL: http://codereview.chromium.org/13800 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/constrained_window_impl_interactive_uitest.cc13
-rw-r--r--chrome/test/data/constrained_files/window_blur_test.html24
2 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
index da927aa..4eaef9ed 100644
--- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
+++ b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
@@ -246,3 +246,16 @@ TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) {
// Wait for there to be an app modal dialog.
ASSERT_TRUE(automation()->WaitForAppModalDialog(5000));
}
+
+// Make sure that window focus works while creating a popup window so that we
+// don't
+TEST_F(InteractiveConstrainedWindowTest, DontBreakOnBlur) {
+ NavigateMainTabTo(L"window_blur_test.html");
+ SimulateClickInCenterOf(window_);
+
+ // Wait for the popup window to open.
+ ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
+
+ // We popup shouldn't be closed by the onblur handler.
+ ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500));
+}
diff --git a/chrome/test/data/constrained_files/window_blur_test.html b/chrome/test/data/constrained_files/window_blur_test.html
new file mode 100644
index 0000000..7332e44
--- /dev/null
+++ b/chrome/test/data/constrained_files/window_blur_test.html
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <title>Blur test</title>
+ <script>
+ function buildPopupWindow() {
+ var w = window.open("", 'popupwindow','width=300,height=300,toolbar=no,' +
+ 'menubar=no,scrollbars=np,resizable=yes,' +
+ 'scrollbars=np,location=no,directories=no,status=no')
+ var d = w.document;
+ d.open();
+ d.write("<title>Shouldn't have onblur called</title><body " +
+ "onblur='self.close()'><center>Closed?</center></body>")
+ d.close();
+ }
+ </script>
+ </head>
+<body onClick="buildPopupWindow();">
+<h1>Blur test</h1>
+<p>This tests that a created popup window doesn't immediately receive a blur
+event because of bad window handling code. For this test to pass, the onblur=""
+handler in the popup must not be called and the window count must remain at two
+for a few seconds.</p>
+</body>
+</html>