diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 02:24:04 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 02:24:04 +0000 |
commit | 59a6112447827f01c4e40ef3072819f821989570 (patch) | |
tree | be9f7a44a64e899dd2c27fb35d5c17bacd77b088 /chrome/test/automation | |
parent | 94953a56eb19ddef86c0264ef9cd0ac1f0f18332 (diff) | |
download | chromium_src-59a6112447827f01c4e40ef3072819f821989570.zip chromium_src-59a6112447827f01c4e40ef3072819f821989570.tar.gz chromium_src-59a6112447827f01c4e40ef3072819f821989570.tar.bz2 |
Add generic "json dict" entry point for pyauto commands. Will prevent
the need to modify the automation proxy anymore. New pyauto commands
will only need to edit pyauto.py (to add a new SendJSONCommand() call)
and browser_proxy.cc (to implement the other side). Contrast with the
normal editing of ~8 files.
Also added WaitForAllDownloadsToComplete using new JSON path.
BUG=http://crbug.com/39274
Review URL: http://codereview.chromium.org/1547012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 8 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 12 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index bb13297..74dabad 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -1313,4 +1313,12 @@ IPC_BEGIN_MESSAGES(Automation) IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForPopupMenuToOpen, bool /* success */) + // Generic pyauto pattern to help avoid future addition of + // automation messages. + IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_SendJSONRequest, + int /* browser_handle */, + std::string /* JSON request */, + std::string /* JSON response */, + bool /* success */) + IPC_END_MESSAGES(Automation) diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index f0825a0..1b275d8 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -582,3 +582,15 @@ bool BrowserProxy::WaitForPopupMenuToOpen() { return false; return result; } + +bool BrowserProxy::SendJSONRequest(const std::string& request, + std::string* response) { + if (!is_valid()) + return false; + + bool result = false; + return sender_->Send(new AutomationMsg_SendJSONRequest(0, handle_, + request, response, + &result)); + return result; +} diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index 509a630..d0bb4d0 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -226,6 +226,10 @@ class BrowserProxy : public AutomationResourceProxy { bool StartTrackingPopupMenus() WARN_UNUSED_RESULT; bool WaitForPopupMenuToOpen() WARN_UNUSED_RESULT; + // Experimental generic pattern. + bool SendJSONRequest(const std::string& request, + std::string* response) WARN_UNUSED_RESULT; + protected: virtual ~BrowserProxy() {} private: |