From 876d150b06190f15ea9c9758638f7b70714e37bd Mon Sep 17 00:00:00 2001 From: "robertshield@google.com" Date: Fri, 22 May 2009 15:00:26 +0000 Subject: Adding the ability to alter Chrome's proxy settings via the automation interface for automated testing. Review URL: http://codereview.chromium.org/113482 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16741 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/automation/automation_constants.h | 4 ++-- chrome/test/automation/automation_messages_internal.h | 8 +++++++- chrome/test/automation/automation_proxy.cc | 4 ++++ chrome/test/automation/automation_proxy.h | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) (limited to 'chrome/test') diff --git a/chrome/test/automation/automation_constants.h b/chrome/test/automation/automation_constants.h index 06d13e0..b08836d 100644 --- a/chrome/test/automation/automation_constants.h +++ b/chrome/test/automation/automation_constants.h @@ -6,8 +6,8 @@ #define CHROME_TEST_AUTOMATION_AUTOMATION_CONSTANTS_H__ namespace automation { - // Amount of time to wait before querying the browser. - static const int kSleepTime = 250; +// Amount of time to wait before querying the browser. +static const int kSleepTime = 250; } // Used by AutomationProxy, declared here so that other headers don't need diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index eaf5c4a..b1f854e 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -335,6 +335,12 @@ IPC_BEGIN_MESSAGES(Automation) IPC_MESSAGE_ROUTED1(AutomationMsg_SetFilteredInet, bool /* enabled */) + // This message tells the browser to start using the new proxy configuration + // represented by the given JSON string. The parameters used in the JSON + // string are defined in automation_constants.h. + IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_SetProxyConfig, + std::string /* proxy_config_json_string */) + // Gets the directory that downloads will occur in for the active profile. IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_DownloadDirectory, int /* tab_handle */, @@ -754,7 +760,7 @@ IPC_BEGIN_MESSAGES(Automation) // A message for an external host. IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardMessageToExternalHost, - int, // handle + int, /* handle */ std::string /* message */, std::string /* origin */, std::string /* target */) diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index 3f6508b..9fc8193 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -370,6 +370,10 @@ bool AutomationProxy::SetFilteredInet(bool enabled) { return Send(new AutomationMsg_SetFilteredInet(0, enabled)); } +bool AutomationProxy::SendProxyConfig(const std::string& new_proxy_config) { + return Send(new AutomationMsg_SetProxyConfig(0, new_proxy_config)); +} + void AutomationProxy::Disconnect() { channel_.reset(); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 0b8ad57..75c76cd 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -145,6 +145,10 @@ class AutomationProxy : public IPC::Channel::Listener, // false if the message fails to send to the browser. bool SetFilteredInet(bool enabled); + // Sends the browser a new proxy configuration to start using. Returns true + // if the proxy config was successfully sent, false otherwise. + bool SendProxyConfig(const std::string& new_proxy_config); + // These methods are intended to be called by the background thread // to signal that the given event has occurred, and that any corresponding // Wait... function can return. -- cgit v1.1