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

Unified Diff: chrome/test/chromedriver/chrome_launcher.cc

Issue 288193004: [Chromedriver] Add Device Metrics override support to ChromeDriver via Capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/chrome_launcher.cc
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc
index ffc24283a8ccb1c37071241c1e607d0b4b081a5f..cfae167d65bc6268def42bf42f7888c4385ddc74 100644
--- a/chrome/test/chromedriver/chrome_launcher.cc
+++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -156,9 +156,14 @@ Status WaitForDevToolsAndCheckVersion(
const NetAddress& address,
URLRequestContextGetter* context_getter,
const SyncWebSocketFactory& socket_factory,
+ const Capabilities* capabilities,
scoped_ptr<DevToolsHttpClient>* user_client) {
+ scoped_ptr<DeviceMetrics> device_metrics;
+ if (capabilities && capabilities->device_metrics)
+ device_metrics.reset(new DeviceMetrics(*capabilities->device_metrics));
+
scoped_ptr<DevToolsHttpClient> client(new DevToolsHttpClient(
- address, context_getter, socket_factory));
+ address, context_getter, socket_factory, device_metrics.Pass()));
base::TimeTicks deadline =
base::TimeTicks::Now() + base::TimeDelta::FromSeconds(60);
Status status = client->Init(deadline - base::TimeTicks::Now());
@@ -193,7 +198,7 @@ Status LaunchExistingChromeSession(
scoped_ptr<DevToolsHttpClient> devtools_client;
status = WaitForDevToolsAndCheckVersion(
capabilities.debugger_address, context_getter, socket_factory,
- &devtools_client);
+ NULL, &devtools_client);
if (status.IsError()) {
return Status(kUnknownError, "cannot connect to chrome at " +
capabilities.debugger_address.ToString(),
@@ -277,7 +282,8 @@ Status LaunchDesktopChrome(
scoped_ptr<DevToolsHttpClient> devtools_client;
status = WaitForDevToolsAndCheckVersion(
- NetAddress(port), context_getter, socket_factory, &devtools_client);
+ NetAddress(port), context_getter, socket_factory, &capabilities,
+ &devtools_client);
if (status.IsError()) {
int exit_code;
@@ -377,6 +383,7 @@ Status LaunchAndroidChrome(
status = WaitForDevToolsAndCheckVersion(NetAddress(port),
context_getter,
socket_factory,
+ &capabilities,
&devtools_client);
if (status.IsError()) {
device->TearDown();

Powered by Google App Engine
This is Rietveld 408576698