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

Side by Side Diff: chrome/test/chromedriver/chrome/chrome_impl.cc

Issue 2125123002: [chromedriver] Add page loading strategy to capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clearer naming, checks for valid strategies earlier in parsing Created 4 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 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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "chrome/test/chromedriver/chrome/devtools_client.h" 10 #include "chrome/test/chromedriver/chrome/devtools_client.h"
11 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" 11 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
12 #include "chrome/test/chromedriver/chrome/devtools_http_client.h" 12 #include "chrome/test/chromedriver/chrome/devtools_http_client.h"
13 #include "chrome/test/chromedriver/chrome/page_load_strategy.h"
13 #include "chrome/test/chromedriver/chrome/status.h" 14 #include "chrome/test/chromedriver/chrome/status.h"
14 #include "chrome/test/chromedriver/chrome/web_view_impl.h" 15 #include "chrome/test/chromedriver/chrome/web_view_impl.h"
15 #include "chrome/test/chromedriver/net/port_server.h" 16 #include "chrome/test/chromedriver/net/port_server.h"
16 17
17 ChromeImpl::~ChromeImpl() { 18 ChromeImpl::~ChromeImpl() {
18 if (!quit_) 19 if (!quit_)
19 port_reservation_->Leak(); 20 port_reservation_->Leak();
20 } 21 }
21 22
22 Status ChromeImpl::GetAsDesktop(ChromeDesktopImpl** desktop) { 23 Status ChromeImpl::GetAsDesktop(ChromeDesktopImpl** desktop) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 std::unique_ptr<DevToolsClient> client( 72 std::unique_ptr<DevToolsClient> client(
72 devtools_http_client_->CreateClient(view.id)); 73 devtools_http_client_->CreateClient(view.id));
73 for (ScopedVector<DevToolsEventListener>::const_iterator listener = 74 for (ScopedVector<DevToolsEventListener>::const_iterator listener =
74 devtools_event_listeners_.begin(); 75 devtools_event_listeners_.begin();
75 listener != devtools_event_listeners_.end(); ++listener) { 76 listener != devtools_event_listeners_.end(); ++listener) {
76 client->AddListener(*listener); 77 client->AddListener(*listener);
77 // OnConnected will fire when DevToolsClient connects later. 78 // OnConnected will fire when DevToolsClient connects later.
78 } 79 }
79 web_views_.push_back(make_linked_ptr(new WebViewImpl( 80 web_views_.push_back(make_linked_ptr(new WebViewImpl(
80 view.id, devtools_http_client_->browser_info(), std::move(client), 81 view.id, devtools_http_client_->browser_info(), std::move(client),
81 devtools_http_client_->device_metrics()))); 82 devtools_http_client_->device_metrics(), page_load_strategy_)));
82 } 83 }
83 } 84 }
84 } 85 }
85 86
86 std::list<std::string> web_view_ids_tmp; 87 std::list<std::string> web_view_ids_tmp;
87 for (WebViewList::const_iterator web_view_iter = web_views_.begin(); 88 for (WebViewList::const_iterator web_view_iter = web_views_.begin();
88 web_view_iter != web_views_.end(); ++web_view_iter) { 89 web_view_iter != web_views_.end(); ++web_view_iter) {
89 web_view_ids_tmp.push_back((*web_view_iter)->GetId()); 90 web_view_ids_tmp.push_back((*web_view_iter)->GetId());
90 } 91 }
91 web_view_ids->swap(web_view_ids_tmp); 92 web_view_ids->swap(web_view_ids_tmp);
(...skipping 30 matching lines...) Expand all
122 } 123 }
123 124
124 bool ChromeImpl::IsMobileEmulationEnabled() const { 125 bool ChromeImpl::IsMobileEmulationEnabled() const {
125 return false; 126 return false;
126 } 127 }
127 128
128 bool ChromeImpl::HasTouchScreen() const { 129 bool ChromeImpl::HasTouchScreen() const {
129 return false; 130 return false;
130 } 131 }
131 132
133 std::string ChromeImpl::page_load_strategy() const {
134 return page_load_strategy_;
135 }
136
137 void ChromeImpl::set_page_load_strategy(std::string strategy) {
138 // Support for page load strategy already checked when capability is parsed.
139 page_load_strategy_ = strategy;
140 }
141
132 Status ChromeImpl::Quit() { 142 Status ChromeImpl::Quit() {
133 Status status = QuitImpl(); 143 Status status = QuitImpl();
134 if (status.IsOk()) 144 if (status.IsOk())
135 quit_ = true; 145 quit_ = true;
136 return status; 146 return status;
137 } 147 }
138 148
139 ChromeImpl::ChromeImpl( 149 ChromeImpl::ChromeImpl(
140 std::unique_ptr<DevToolsHttpClient> http_client, 150 std::unique_ptr<DevToolsHttpClient> http_client,
141 std::unique_ptr<DevToolsClient> websocket_client, 151 std::unique_ptr<DevToolsClient> websocket_client,
142 ScopedVector<DevToolsEventListener>& devtools_event_listeners, 152 ScopedVector<DevToolsEventListener>& devtools_event_listeners,
143 std::unique_ptr<PortReservation> port_reservation) 153 std::unique_ptr<PortReservation> port_reservation)
144 : quit_(false), 154 : quit_(false),
145 devtools_http_client_(std::move(http_client)), 155 devtools_http_client_(std::move(http_client)),
146 devtools_websocket_client_(std::move(websocket_client)), 156 devtools_websocket_client_(std::move(websocket_client)),
157 page_load_strategy_(PageLoadStrategy::kNormal),
147 port_reservation_(std::move(port_reservation)) { 158 port_reservation_(std::move(port_reservation)) {
148 devtools_event_listeners_.swap(devtools_event_listeners); 159 devtools_event_listeners_.swap(devtools_event_listeners);
149 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698