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("pageLoadingStrategy", chrome->GetPageLoadingStrategy()); | |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 status = CreateLogs(capabilities, | 181 status = CreateLogs(capabilities, |
181 session, | 182 session, |
182 &session->devtools_logs, | 183 &session->devtools_logs, |
183 &devtools_event_listeners, | 184 &devtools_event_listeners, |
184 &command_listeners); | 185 &command_listeners); |
185 if (status.IsError()) | 186 if (status.IsError()) |
186 return status; | 187 return status; |
187 | 188 |
188 // |session| will own the |CommandListener|s. | 189 // |session| will own the |CommandListener|s. |
189 session->command_listeners.swap(command_listeners); | 190 session->command_listeners.swap(command_listeners); |
190 | |
samuong
2016/07/25 22:44:33
nit: don't delete the blank line
evajiang
2016/07/28 17:15:04
Done.
| |
191 status = LaunchChrome(bound_params.context_getter.get(), | 191 status = LaunchChrome(bound_params.context_getter.get(), |
192 bound_params.socket_factory, | 192 bound_params.socket_factory, |
193 bound_params.device_manager, | 193 bound_params.device_manager, |
194 bound_params.port_server, | 194 bound_params.port_server, |
195 bound_params.port_manager, | 195 bound_params.port_manager, |
196 capabilities, | 196 capabilities, |
197 &devtools_event_listeners, | 197 &devtools_event_listeners, |
198 &session->chrome); | 198 &session->chrome); |
199 if (status.IsError()) | 199 if (status.IsError()) |
200 return status; | 200 return status; |
201 | 201 |
202 status = session->chrome->SetPageLoadingStrategy(capabilities.page_loading); | |
203 if (status.IsError()) | |
204 return status; | |
205 | |
202 std::list<std::string> web_view_ids; | 206 std::list<std::string> web_view_ids; |
203 status = session->chrome->GetWebViewIds(&web_view_ids); | 207 status = session->chrome->GetWebViewIds(&web_view_ids); |
204 if (status.IsError() || web_view_ids.empty()) { | 208 if (status.IsError() || web_view_ids.empty()) { |
205 return status.IsError() ? status : | 209 return status.IsError() ? status : |
206 Status(kUnknownError, "unable to discover open window in chrome"); | 210 Status(kUnknownError, "unable to discover open window in chrome"); |
207 } | 211 } |
208 | 212 |
209 session->window = web_view_ids.front(); | 213 session->window = web_view_ids.front(); |
210 session->detach = capabilities.detach; | 214 session->detach = capabilities.detach; |
211 session->force_devtools_screenshot = capabilities.force_devtools_screenshot; | 215 session->force_devtools_screenshot = capabilities.force_devtools_screenshot; |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 | 798 |
795 Status ExecuteSetAutoReporting(Session* session, | 799 Status ExecuteSetAutoReporting(Session* session, |
796 const base::DictionaryValue& params, | 800 const base::DictionaryValue& params, |
797 std::unique_ptr<base::Value>* value) { | 801 std::unique_ptr<base::Value>* value) { |
798 bool enabled; | 802 bool enabled; |
799 if (!params.GetBoolean("enabled", &enabled)) | 803 if (!params.GetBoolean("enabled", &enabled)) |
800 return Status(kUnknownError, "missing parameter 'enabled'"); | 804 return Status(kUnknownError, "missing parameter 'enabled'"); |
801 session->auto_reporting_enabled = enabled; | 805 session->auto_reporting_enabled = enabled; |
802 return Status(kOk); | 806 return Status(kOk); |
803 } | 807 } |
OLD | NEW |