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

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

Issue 251933005: [ChromeDriver] Support mobile emulation on desktop Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/session_commands.cc
diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc
index b0ad052b4d51cf0fdb40128d450b86ff33c2fde0..b16f5e166cd225a69fec42a4959d8b3860710670 100644
--- a/chrome/test/chromedriver/session_commands.cc
+++ b/chrome/test/chromedriver/session_commands.cc
@@ -99,6 +99,17 @@ scoped_ptr<base::DictionaryValue> CreateCapabilities(Chrome* chrome) {
return caps.Pass();
}
+Status InitDeviceMetricsOverride(
+ Session* session,
+ DeviceMetrics* device_metrics)
+{
+ WebView* web_view;
+ session->chrome->GetWebViewById(session->window, &web_view);
+ Status status = web_view->OverrideDeviceMetrics(*device_metrics);
+ if (status.IsOk())
+ session->overridden_device_metrics.reset(new DeviceMetrics(*device_metrics));
+ return status;
+}
Status InitSessionHelper(
const InitSessionParams& bound_params,
@@ -149,6 +160,11 @@ Status InitSessionHelper(
}
session->window = web_view_ids.front();
+
+ if (capabilities.device_metrics.width != 0) {
stgao 2014/05/03 00:15:20 Instead of creating an instance of struct |device_
sam.rawlins 2014/05/06 23:51:46 Done.
+ InitDeviceMetricsOverride(session, &capabilities.device_metrics);
+ }
+
session->detach = capabilities.detach;
session->force_devtools_screenshot = capabilities.force_devtools_screenshot;
session->capabilities = CreateCapabilities(session->chrome.get());
« chrome/test/chromedriver/chrome/web_view_impl.cc ('K') | « chrome/test/chromedriver/session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698