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

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

Issue 2785083002: Use devtools to set user agent in chromedriver (Closed)
Patch Set: Fix New Tab test Created 3 years, 8 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/chrome_desktop_impl.h" 5 #include "chrome/test/chromedriver/chrome/chrome_desktop_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 const DeviceMetrics* device_metrics = devtools_http_client_->device_metrics(); 142 const DeviceMetrics* device_metrics = devtools_http_client_->device_metrics();
143 if (type == WebViewInfo::Type::kApp || 143 if (type == WebViewInfo::Type::kApp ||
144 type == WebViewInfo::Type::kBackgroundPage) { 144 type == WebViewInfo::Type::kBackgroundPage) {
145 // Apps and extensions don't work on Android, so it doesn't make sense to 145 // Apps and extensions don't work on Android, so it doesn't make sense to
146 // provide override device metrics in mobile emulation mode, and can also 146 // provide override device metrics in mobile emulation mode, and can also
147 // potentially crash the renderer, for more details see: 147 // potentially crash the renderer, for more details see:
148 // https://code.google.com/p/chromedriver/issues/detail?id=1205 148 // https://code.google.com/p/chromedriver/issues/detail?id=1205
149 device_metrics = nullptr; 149 device_metrics = nullptr;
150 } 150 }
151 std::unique_ptr<WebView> web_view_tmp( 151 std::unique_ptr<WebView> web_view_tmp(new WebViewImpl(
152 new WebViewImpl(id, w3c_compliant, devtools_http_client_->browser_info(), 152 id, w3c_compliant, devtools_http_client_->browser_info(),
153 devtools_http_client_->CreateClient(id), device_metrics, 153 devtools_http_client_->CreateClient(id), device_metrics,
154 page_load_strategy())); 154 page_load_strategy(), devtools_http_client_->user_agent()));
155 Status status = web_view_tmp->ConnectIfNecessary(); 155 Status status = web_view_tmp->ConnectIfNecessary();
156 if (status.IsError()) 156 if (status.IsError())
157 return status; 157 return status;
158 158
159 status = web_view_tmp->WaitForPendingNavigations( 159 status = web_view_tmp->WaitForPendingNavigations(
160 std::string(), timeout, false); 160 std::string(), timeout, false);
161 if (status.IsOk()) 161 if (status.IsOk())
162 *web_view = std::move(web_view_tmp); 162 *web_view = std::move(web_view_tmp);
163 return status; 163 return status;
164 } 164 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 225
226 int ChromeDesktopImpl::GetNetworkConnection() const { 226 int ChromeDesktopImpl::GetNetworkConnection() const {
227 return network_connection_; 227 return network_connection_;
228 } 228 }
229 229
230 void ChromeDesktopImpl::SetNetworkConnection( 230 void ChromeDesktopImpl::SetNetworkConnection(
231 int network_connection) { 231 int network_connection) {
232 network_connection_ = network_connection; 232 network_connection_ = network_connection;
233 } 233 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/capabilities_unittest.cc ('k') | chrome/test/chromedriver/chrome/chrome_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698