Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Unified Diff: remoting/test/remote_desktop_browsertest.cc

Issue 24096025: Simulate a mouse click. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_tests_e2b
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/test/remote_desktop_browsertest.cc
diff --git a/remoting/test/remote_desktop_browsertest.cc b/remoting/test/remote_desktop_browsertest.cc
index 553b57dc58b617f05cfaa3014a6e5648136bc35d..c0095c6efb129f3ad342567c7f5b5f3c33c2b22d 100644
--- a/remoting/test/remote_desktop_browsertest.cc
+++ b/remoting/test/remote_desktop_browsertest.cc
@@ -281,6 +281,34 @@ void RemoteDesktopBrowserTest::SimulateStringInput(const std::string& input) {
SimulateCharInput(input[i]);
}
+void RemoteDesktopBrowserTest::SimulateMouseClickAt(int x, int y) {
+ SimulateMouseClickAt(0, WebKit::WebMouseEvent::ButtonLeft, x, y);
+}
+
+void RemoteDesktopBrowserTest::SimulateMouseClickAt(
+ int modifiers, WebKit::WebMouseEvent::Button button, int x, int y) {
+ ExecuteScript(
+ "var clientPluginElement = "
+ "document.getElementById('session-client-plugin');"
+ "var clientPluginRect = clientPluginElement.getBoundingClientRect();");
+
+ int top = ExecuteScriptAndExtractInt("clientPluginRect.top");
+ int left = ExecuteScriptAndExtractInt("clientPluginRect.left");
+ int width = ExecuteScriptAndExtractInt("clientPluginRect.width");
+ int height = ExecuteScriptAndExtractInt("clientPluginRect.height");
+
+ ASSERT_GT(x, 0);
+ ASSERT_LT(x, width);
+ ASSERT_GT(y, 0);
+ ASSERT_LT(y, height);
+
+ content::SimulateMouseClickAt(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ modifiers,
+ button,
+ gfx::Point(left + x, top + y));
+}
+
void RemoteDesktopBrowserTest::Install() {
// TODO(weitaosu): add support for unpacked extension (the v2 app needs it).
if (!NoInstall()) {
« remoting/test/remote_desktop_browsertest.h ('K') | « remoting/test/remote_desktop_browsertest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698