summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/automation')
-rw-r--r--chrome/test/automation/automation_messages_internal.h12
-rw-r--r--chrome/test/automation/browser_proxy.cc21
-rw-r--r--chrome/test/automation/browser_proxy.h5
3 files changed, 37 insertions, 1 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 64ee503..d9136bf 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -160,7 +160,7 @@ IPC_BEGIN_MESSAGES(Automation, 0)
IPC_MESSAGE_ROUTED1(AutomationMsg_TabTitleRequest, int)
IPC_MESSAGE_ROUTED2(AutomationMsg_TabTitleResponse, int, std::wstring)
- // This message requests the the url of the tab with the given handle.
+ // This message requests the url of the tab with the given handle.
// The response contains a success flag and the URL string. The URL will
// be empty on failure, and it still may be empty on success.
IPC_MESSAGE_ROUTED1(AutomationMsg_TabURLRequest,
@@ -720,4 +720,14 @@ IPC_BEGIN_MESSAGES(Automation, 0)
bool /* the requested autocomplete edit exists */,
std::vector<AutocompleteMatchData> /* matches */)
+ // This message requests the execution of a browser command in the browser
+ // for which the handle is specified.
+ // The response contains a boolean, whether the command execution was
+ // successful.
+ IPC_MESSAGE_ROUTED2(AutomationMsg_WindowExecuteCommandRequest,
+ int /* automation handle */,
+ int /* browser command */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_WindowExecuteCommandResponse,
+ bool /* success flag */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 81b8900..68e41ba 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -346,3 +346,24 @@ bool BrowserProxy::GetHWND(HWND* handle) const {
return succeeded;
}
+
+bool BrowserProxy::RunCommand(int browser_command) const {
+ if (!is_valid())
+ return false;
+
+ IPC::Message* response = NULL;
+ bool succeeded = sender_->SendAndWaitForResponse(
+ new AutomationMsg_WindowExecuteCommandRequest(0, handle_, browser_command),
+ &response, AutomationMsg_WindowExecuteCommandResponse::ID);
+
+ scoped_ptr<IPC::Message> response_deleter(response); // Delete on return.
+ if (!succeeded)
+ return false;
+
+ bool success = false;
+ if (AutomationMsg_WindowExecuteCommandResponse::Read(response, &success))
+ return success;
+
+ // We failed to deserialize the returned value.
+ return false;
+}
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 469b377..17d7385 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -157,6 +157,11 @@ class BrowserProxy : public AutomationResourceProxy {
// reference build.
bool GetHWND(HWND* handle) const;
+ // Run the specified command in the browser (see browser_commands.cc for the
+ // list of supported commands). Returns true if the command was successfully
+ // executed, false otherwise.
+ bool RunCommand(int browser_command) const;
+
private:
DISALLOW_EVIL_CONSTRUCTORS(BrowserProxy);
};