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

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: Fixing comments. 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
« no previous file with comments | « remoting/test/remote_desktop_browsertest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e1dc25a499965488f801a49cc2cdbe402951c5b3 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::SimulateMouseLeftClickAt(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()) {
« no previous file with comments | « remoting/test/remote_desktop_browsertest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698