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

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 9288051: Implement the webdriver window sizing commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 11 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/browser/automation/testing_automation_provider.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/testing_automation_provider.cc
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index e1e8e46cf101ffe1e0f5c15393cdbc4b0da91ab6..11ffd4f01c20edb9590f252aa26fcb4a8e8cae1f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -118,6 +118,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
#include "content/public/browser/child_process_data.h"
@@ -2339,6 +2340,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
&TestingAutomationProvider::DoesAutomationObjectExist;
handler_map["CloseTab"] =
&TestingAutomationProvider::CloseTabJSON;
+ handler_map["SetViewBounds"] =
+ &TestingAutomationProvider::SetViewBounds;
handler_map["WebkitMouseMove"] =
&TestingAutomationProvider::WebkitMouseMove;
handler_map["WebkitMouseClick"] =
@@ -6291,7 +6294,8 @@ void TestingAutomationProvider::ExecuteJavascriptJSON(
std::string error;
RenderViewHost* render_view;
if (!GetRenderViewFromJSONArgs(args, profile(), &render_view, &error)) {
- AutomationJSONReply(this, reply_message).SendError(error);
+ AutomationJSONReply(this, reply_message).SendError(
+ Error(automation::kInvalidId, error));
return;
}
if (!args->GetString("frame_xpath", &frame_xpath)) {
@@ -6581,6 +6585,28 @@ void TestingAutomationProvider::CloseTabJSON(
reply.SendSuccess(NULL);
}
+void TestingAutomationProvider::SetViewBounds(
+ base::DictionaryValue* args,
+ IPC::Message* reply_message) {
+ AutomationJSONReply reply(this, reply_message);
+ int x, y, width, height;
+ if (!args->GetInteger("bounds.x", &x) ||
+ !args->GetInteger("bounds.y", &y) ||
+ !args->GetInteger("bounds.width", &width) ||
+ !args->GetInteger("bounds.height", &height)) {
+ reply.SendError("Missing or invalid 'bounds'");
+ return;
+ }
+ Browser* browser;
+ std::string error;
+ if (!GetBrowserFromJSONArgs(args, &browser, &error)) {
+ reply.SendError(Error(automation::kInvalidId, error));
+ return;
+ }
+ browser->window()->SetBounds(gfx::Rect(x, y, width, height));
+ reply.SendSuccess(NULL);
+}
+
void TestingAutomationProvider::ActivateTabJSON(
DictionaryValue* args,
IPC::Message* reply_message) {
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698