| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/session_commands.h" | 5 #include "chrome/test/chromedriver/session_commands.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 InitSessionParams::~InitSessionParams() {} | 90 InitSessionParams::~InitSessionParams() {} |
| 91 | 91 |
| 92 namespace { | 92 namespace { |
| 93 | 93 |
| 94 std::unique_ptr<base::DictionaryValue> CreateCapabilities(Chrome* chrome) { | 94 std::unique_ptr<base::DictionaryValue> CreateCapabilities(Chrome* chrome) { |
| 95 std::unique_ptr<base::DictionaryValue> caps(new base::DictionaryValue()); | 95 std::unique_ptr<base::DictionaryValue> caps(new base::DictionaryValue()); |
| 96 caps->SetString("browserName", "chrome"); | 96 caps->SetString("browserName", "chrome"); |
| 97 caps->SetString("version", chrome->GetBrowserInfo()->browser_version); | 97 caps->SetString("version", chrome->GetBrowserInfo()->browser_version); |
| 98 caps->SetString("chrome.chromedriverVersion", kChromeDriverVersion); | 98 caps->SetString("chrome.chromedriverVersion", kChromeDriverVersion); |
| 99 caps->SetString("platform", chrome->GetOperatingSystemName()); | 99 caps->SetString("platform", chrome->GetOperatingSystemName()); |
| 100 caps->SetString("pageLoadStrategy", chrome->page_load_strategy()); |
| 100 caps->SetBoolean("javascriptEnabled", true); | 101 caps->SetBoolean("javascriptEnabled", true); |
| 101 caps->SetBoolean("takesScreenshot", true); | 102 caps->SetBoolean("takesScreenshot", true); |
| 102 caps->SetBoolean("takesHeapSnapshot", true); | 103 caps->SetBoolean("takesHeapSnapshot", true); |
| 103 caps->SetBoolean("handlesAlerts", true); | 104 caps->SetBoolean("handlesAlerts", true); |
| 104 caps->SetBoolean("databaseEnabled", false); | 105 caps->SetBoolean("databaseEnabled", false); |
| 105 caps->SetBoolean("locationContextEnabled", true); | 106 caps->SetBoolean("locationContextEnabled", true); |
| 106 caps->SetBoolean("mobileEmulationEnabled", | 107 caps->SetBoolean("mobileEmulationEnabled", |
| 107 chrome->IsMobileEmulationEnabled()); | 108 chrome->IsMobileEmulationEnabled()); |
| 108 caps->SetBoolean("applicationCacheEnabled", false); | 109 caps->SetBoolean("applicationCacheEnabled", false); |
| 109 caps->SetBoolean("browserConnectionEnabled", false); | 110 caps->SetBoolean("browserConnectionEnabled", false); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 bound_params.socket_factory, | 193 bound_params.socket_factory, |
| 193 bound_params.device_manager, | 194 bound_params.device_manager, |
| 194 bound_params.port_server, | 195 bound_params.port_server, |
| 195 bound_params.port_manager, | 196 bound_params.port_manager, |
| 196 capabilities, | 197 capabilities, |
| 197 &devtools_event_listeners, | 198 &devtools_event_listeners, |
| 198 &session->chrome); | 199 &session->chrome); |
| 199 if (status.IsError()) | 200 if (status.IsError()) |
| 200 return status; | 201 return status; |
| 201 | 202 |
| 203 session->chrome->set_page_load_strategy(capabilities.page_load_strategy); |
| 204 |
| 202 std::list<std::string> web_view_ids; | 205 std::list<std::string> web_view_ids; |
| 203 status = session->chrome->GetWebViewIds(&web_view_ids); | 206 status = session->chrome->GetWebViewIds(&web_view_ids); |
| 204 if (status.IsError() || web_view_ids.empty()) { | 207 if (status.IsError() || web_view_ids.empty()) { |
| 205 return status.IsError() ? status : | 208 return status.IsError() ? status : |
| 206 Status(kUnknownError, "unable to discover open window in chrome"); | 209 Status(kUnknownError, "unable to discover open window in chrome"); |
| 207 } | 210 } |
| 208 | 211 |
| 209 session->window = web_view_ids.front(); | 212 session->window = web_view_ids.front(); |
| 210 session->detach = capabilities.detach; | 213 session->detach = capabilities.detach; |
| 211 session->force_devtools_screenshot = capabilities.force_devtools_screenshot; | 214 session->force_devtools_screenshot = capabilities.force_devtools_screenshot; |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 | 814 |
| 812 Status ExecuteSetAutoReporting(Session* session, | 815 Status ExecuteSetAutoReporting(Session* session, |
| 813 const base::DictionaryValue& params, | 816 const base::DictionaryValue& params, |
| 814 std::unique_ptr<base::Value>* value) { | 817 std::unique_ptr<base::Value>* value) { |
| 815 bool enabled; | 818 bool enabled; |
| 816 if (!params.GetBoolean("enabled", &enabled)) | 819 if (!params.GetBoolean("enabled", &enabled)) |
| 817 return Status(kUnknownError, "missing parameter 'enabled'"); | 820 return Status(kUnknownError, "missing parameter 'enabled'"); |
| 818 session->auto_reporting_enabled = enabled; | 821 session->auto_reporting_enabled = enabled; |
| 819 return Status(kOk); | 822 return Status(kOk); |
| 820 } | 823 } |
| OLD | NEW |