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

Side by Side Diff: chrome_frame/chrome_frame_automation.cc

Issue 4202004: Add named testing interface (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_frame/chrome_frame_automation.h" 5 #include "chrome_frame/chrome_frame_automation.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 InvokeCallback<UnloadContext>(msg, context); 128 InvokeCallback<UnloadContext>(msg, context);
129 break; 129 break;
130 default: 130 default:
131 NOTREACHED(); 131 NOTREACHED();
132 } 132 }
133 return true; 133 return true;
134 } 134 }
135 }; 135 };
136 136
137 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( 137 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl(
138 AutomationProxyCacheEntry* entry, int launch_timeout) 138 AutomationProxyCacheEntry* entry,
139 std::string channel_id, int launch_timeout)
139 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { 140 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) {
140 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, ""); 141 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, "");
141 142
143 InitializeChannel(channel_id, false);
144
142 sync_ = new CFMsgDispatcher(); 145 sync_ = new CFMsgDispatcher();
143 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); 146 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get());
144 147
145 // Order of filters is not important. 148 // Order of filters is not important.
146 channel_->AddFilter(message_filter_.get()); 149 channel_->AddFilter(message_filter_.get());
147 channel_->AddFilter(sync_.get()); 150 channel_->AddFilter(sync_.get());
148 } 151 }
149 152
150 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { 153 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() {
151 TRACE_EVENT_END("chromeframe.automationproxy", this, ""); 154 TRACE_EVENT_END("chromeframe.automationproxy", this, "");
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 DCHECK(delegate); 258 DCHECK(delegate);
256 DCHECK(params); 259 DCHECK(params);
257 DCHECK(proxy_.get() == NULL); 260 DCHECK(proxy_.get() == NULL);
258 261
259 // We *must* create automationproxy in a thread that has message loop, 262 // We *must* create automationproxy in a thread that has message loop,
260 // since SyncChannel::Context construction registers event to be watched 263 // since SyncChannel::Context construction registers event to be watched
261 // through ObjectWatcher which subscribes for the current thread message loop 264 // through ObjectWatcher which subscribes for the current thread message loop
262 // destruction notification. 265 // destruction notification.
263 266
264 // At same time we must destroy/stop the thread from another thread. 267 // At same time we must destroy/stop the thread from another thread.
268 std::string channel_id = AutomationProxy::GenerateChannelID();
265 ChromeFrameAutomationProxyImpl* proxy = 269 ChromeFrameAutomationProxyImpl* proxy =
266 new ChromeFrameAutomationProxyImpl(this, params->launch_timeout()); 270 new ChromeFrameAutomationProxyImpl(this, channel_id,
271 params->launch_timeout());
267 272
268 // Ensure that the automation proxy actually respects our choice on whether 273 // Ensure that the automation proxy actually respects our choice on whether
269 // or not to check the version. 274 // or not to check the version.
270 proxy->set_perform_version_check(params->version_check()); 275 proxy->set_perform_version_check(params->version_check());
271 276
272 // Launch browser 277 // Launch browser
273 scoped_ptr<CommandLine> command_line( 278 scoped_ptr<CommandLine> command_line(
274 chrome_launcher::CreateLaunchCommandLine()); 279 chrome_launcher::CreateLaunchCommandLine());
275 command_line->AppendSwitchASCII(switches::kAutomationClientChannelID, 280 command_line->AppendSwitchASCII(switches::kAutomationClientChannelID,
276 proxy->channel_id()); 281 channel_id);
277 282
278 // Run Chrome in Chrome Frame mode. In practice, this modifies the paths 283 // Run Chrome in Chrome Frame mode. In practice, this modifies the paths
279 // and registry keys that Chrome looks in via the BrowserDistribution 284 // and registry keys that Chrome looks in via the BrowserDistribution
280 // mechanism. 285 // mechanism.
281 command_line->AppendSwitch(switches::kChromeFrame); 286 command_line->AppendSwitch(switches::kChromeFrame);
282 287
283 // Chrome Frame never wants Chrome to start up with a First Run UI. 288 // Chrome Frame never wants Chrome to start up with a First Run UI.
284 command_line->AppendSwitch(switches::kNoFirstRun); 289 command_line->AppendSwitch(switches::kNoFirstRun);
285 290
286 command_line->AppendSwitch(switches::kDisablePopupBlocking); 291 command_line->AppendSwitch(switches::kDisablePopupBlocking);
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 const URLRequestStatus& status) { 1462 const URLRequestStatus& status) {
1458 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), 1463 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(),
1459 request_id, status)); 1464 request_id, status));
1460 } 1465 }
1461 1466
1462 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, 1467 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success,
1463 const GURL& url, const std::string& cookie_string, int cookie_id) { 1468 const GURL& url, const std::string& cookie_string, int cookie_id) {
1464 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, 1469 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0,
1465 tab_->handle(), success, url, cookie_string, cookie_id)); 1470 tab_->handle(), success, url, cookie_string, cookie_id));
1466 } 1471 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698