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

Side by Side Diff: chrome/test/chromedriver/chrome/chrome_impl.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_impl.h" 5 #include "chrome/test/chromedriver/chrome/chrome_impl.h"
6 6
7 #include "chrome/test/chromedriver/chrome/devtools_client.h" 7 #include "chrome/test/chromedriver/chrome/devtools_client.h"
8 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" 8 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
9 #include "chrome/test/chromedriver/chrome/devtools_http_client.h" 9 #include "chrome/test/chromedriver/chrome/devtools_http_client.h"
10 #include "chrome/test/chromedriver/chrome/status.h" 10 #include "chrome/test/chromedriver/chrome/status.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (!found) { 76 if (!found) {
77 scoped_ptr<DevToolsClient> client( 77 scoped_ptr<DevToolsClient> client(
78 devtools_http_client_->CreateClient(view.id)); 78 devtools_http_client_->CreateClient(view.id));
79 for (ScopedVector<DevToolsEventListener>::const_iterator listener = 79 for (ScopedVector<DevToolsEventListener>::const_iterator listener =
80 devtools_event_listeners_.begin(); 80 devtools_event_listeners_.begin();
81 listener != devtools_event_listeners_.end(); ++listener) { 81 listener != devtools_event_listeners_.end(); ++listener) {
82 client->AddListener(*listener); 82 client->AddListener(*listener);
83 // OnConnected will fire when DevToolsClient connects later. 83 // OnConnected will fire when DevToolsClient connects later.
84 } 84 }
85 web_views_.push_back(make_linked_ptr(new WebViewImpl( 85 web_views_.push_back(make_linked_ptr(new WebViewImpl(
86 view.id, devtools_http_client_->browser_info(), client.Pass()))); 86 view.id,
87 devtools_http_client_->browser_info(),
88 client.Pass(),
89 devtools_http_client_->device_metrics())));
87 } 90 }
88 } 91 }
89 92
90 std::list<std::string> web_view_ids_tmp; 93 std::list<std::string> web_view_ids_tmp;
91 for (WebViewList::const_iterator web_view_iter = web_views_.begin(); 94 for (WebViewList::const_iterator web_view_iter = web_views_.begin();
92 web_view_iter != web_views_.end(); ++web_view_iter) { 95 web_view_iter != web_views_.end(); ++web_view_iter) {
93 web_view_ids_tmp.push_back((*web_view_iter)->GetId()); 96 web_view_ids_tmp.push_back((*web_view_iter)->GetId());
94 } 97 }
95 web_view_ids->swap(web_view_ids_tmp); 98 web_view_ids->swap(web_view_ids_tmp);
96 return Status(kOk); 99 return Status(kOk);
(...skipping 21 matching lines...) Expand all
118 break; 121 break;
119 } 122 }
120 } 123 }
121 return Status(kOk); 124 return Status(kOk);
122 } 125 }
123 126
124 Status ChromeImpl::ActivateWebView(const std::string& id) { 127 Status ChromeImpl::ActivateWebView(const std::string& id) {
125 return devtools_http_client_->ActivateWebView(id); 128 return devtools_http_client_->ActivateWebView(id);
126 } 129 }
127 130
131 bool ChromeImpl::IsMobileEmulationEnabled() const {
132 return false;
133 }
134
128 Status ChromeImpl::Quit() { 135 Status ChromeImpl::Quit() {
129 Status status = QuitImpl(); 136 Status status = QuitImpl();
130 if (status.IsOk()) 137 if (status.IsOk())
131 quit_ = true; 138 quit_ = true;
132 return status; 139 return status;
133 } 140 }
134 141
135 ChromeImpl::ChromeImpl( 142 ChromeImpl::ChromeImpl(
136 scoped_ptr<DevToolsHttpClient> client, 143 scoped_ptr<DevToolsHttpClient> client,
137 ScopedVector<DevToolsEventListener>& devtools_event_listeners, 144 ScopedVector<DevToolsEventListener>& devtools_event_listeners,
138 scoped_ptr<PortReservation> port_reservation) 145 scoped_ptr<PortReservation> port_reservation)
139 : quit_(false), 146 : quit_(false),
140 devtools_http_client_(client.Pass()), 147 devtools_http_client_(client.Pass()),
141 port_reservation_(port_reservation.Pass()) { 148 port_reservation_(port_reservation.Pass()) {
142 devtools_event_listeners_.swap(devtools_event_listeners); 149 devtools_event_listeners_.swap(devtools_event_listeners);
143 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698