summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/automation')
-rw-r--r--chrome/test/automation/automation_proxy.cc13
-rw-r--r--chrome/test/automation/automation_proxy.h8
2 files changed, 19 insertions, 2 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 07e5387..6d98f0d 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -325,6 +325,10 @@ bool AutomationProxy::SetFilteredInet(bool enabled) {
return Send(new AutomationMsg_SetFilteredInet(0, enabled));
}
+void AutomationProxy::Disconnect() {
+ channel_.reset();
+}
+
void AutomationProxy::OnMessageReceived(const IPC::Message& msg) {
// This won't get called unless AutomationProxy is run from
// inside a message loop.
@@ -491,6 +495,15 @@ AutocompleteEditProxy* AutomationProxy::GetAutocompleteEditForBrowser(
autocomplete_edit_handle);
}
+bool AutomationProxy::Send(IPC::Message* message) {
+ if (channel_.get())
+ return channel_->Send(message);
+
+ DLOG(WARNING) << "Channel has been closed; dropping message!";
+ delete message;
+ return false;
+}
+
bool AutomationProxy::SendAndWaitForResponse(IPC::Message* request,
IPC::Message** response,
int response_type) {
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index e8d63b5..58ffbac 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -91,6 +91,9 @@ class AutomationProxy : public IPC::Channel::Listener,
virtual void OnMessageReceived(const IPC::Message& msg);
virtual void OnChannelError();
+ // Close the automation IPC channel.
+ void Disconnect();
+
// Waits for the app to launch and the automation provider to say hello
// (the app isn't fully done loading by this point).
// Returns true if the launch is successful
@@ -188,7 +191,7 @@ class AutomationProxy : public IPC::Channel::Listener,
const std::wstring& channel_id() const { return channel_id_; }
// AutomationMessageSender implementations.
- virtual bool Send(IPC::Message* message) { return channel_->Send(message); }
+ virtual bool Send(IPC::Message* message);
virtual bool SendAndWaitForResponse(IPC::Message* request,
IPC::Message** response,
int response_type);
@@ -211,7 +214,8 @@ class AutomationProxy : public IPC::Channel::Listener,
// Creates a tab that can hosted in an external process. The function
// returns a TabProxy representing the tab as well as a window handle
// that can be reparented in another process.
- TabProxy* AutomationProxy::CreateExternalTab(HWND* external_tab_container);
+ TabProxy* CreateExternalTab(HWND* external_tab_container);
+
private:
DISALLOW_EVIL_CONSTRUCTORS(AutomationProxy);