Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chrome/test/automation/automation_proxy.cc

Issue 8417054: Allow proxy channels to be created without initializing the underlying channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 8
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 void AutomationProxy::InitializeChannel(const std::string& channel_id, 156 void AutomationProxy::InitializeChannel(const std::string& channel_id,
157 bool use_named_interface) { 157 bool use_named_interface) {
158 DCHECK(shutdown_event_.get() != NULL); 158 DCHECK(shutdown_event_.get() != NULL);
159 159
160 // TODO(iyengar) 160 // TODO(iyengar)
161 // The shutdown event could be global on the same lines as the automation 161 // The shutdown event could be global on the same lines as the automation
162 // provider, where we use the shutdown event provided by the chrome browser 162 // provider, where we use the shutdown event provided by the chrome browser
163 // process. 163 // process.
164 IPC::Channel::Mode mode = 164 channel_.reset(new IPC::SyncChannel(
165 this, // we are the listener
166 thread_->message_loop_proxy(),
167 shutdown_event_.get()));
168 channel_->AddFilter(new AutomationMessageFilter(this));
169
170 // Create the pipe synchronously so that Chrome doesn't try to connect to an
171 // unready server. Note this is done after adding a message filter to
172 // guarantee that it doesn't miss any messages when we are the client.
173 // See crbug.com/102894.
174 channel_->Init(
175 channel_id,
165 use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT 176 use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT
166 : IPC::Channel::MODE_SERVER; 177 : IPC::Channel::MODE_SERVER,
167 // Create the pipe immediately if we are serving, so that Chrome doesn't try 178 true /* create_pipe_now */);
168 // to connect an unready server. Create it asynchronously if we are the
169 // client, otherwise the filter may not be in place before Chrome sends
170 // the first automation Hello message.
171 bool create_pipe_now = mode & IPC::Channel::MODE_SERVER_FLAG;
172 channel_.reset(new IPC::SyncChannel(
173 channel_id,
174 mode,
175 this, // we are the listener
176 thread_->message_loop_proxy(),
177 create_pipe_now,
178 shutdown_event_.get()));
179 channel_->AddFilter(new AutomationMessageFilter(this));
180 } 179 }
181 180
182 void AutomationProxy::InitializeHandleTracker() { 181 void AutomationProxy::InitializeHandleTracker() {
183 tracker_.reset(new AutomationHandleTracker()); 182 tracker_.reset(new AutomationHandleTracker());
184 } 183 }
185 184
186 AutomationLaunchResult AutomationProxy::WaitForAppLaunch() { 185 AutomationLaunchResult AutomationProxy::WaitForAppLaunch() {
187 AutomationLaunchResult result = AUTOMATION_SUCCESS; 186 AutomationLaunchResult result = AUTOMATION_SUCCESS;
188 if (app_launched_.TimedWait(action_timeout_)) { 187 if (app_launched_.TimedWait(action_timeout_)) {
189 if (server_version_ == kChannelErrorVersionString) { 188 if (server_version_ == kChannelErrorVersionString) {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 589 }
591 590
592 bool AutomationProxy::SendJSONRequest(const std::string& request, 591 bool AutomationProxy::SendJSONRequest(const std::string& request,
593 int timeout_ms, 592 int timeout_ms,
594 std::string* response) { 593 std::string* response) {
595 bool result = false; 594 bool result = false;
596 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) 595 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result))
597 return false; 596 return false;
598 return result; 597 return result;
599 } 598 }
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698