| OLD | NEW |
| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 bool ChromeImpl::HasCrashedWebView() { | 31 bool ChromeImpl::HasCrashedWebView() { |
| 32 for (WebViewList::iterator it = web_views_.begin(); | 32 for (WebViewList::iterator it = web_views_.begin(); |
| 33 it != web_views_.end(); ++it) { | 33 it != web_views_.end(); ++it) { |
| 34 if ((*it)->WasCrashed()) | 34 if ((*it)->WasCrashed()) |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 Status ChromeImpl::GetWebViewIds(std::list<std::string>* web_view_ids) { | 40 Status ChromeImpl::GetWebViewIds(std::list<std::string>* web_view_ids, |
| 41 bool w3c_compliant) { |
| 41 WebViewsInfo views_info; | 42 WebViewsInfo views_info; |
| 42 Status status = devtools_http_client_->GetWebViewsInfo(&views_info); | 43 Status status = devtools_http_client_->GetWebViewsInfo(&views_info); |
| 43 if (status.IsError()) | 44 if (status.IsError()) |
| 44 return status; | 45 return status; |
| 45 | 46 |
| 46 // Check if some web views are closed (or in the case of background pages, | 47 // Check if some web views are closed (or in the case of background pages, |
| 47 // become inactive). | 48 // become inactive). |
| 48 WebViewList::iterator it = web_views_.begin(); | 49 WebViewList::iterator it = web_views_.begin(); |
| 49 while (it != web_views_.end()) { | 50 while (it != web_views_.end()) { |
| 50 const WebViewInfo* view = views_info.GetForId((*it)->GetId()); | 51 const WebViewInfo* view = views_info.GetForId((*it)->GetId()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 if (!found) { | 72 if (!found) { |
| 72 std::unique_ptr<DevToolsClient> client( | 73 std::unique_ptr<DevToolsClient> client( |
| 73 devtools_http_client_->CreateClient(view.id)); | 74 devtools_http_client_->CreateClient(view.id)); |
| 74 for (ScopedVector<DevToolsEventListener>::const_iterator listener = | 75 for (ScopedVector<DevToolsEventListener>::const_iterator listener = |
| 75 devtools_event_listeners_.begin(); | 76 devtools_event_listeners_.begin(); |
| 76 listener != devtools_event_listeners_.end(); ++listener) { | 77 listener != devtools_event_listeners_.end(); ++listener) { |
| 77 client->AddListener(*listener); | 78 client->AddListener(*listener); |
| 78 // OnConnected will fire when DevToolsClient connects later. | 79 // OnConnected will fire when DevToolsClient connects later. |
| 79 } | 80 } |
| 80 web_views_.push_back(make_linked_ptr(new WebViewImpl( | 81 web_views_.push_back(make_linked_ptr(new WebViewImpl( |
| 81 view.id, devtools_http_client_->browser_info(), std::move(client), | 82 view.id, w3c_compliant, devtools_http_client_->browser_info(), |
| 82 devtools_http_client_->device_metrics(), page_load_strategy_))); | 83 std::move(client), devtools_http_client_->device_metrics(), |
| 84 page_load_strategy_))); |
| 83 } | 85 } |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 | 88 |
| 87 std::list<std::string> web_view_ids_tmp; | 89 std::list<std::string> web_view_ids_tmp; |
| 88 for (WebViewList::const_iterator web_view_iter = web_views_.begin(); | 90 for (WebViewList::const_iterator web_view_iter = web_views_.begin(); |
| 89 web_view_iter != web_views_.end(); ++web_view_iter) { | 91 web_view_iter != web_views_.end(); ++web_view_iter) { |
| 90 web_view_ids_tmp.push_back((*web_view_iter)->GetId()); | 92 web_view_ids_tmp.push_back((*web_view_iter)->GetId()); |
| 91 } | 93 } |
| 92 web_view_ids->swap(web_view_ids_tmp); | 94 web_view_ids->swap(web_view_ids_tmp); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 std::unique_ptr<DevToolsClient> websocket_client, | 153 std::unique_ptr<DevToolsClient> websocket_client, |
| 152 ScopedVector<DevToolsEventListener>& devtools_event_listeners, | 154 ScopedVector<DevToolsEventListener>& devtools_event_listeners, |
| 153 std::unique_ptr<PortReservation> port_reservation) | 155 std::unique_ptr<PortReservation> port_reservation) |
| 154 : quit_(false), | 156 : quit_(false), |
| 155 devtools_http_client_(std::move(http_client)), | 157 devtools_http_client_(std::move(http_client)), |
| 156 devtools_websocket_client_(std::move(websocket_client)), | 158 devtools_websocket_client_(std::move(websocket_client)), |
| 157 page_load_strategy_(PageLoadStrategy::kNormal), | 159 page_load_strategy_(PageLoadStrategy::kNormal), |
| 158 port_reservation_(std::move(port_reservation)) { | 160 port_reservation_(std::move(port_reservation)) { |
| 159 devtools_event_listeners_.swap(devtools_event_listeners); | 161 devtools_event_listeners_.swap(devtools_event_listeners); |
| 160 } | 162 } |
| OLD | NEW |