OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 std::unique_ptr<std::set<WebViewInfo::Type>> window_types; | 190 std::unique_ptr<std::set<WebViewInfo::Type>> window_types; |
191 if (capabilities && !capabilities->window_types.empty()) { | 191 if (capabilities && !capabilities->window_types.empty()) { |
192 window_types.reset( | 192 window_types.reset( |
193 new std::set<WebViewInfo::Type>(capabilities->window_types)); | 193 new std::set<WebViewInfo::Type>(capabilities->window_types)); |
194 } else { | 194 } else { |
195 window_types.reset(new std::set<WebViewInfo::Type>()); | 195 window_types.reset(new std::set<WebViewInfo::Type>()); |
196 } | 196 } |
197 | 197 |
198 std::unique_ptr<DevToolsHttpClient> client(new DevToolsHttpClient( | 198 std::unique_ptr<DevToolsHttpClient> client(new DevToolsHttpClient( |
199 address, context_getter, socket_factory, std::move(device_metrics), | 199 address, context_getter, socket_factory, std::move(device_metrics), |
200 std::move(window_types))); | 200 std::move(window_types), capabilities->page_load_strategy)); |
201 base::TimeTicks deadline = | 201 base::TimeTicks deadline = |
202 base::TimeTicks::Now() + base::TimeDelta::FromSeconds(60); | 202 base::TimeTicks::Now() + base::TimeDelta::FromSeconds(60); |
203 Status status = client->Init(deadline - base::TimeTicks::Now()); | 203 Status status = client->Init(deadline - base::TimeTicks::Now()); |
204 if (status.IsError()) | 204 if (status.IsError()) |
205 return status; | 205 return status; |
206 | 206 |
207 const BrowserInfo* browser_info = client->browser_info(); | 207 const BrowserInfo* browser_info = client->browser_info(); |
208 if (browser_info->is_android && | 208 if (browser_info->is_android && |
209 browser_info->android_package != capabilities->android_package) { | 209 browser_info->android_package != capabilities->android_package) { |
210 // DevTools from Chrome 30 and earlier did not provide an Android-Package | 210 // DevTools from Chrome 30 and earlier did not provide an Android-Package |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 Status LaunchRemoteChromeSession( | 282 Status LaunchRemoteChromeSession( |
283 URLRequestContextGetter* context_getter, | 283 URLRequestContextGetter* context_getter, |
284 const SyncWebSocketFactory& socket_factory, | 284 const SyncWebSocketFactory& socket_factory, |
285 const Capabilities& capabilities, | 285 const Capabilities& capabilities, |
286 ScopedVector<DevToolsEventListener>* devtools_event_listeners, | 286 ScopedVector<DevToolsEventListener>* devtools_event_listeners, |
287 std::unique_ptr<Chrome>* chrome) { | 287 std::unique_ptr<Chrome>* chrome) { |
288 Status status(kOk); | 288 Status status(kOk); |
289 std::unique_ptr<DevToolsHttpClient> devtools_http_client; | 289 std::unique_ptr<DevToolsHttpClient> devtools_http_client; |
290 status = WaitForDevToolsAndCheckVersion( | 290 status = WaitForDevToolsAndCheckVersion( |
291 capabilities.debugger_address, context_getter, socket_factory, | 291 capabilities.debugger_address, context_getter, socket_factory, |
292 NULL, &devtools_http_client); | 292 &capabilities, &devtools_http_client); |
293 if (status.IsError()) { | 293 if (status.IsError()) { |
294 return Status(kUnknownError, "cannot connect to chrome at " + | 294 return Status(kUnknownError, "cannot connect to chrome at " + |
295 capabilities.debugger_address.ToString(), | 295 capabilities.debugger_address.ToString(), |
296 status); | 296 status); |
297 } | 297 } |
298 | 298 |
299 std::unique_ptr<DevToolsClient> devtools_websocket_client; | 299 std::unique_ptr<DevToolsClient> devtools_websocket_client; |
300 status = CreateBrowserwideDevToolsClientAndConnect( | 300 status = CreateBrowserwideDevToolsClientAndConnect( |
301 capabilities.debugger_address, capabilities.perf_logging_prefs, | 301 capabilities.debugger_address, capabilities.perf_logging_prefs, |
302 socket_factory, *devtools_event_listeners, &devtools_websocket_client); | 302 socket_factory, *devtools_event_listeners, &devtools_websocket_client); |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 // Write empty "First Run" file, otherwise Chrome will wipe the default | 868 // Write empty "First Run" file, otherwise Chrome will wipe the default |
869 // profile that was written. | 869 // profile that was written. |
870 if (base::WriteFile( | 870 if (base::WriteFile( |
871 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 871 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
872 return Status(kUnknownError, "failed to write first run file"); | 872 return Status(kUnknownError, "failed to write first run file"); |
873 } | 873 } |
874 return Status(kOk); | 874 return Status(kOk); |
875 } | 875 } |
876 | 876 |
877 } // namespace internal | 877 } // namespace internal |
OLD | NEW |