OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/test/automation/automation_proxy.h" | 5 #include "chrome/test/automation/automation_proxy.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 void AutomationProxy::InitializeChannel(const std::string& channel_id, | 153 void AutomationProxy::InitializeChannel(const std::string& channel_id, |
154 bool use_named_interface) { | 154 bool use_named_interface) { |
155 DCHECK(shutdown_event_.get() != NULL); | 155 DCHECK(shutdown_event_.get() != NULL); |
156 | 156 |
157 // TODO(iyengar) | 157 // TODO(iyengar) |
158 // The shutdown event could be global on the same lines as the automation | 158 // The shutdown event could be global on the same lines as the automation |
159 // provider, where we use the shutdown event provided by the chrome browser | 159 // provider, where we use the shutdown event provided by the chrome browser |
160 // process. | 160 // process. |
161 channel_.reset(new IPC::SyncChannel( | 161 channel_.reset(new IPC::SyncChannel(this, // we are the listener |
162 this, // we are the listener | 162 thread_->message_loop_proxy().get(), |
163 thread_->message_loop_proxy(), | 163 shutdown_event_.get())); |
164 shutdown_event_.get())); | |
165 channel_->AddFilter(new AutomationMessageFilter(this)); | 164 channel_->AddFilter(new AutomationMessageFilter(this)); |
166 | 165 |
167 // Create the pipe synchronously so that Chrome doesn't try to connect to an | 166 // Create the pipe synchronously so that Chrome doesn't try to connect to an |
168 // unready server. Note this is done after adding a message filter to | 167 // unready server. Note this is done after adding a message filter to |
169 // guarantee that it doesn't miss any messages when we are the client. | 168 // guarantee that it doesn't miss any messages when we are the client. |
170 // See crbug.com/102894. | 169 // See crbug.com/102894. |
171 channel_->Init( | 170 channel_->Init( |
172 channel_id, | 171 channel_id, |
173 use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT | 172 use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT |
174 : IPC::Channel::MODE_SERVER, | 173 : IPC::Channel::MODE_SERVER, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 441 } |
443 | 442 |
444 bool AutomationProxy::SendJSONRequest(const std::string& request, | 443 bool AutomationProxy::SendJSONRequest(const std::string& request, |
445 int timeout_ms, | 444 int timeout_ms, |
446 std::string* response) { | 445 std::string* response) { |
447 bool result = false; | 446 bool result = false; |
448 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) | 447 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) |
449 return false; | 448 return false; |
450 return result; | 449 return result; |
451 } | 450 } |
OLD | NEW |