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

Unified Diff: chrome/test/webdriver/automation.cc

Issue 7522024: Refactor chromedriver's script execution to reduce amount of custom Value parsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 5 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: chrome/test/webdriver/automation.cc
diff --git a/chrome/test/webdriver/automation.cc b/chrome/test/webdriver/automation.cc
index 3d7c311d62eb6704a7d1f89df6e5048ad430542a..c8ce8b0da51b3c44224cec0e38054817df9521cb 100644
--- a/chrome/test/webdriver/automation.cc
+++ b/chrome/test/webdriver/automation.cc
@@ -31,8 +31,8 @@
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/proxy_launcher.h"
#include "chrome/test/webdriver/frame_path.h"
+#include "chrome/test/webdriver/webdriver_basic_types.h"
#include "chrome/test/webdriver/webdriver_error.h"
-#include "ui/gfx/point.h"
#if defined(OS_WIN)
#include "base/win/registry.h"
@@ -242,7 +242,7 @@ void Automation::ExecuteScript(int tab_id,
}
void Automation::MouseMove(int tab_id,
- const gfx::Point& p,
+ const Point& p,
Error** error) {
int windex = 0, tab_index = 0;
*error = GetIndicesForTab(tab_id, &windex, &tab_index);
@@ -251,13 +251,14 @@ void Automation::MouseMove(int tab_id,
std::string error_msg;
if (!SendMouseMoveJSONRequest(
- automation(), windex, tab_index, p.x(), p.y(), &error_msg)) {
+ automation(), windex, tab_index,
+ static_cast<int>(p.x()), static_cast<int>(p.y()), &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
void Automation::MouseClick(int tab_id,
- const gfx::Point& p,
+ const Point& p,
automation::MouseButton button,
Error** error) {
int windex = 0, tab_index = 0;
@@ -273,8 +274,8 @@ void Automation::MouseClick(int tab_id,
}
void Automation::MouseDrag(int tab_id,
- const gfx::Point& start,
- const gfx::Point& end,
+ const Point& start,
+ const Point& end,
Error** error) {
int windex = 0, tab_index = 0;
*error = GetIndicesForTab(tab_id, &windex, &tab_index);
@@ -282,14 +283,16 @@ void Automation::MouseDrag(int tab_id,
return;
std::string error_msg;
- if (!SendMouseDragJSONRequest(automation(), windex, tab_index, start.x(),
- start.y(), end.x(), end.y(), &error_msg)) {
+ if (!SendMouseDragJSONRequest(
+ automation(), windex, tab_index, static_cast<int>(start.x()),
+ static_cast<int>(start.y()), static_cast<int>(end.x()),
Paweł Hajdan Jr. 2011/08/02 20:04:47 Why do we need those static_casts all over the pla
kkania 2011/08/03 17:07:56 Done.
+ static_cast<int>(end.y()), &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
void Automation::MouseButtonUp(int tab_id,
- const gfx::Point& p,
+ const Point& p,
Error** error) {
*error = CheckAdvancedInteractionsSupported();
if (*error)
@@ -302,13 +305,14 @@ void Automation::MouseButtonUp(int tab_id,
std::string error_msg;
if (!SendMouseButtonUpJSONRequest(
- automation(), windex, tab_index, p.x(), p.y(), &error_msg)) {
+ automation(), windex, tab_index, static_cast<int>(p.x()),
+ static_cast<int>(p.y()), &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
void Automation::MouseButtonDown(int tab_id,
- const gfx::Point& p,
+ const Point& p,
Error** error) {
*error = CheckAdvancedInteractionsSupported();
if (*error)
@@ -321,13 +325,14 @@ void Automation::MouseButtonDown(int tab_id,
std::string error_msg;
if (!SendMouseButtonDownJSONRequest(
- automation(), windex, tab_index, p.x(), p.y(), &error_msg)) {
+ automation(), windex, tab_index, static_cast<int>(p.x()),
+ static_cast<int>(p.y()), &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
void Automation::MouseDoubleClick(int tab_id,
- const gfx::Point& p,
+ const Point& p,
Error** error) {
*error = CheckAdvancedInteractionsSupported();
if (*error)
@@ -340,13 +345,14 @@ void Automation::MouseDoubleClick(int tab_id,
std::string error_msg;
if (!SendMouseDoubleClickJSONRequest(
- automation(), windex, tab_index, p.x(), p.y(), &error_msg)) {
+ automation(), windex, tab_index, static_cast<int>(p.x()),
+ static_cast<int>(p.y()), &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
void Automation::DragAndDropFilePaths(
- int tab_id, const gfx::Point& location,
+ int tab_id, const Point& location,
const std::vector<FilePath::StringType>& paths, Error** error) {
int windex = 0, tab_index = 0;
*error = GetIndicesForTab(tab_id, &windex, &tab_index);
@@ -356,7 +362,8 @@ void Automation::DragAndDropFilePaths(
std::string error_msg;
if (!SendDragAndDropFilePathsJSONRequest(
- automation(), windex, tab_index, location.x(), location.y(), paths,
+ automation(), windex, tab_index, static_cast<int>(location.x()),
+ static_cast<int>(location.y()), paths,
&error_msg)) {
*error = new Error(kUnknownError, error_msg);
}

Powered by Google App Engine
This is Rietveld 408576698