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

Side by Side Diff: chrome/test/chromedriver/chrome/devtools_http_client.cc

Issue 2125123002: [chromedriver] Add page loading strategy to capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed unittests, renamed py tests Created 4 years, 4 months 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
OLDNEW
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/devtools_http_client.h" 5 #include "chrome/test/chromedriver/chrome/devtools_http_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return &views_info[i]; 63 return &views_info[i];
64 } 64 }
65 return NULL; 65 return NULL;
66 } 66 }
67 67
68 DevToolsHttpClient::DevToolsHttpClient( 68 DevToolsHttpClient::DevToolsHttpClient(
69 const NetAddress& address, 69 const NetAddress& address,
70 scoped_refptr<URLRequestContextGetter> context_getter, 70 scoped_refptr<URLRequestContextGetter> context_getter,
71 const SyncWebSocketFactory& socket_factory, 71 const SyncWebSocketFactory& socket_factory,
72 std::unique_ptr<DeviceMetrics> device_metrics, 72 std::unique_ptr<DeviceMetrics> device_metrics,
73 std::unique_ptr<std::set<WebViewInfo::Type>> window_types) 73 std::unique_ptr<std::set<WebViewInfo::Type>> window_types,
74 std::string page_load_strategy)
74 : context_getter_(context_getter), 75 : context_getter_(context_getter),
75 socket_factory_(socket_factory), 76 socket_factory_(socket_factory),
76 server_url_("http://" + address.ToString()), 77 server_url_("http://" + address.ToString()),
77 web_socket_url_prefix_(base::StringPrintf("ws://%s/devtools/page/", 78 web_socket_url_prefix_(base::StringPrintf("ws://%s/devtools/page/",
78 address.ToString().c_str())), 79 address.ToString().c_str())),
79 device_metrics_(std::move(device_metrics)), 80 device_metrics_(std::move(device_metrics)),
80 window_types_(std::move(window_types)) { 81 window_types_(std::move(window_types)),
82 page_load_strategy_(page_load_strategy) {
81 window_types_->insert(WebViewInfo::kPage); 83 window_types_->insert(WebViewInfo::kPage);
82 window_types_->insert(WebViewInfo::kApp); 84 window_types_->insert(WebViewInfo::kApp);
83 } 85 }
84 86
85 DevToolsHttpClient::~DevToolsHttpClient() {} 87 DevToolsHttpClient::~DevToolsHttpClient() {}
86 88
87 Status DevToolsHttpClient::Init(const base::TimeDelta& timeout) { 89 Status DevToolsHttpClient::Init(const base::TimeDelta& timeout) {
88 base::TimeTicks deadline = base::TimeTicks::Now() + timeout; 90 base::TimeTicks deadline = base::TimeTicks::Now() + timeout;
89 std::string version_url = server_url_ + "/json/version"; 91 std::string version_url = server_url_ + "/json/version";
90 std::string data; 92 std::string data;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 status = CloseWebView(*it); 198 status = CloseWebView(*it);
197 if (status.IsError()) 199 if (status.IsError())
198 return status; 200 return status;
199 } 201 }
200 202
201 for (std::list<std::string>::const_iterator it = docked_frontend_ids.begin(); 203 for (std::list<std::string>::const_iterator it = docked_frontend_ids.begin();
202 it != docked_frontend_ids.end(); ++it) { 204 it != docked_frontend_ids.end(); ++it) {
203 std::unique_ptr<DevToolsClient> client(new DevToolsClientImpl( 205 std::unique_ptr<DevToolsClient> client(new DevToolsClientImpl(
204 socket_factory_, web_socket_url_prefix_ + *it, *it)); 206 socket_factory_, web_socket_url_prefix_ + *it, *it));
205 std::unique_ptr<WebViewImpl> web_view( 207 std::unique_ptr<WebViewImpl> web_view(
206 new WebViewImpl(*it, &browser_info_, std::move(client), NULL)); 208 new WebViewImpl(*it, &browser_info_, std::move(client), NULL,
209 page_load_strategy_));
207 210
208 status = web_view->ConnectIfNecessary(); 211 status = web_view->ConnectIfNecessary();
209 // Ignore disconnected error, because the debugger might have closed when 212 // Ignore disconnected error, because the debugger might have closed when
210 // its container page was closed above. 213 // its container page was closed above.
211 if (status.IsError() && status.code() != kDisconnected) 214 if (status.IsError() && status.code() != kDisconnected)
212 return status; 215 return status;
213 216
214 std::unique_ptr<base::Value> result; 217 std::unique_ptr<base::Value> result;
215 status = CloseWebView(*it); 218 status = CloseWebView(*it);
216 // Ignore disconnected error, because it may be closed already. 219 // Ignore disconnected error, because it may be closed already.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 Status status = ParseType(type_as_string, &type); 306 Status status = ParseType(type_as_string, &type);
304 if (status.IsError()) 307 if (status.IsError())
305 return status; 308 return status;
306 temp_views_info.push_back(WebViewInfo(id, debugger_url, url, type)); 309 temp_views_info.push_back(WebViewInfo(id, debugger_url, url, type));
307 } 310 }
308 *views_info = WebViewsInfo(temp_views_info); 311 *views_info = WebViewsInfo(temp_views_info);
309 return Status(kOk); 312 return Status(kOk);
310 } 313 }
311 314
312 } // namespace internal 315 } // namespace internal
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/devtools_http_client.h ('k') | chrome/test/chromedriver/chrome/navigation_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698