summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
authorjcampan@google.com <jcampan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-04 23:28:47 +0000
committerjcampan@google.com <jcampan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-04 23:28:47 +0000
commit4ae627586ecb6184c3b766fd5128709442b17360 (patch)
tree44726dd64ec639e8545b189c52f9bb6de1ecb818 /chrome/test/automation
parent41c2cd46aecd34eb258ed92b242ee86c333f06a8 (diff)
downloadchromium_src-4ae627586ecb6184c3b766fd5128709442b17360.zip
chromium_src-4ae627586ecb6184c3b766fd5128709442b17360.tar.gz
chromium_src-4ae627586ecb6184c3b766fd5128709442b17360.tar.bz2
Another attempt at this CL.
I had to revert because it was somehow causing regressions on the page cycler and start-up tests. (I suspect because I did add an IPC message not at the end of the message list) TBR=beng git-svn-id: svn://svn.chromium.org/chrome/trunk/src@351 0039d316-1c4b-4281-b951-d872f2087c98
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);
};