summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_uitest.cc25
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc2
-rw-r--r--chrome/test/data/showmodaldialog.html9
-rw-r--r--chrome/test/data/showmodaldialog_dialog.html5
-rw-r--r--chrome/test/data/showmodaldialog_dialog.js2
5 files changed, 42 insertions, 1 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index e2533c7..108273e 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -9,6 +9,7 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
@@ -324,4 +325,28 @@ TEST_F(VisibleBrowserTest, WindowOpenClose) {
}
#endif
+#if defined(OS_WIN) // only works on Windows for now: http:://crbug.com/15891
+class ShowModalDialogTest : public UITest {
+ public:
+ ShowModalDialogTest() {
+ launch_arguments_.AppendSwitch(switches::kDisablePopupBlocking);
+ }
+};
+
+TEST_F(ShowModalDialogTest, BasicTest) {
+ FilePath test_file(test_data_directory_);
+ test_file = test_file.AppendASCII("showmodaldialog.html");
+ NavigateToURL(net::FilePathToFileURL(test_file));
+
+ ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, action_timeout_ms()));
+
+ scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(1);
+ scoped_refptr<TabProxy> tab = browser->GetActiveTab();
+
+ std::wstring title;
+ ASSERT_TRUE(tab->GetTabTitle(&title));
+ ASSERT_EQ(title, L"ModalDialogTitle");
+}
+#endif
+
} // namespace
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 8072eb2..1a0574d 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -818,7 +818,7 @@ void RenderViewHost::OnMsgShowWidget(int route_id,
void RenderViewHost::OnMsgRunModal(IPC::Message* reply_msg) {
DCHECK(!run_modal_reply_msg_);
if (modal_dialog_count_++ == 0)
- modal_dialog_event_->Reset();
+ modal_dialog_event_->Signal();
run_modal_reply_msg_ = reply_msg;
// TODO(darin): Bug 1107929: Need to inform our delegate to show this view in
diff --git a/chrome/test/data/showmodaldialog.html b/chrome/test/data/showmodaldialog.html
new file mode 100644
index 0000000..4196c09
--- /dev/null
+++ b/chrome/test/data/showmodaldialog.html
@@ -0,0 +1,9 @@
+<html>
+<body onload="setTimeout('ShowDialog()', 100)">
+<script>
+function ShowDialog() {
+ window.showModalDialog("showmodaldialog_dialog.html");
+}
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/chrome/test/data/showmodaldialog_dialog.html b/chrome/test/data/showmodaldialog_dialog.html
new file mode 100644
index 0000000..cdfeb3a
--- /dev/null
+++ b/chrome/test/data/showmodaldialog_dialog.html
@@ -0,0 +1,5 @@
+<html>
+<head>
+<title>ModalDialogTitle</title>
+</head>
+</html> \ No newline at end of file
diff --git a/chrome/test/data/showmodaldialog_dialog.js b/chrome/test/data/showmodaldialog_dialog.js
new file mode 100644
index 0000000..e7cdd067
--- /dev/null
+++ b/chrome/test/data/showmodaldialog_dialog.js
@@ -0,0 +1,2 @@
+function dummy() {
+} \ No newline at end of file