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

Side by Side Diff: chrome/test/chromedriver/chrome_launcher.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_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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 std::unique_ptr<std::set<WebViewInfo::Type>> window_types; 185 std::unique_ptr<std::set<WebViewInfo::Type>> window_types;
186 if (capabilities && !capabilities->window_types.empty()) { 186 if (capabilities && !capabilities->window_types.empty()) {
187 window_types.reset( 187 window_types.reset(
188 new std::set<WebViewInfo::Type>(capabilities->window_types)); 188 new std::set<WebViewInfo::Type>(capabilities->window_types));
189 } else { 189 } else {
190 window_types.reset(new std::set<WebViewInfo::Type>()); 190 window_types.reset(new std::set<WebViewInfo::Type>());
191 } 191 }
192 192
193 std::unique_ptr<DevToolsHttpClient> client(new DevToolsHttpClient( 193 std::unique_ptr<DevToolsHttpClient> client(new DevToolsHttpClient(
194 address, context_getter, socket_factory, std::move(device_metrics), 194 address, context_getter, socket_factory, std::move(device_metrics),
195 std::move(window_types), capabilities->page_load_strategy)); 195 std::move(window_types), capabilities->page_load_strategy,
196 capabilities->user_agent));
196 base::TimeTicks deadline = 197 base::TimeTicks deadline =
197 base::TimeTicks::Now() + base::TimeDelta::FromSeconds(60); 198 base::TimeTicks::Now() + base::TimeDelta::FromSeconds(60);
198 Status status = client->Init(deadline - base::TimeTicks::Now()); 199 Status status = client->Init(deadline - base::TimeTicks::Now());
199 if (status.IsError()) 200 if (status.IsError())
200 return status; 201 return status;
201 202
202 const BrowserInfo* browser_info = client->browser_info(); 203 const BrowserInfo* browser_info = client->browser_info();
203 if (browser_info->is_android && 204 if (browser_info->is_android &&
204 browser_info->android_package != capabilities->android_package) { 205 browser_info->android_package != capabilities->android_package) {
205 // DevTools from Chrome 30 and earlier did not provide an Android-Package 206 // DevTools from Chrome 30 and earlier did not provide an Android-Package
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // Write empty "First Run" file, otherwise Chrome will wipe the default 882 // Write empty "First Run" file, otherwise Chrome will wipe the default
882 // profile that was written. 883 // profile that was written.
883 if (base::WriteFile( 884 if (base::WriteFile(
884 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { 885 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
885 return Status(kUnknownError, "failed to write first run file"); 886 return Status(kUnknownError, "failed to write first run file");
886 } 887 }
887 return Status(kOk); 888 return Status(kOk);
888 } 889 }
889 890
890 } // namespace internal 891 } // namespace internal
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/web_view_impl.cc ('k') | chrome/test/chromedriver/test/run_py_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698