summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorericu@chromium.org <ericu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 17:30:25 +0000
committerericu@chromium.org <ericu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 17:30:25 +0000
commit0f061d90982063c234604350c2652ea8c108883b (patch)
treedbdb7817d112182386d4c91c17286006f88a8d0b /content
parent55d9e2a9adf45fad93a4c6a88cb3033df90eefb2 (diff)
downloadchromium_src-0f061d90982063c234604350c2652ea8c108883b.zip
chromium_src-0f061d90982063c234604350c2652ea8c108883b.tar.gz
chromium_src-0f061d90982063c234604350c2652ea8c108883b.tar.bz2
Test suite that monitors the disposition of JS-created windows based on what
modifiers were involved in the user gesture that triggered them. See https://bugs.webkit.org/show_bug.cgi?id=99202 for a patch that needs to land before this test will fully pass. BUG=31631 Review URL: https://codereview.chromium.org/11235048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_plugin/browser_plugin_host_browsertest.cc9
-rw-r--r--content/browser/plugin_browsertest.cc3
-rw-r--r--content/public/test/browser_test_utils.cc7
-rw-r--r--content/public/test/browser_test_utils.h7
4 files changed, 18 insertions, 8 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
index 46a52dd..955efb9 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -335,7 +335,8 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, MAYBE_NavigateGuest) {
ASCIIToUTF16("StartInfiniteLoop();"));
// Send a mouse event to the guest.
- SimulateMouseClick(test_embedder()->web_contents());
+ SimulateMouseClick(test_embedder()->web_contents(), 0,
+ WebKit::WebMouseEvent::ButtonLeft);
// Expect the guest to crash.
test_guest()->WaitForCrashed();
@@ -364,7 +365,8 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) {
const char* kGuestURL = "files/browser_plugin_focus_child.html";
StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, "");
- SimulateMouseClick(test_embedder()->web_contents());
+ SimulateMouseClick(test_embedder()->web_contents(), 0,
+ WebKit::WebMouseEvent::ButtonLeft);
BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents());
// Wait until we focus into the guest.
test_guest()->WaitForFocus();
@@ -715,7 +717,8 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BackAfterTerminateGuest) {
EXPECT_EQ(expected_title, actual_title);
}
// Send an input event and verify that the guest receives the input.
- SimulateMouseClick(test_embedder()->web_contents());
+ SimulateMouseClick(test_embedder()->web_contents(), 0,
+ WebKit::WebMouseEvent::ButtonLeft);
test_guest()->WaitForInput();
}
diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc
index b45d85d..71e3b8c 100644
--- a/content/browser/plugin_browsertest.cc
+++ b/content/browser/plugin_browsertest.cc
@@ -166,7 +166,8 @@ IN_PROC_BROWSER_TEST_F(PluginTest,
string16 expected_title(ASCIIToUTF16("OK"));
TitleWatcher title_watcher(shell()->web_contents(), expected_title);
title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
- SimulateMouseClick(shell()->web_contents());
+ SimulateMouseClick(shell()->web_contents(), 0,
+ WebKit::WebMouseEvent::ButtonLeft);
EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
}
#endif
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index f6b9361..bf7e3db 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -223,14 +223,17 @@ void CrashTab(WebContents* web_contents) {
observer.Wait();
}
-void SimulateMouseClick(WebContents* web_contents) {
+void SimulateMouseClick(WebContents* web_contents,
+ int modifiers,
+ WebKit::WebMouseEvent::Button button) {
int x = web_contents->GetView()->GetContainerSize().width() / 2;
int y = web_contents->GetView()->GetContainerSize().height() / 2;
WebKit::WebMouseEvent mouse_event;
mouse_event.type = WebKit::WebInputEvent::MouseDown;
- mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
+ mouse_event.button = button;
mouse_event.x = x;
mouse_event.y = y;
+ mouse_event.modifiers = modifiers;
// Mac needs globalX/globalY for events to plugins.
gfx::Rect offset;
web_contents->GetView()->GetContainerBounds(&offset);
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h
index b807e31..09d84be 100644
--- a/content/public/test/browser_test_utils.h
+++ b/content/public/test/browser_test_utils.h
@@ -59,8 +59,11 @@ void WaitForLoadStop(WebContents* web_contents);
// Causes the specified web_contents to crash. Blocks until it is crashed.
void CrashTab(WebContents* web_contents);
-// Simulates clicking at the center of the given tab asynchronously.
-void SimulateMouseClick(WebContents* web_contents);
+// Simulates clicking at the center of the given tab asynchronously; modifiers
+// may contain bits from WebInputEvent::Modifiers.
+void SimulateMouseClick(WebContents* web_contents,
+ int modifiers,
+ WebKit::WebMouseEvent::Button button);
// Simulates asynchronously a mouse enter/move/leave event.
void SimulateMouseEvent(WebContents* web_contents,