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

Unified Diff: chrome/test/webdriver/commands/mouse_commands.cc

Issue 6694007: Small test and ChromeDriver fixes to enable additional tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Dennis' comments Created 9 years, 9 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 | « chrome/test/webdriver/WEBDRIVER_TESTS ('k') | chrome/test/webdriver/commands/webelement_commands.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/webdriver/commands/mouse_commands.cc
diff --git a/chrome/test/webdriver/commands/mouse_commands.cc b/chrome/test/webdriver/commands/mouse_commands.cc
index 93341ff031617438bcd37266f4e8dab67321d42d..a802a9820d9a815aaf9f689b66d0a03219b27e14 100644
--- a/chrome/test/webdriver/commands/mouse_commands.cc
+++ b/chrome/test/webdriver/commands/mouse_commands.cc
@@ -22,9 +22,22 @@ bool MouseCommand::DoesPost() {
}
void MouseCommand::ExecutePost(Response* response) {
- // TODO(jmikhail): verify that the element is visible
+ bool is_displayed;
+ ErrorCode code = session_->IsElementDisplayed(
+ session_->current_target(), element, &is_displayed);
+ if (code != kSuccess) {
+ SET_WEBDRIVER_ERROR(response, "Failed to determine element visibility",
+ code);
+ return;
+ }
+ if (!is_displayed) {
+ SET_WEBDRIVER_ERROR(response, "Element must be displayed",
+ kElementNotVisible);
+ return;
+ }
+
gfx::Point location;
- ErrorCode code = session_->GetElementLocationInView(element, &location);
+ code = session_->GetElementLocationInView(element, &location);
if (code != kSuccess) {
SET_WEBDRIVER_ERROR(response, "Failed to compute element location.",
code);
@@ -39,17 +52,18 @@ void MouseCommand::ExecutePost(Response* response) {
}
location.Offset(size.width() / 2, size.height() / 2);
+ bool success = false;
switch (cmd_) {
case kClick:
VLOG(1) << "Mouse click at: (" << location.x() << ", "
<< location.y() << ")" << std::endl;
- session_->MouseClick(location, automation::kLeftButton);
+ success = session_->MouseClick(location, automation::kLeftButton);
break;
case kHover:
VLOG(1) << "Mouse hover at: (" << location.x() << ", "
<< location.y() << ")" << std::endl;
- session_->MouseMove(location);
+ success = session_->MouseMove(location);
break;
case kDrag: {
@@ -65,7 +79,7 @@ void MouseCommand::ExecutePost(Response* response) {
<< "(" << location.x() << ", " << location.y() << ") "
<< "to: (" << drag_to.x() << ", " << drag_to.y() << ")"
<< std::endl;
- session_->MouseDrag(location, drag_to);
+ success = session_->MouseDrag(location, drag_to);
break;
}
@@ -74,6 +88,11 @@ void MouseCommand::ExecutePost(Response* response) {
return;
}
+ if (!success) {
+ SET_WEBDRIVER_ERROR(response, "Performing mouse operation failed",
+ kUnknownError);
+ return;
+ }
response->SetStatus(kSuccess);
}
« no previous file with comments | « chrome/test/webdriver/WEBDRIVER_TESTS ('k') | chrome/test/webdriver/commands/webelement_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698