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

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

Issue 1317153002: [chromedriver] Don't apply device metrics overrides to app and extension pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make sure that |type| is initialized to suppress warning from msvc compiler Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
diff --git a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
index 3f44ad49ca3a1479ca56043152518b9814237a23..f828bfb2d343ff30ba32d250ae422a83db573580 100644
--- a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
+++ b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
@@ -101,6 +101,7 @@ Status ChromeDesktopImpl::WaitForPageToLoad(const std::string& url,
scoped_ptr<WebView>* web_view) {
base::TimeTicks deadline = base::TimeTicks::Now() + timeout;
std::string id;
+ WebViewInfo::Type type = WebViewInfo::Type::kPage;
while (base::TimeTicks::Now() < deadline) {
WebViewsInfo views_info;
Status status = devtools_http_client_->GetWebViewsInfo(&views_info);
@@ -108,8 +109,10 @@ Status ChromeDesktopImpl::WaitForPageToLoad(const std::string& url,
return status;
for (size_t i = 0; i < views_info.GetSize(); ++i) {
- if (views_info.Get(i).url.find(url) == 0) {
- id = views_info.Get(i).id;
+ const WebViewInfo& view_info = views_info.Get(i);
+ if (view_info.url.find(url) == 0) {
+ id = view_info.id;
+ type = view_info.type;
break;
}
}
@@ -120,11 +123,20 @@ Status ChromeDesktopImpl::WaitForPageToLoad(const std::string& url,
if (id.empty())
return Status(kUnknownError, "page could not be found: " + url);
+ const DeviceMetrics* device_metrics = devtools_http_client_->device_metrics();
+ if (type == WebViewInfo::Type::kApp ||
+ type == WebViewInfo::Type::kBackgroundPage) {
+ // Apps and extensions don't work on Android, so it doesn't make sense to
+ // provide override device metrics in mobile emulation mode, and can also
+ // potentially crash the renderer, for more details see:
+ // https://code.google.com/p/chromedriver/issues/detail?id=1205
+ device_metrics = nullptr;
+ }
scoped_ptr<WebView> web_view_tmp(
new WebViewImpl(id,
devtools_http_client_->browser_info(),
devtools_http_client_->CreateClient(id),
- devtools_http_client_->device_metrics()));
+ device_metrics));
Status status = web_view_tmp->ConnectIfNecessary();
if (status.IsError())
return status;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698