| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 Status InitSessionHelper(const InitSessionParams& bound_params, | 172 Status InitSessionHelper(const InitSessionParams& bound_params, |
| 173 Session* session, | 173 Session* session, |
| 174 const base::DictionaryValue& params, | 174 const base::DictionaryValue& params, |
| 175 std::unique_ptr<base::Value>* value) { | 175 std::unique_ptr<base::Value>* value) { |
| 176 session->driver_log.reset( | 176 session->driver_log.reset( |
| 177 new WebDriverLog(WebDriverLog::kDriverType, Log::kAll)); | 177 new WebDriverLog(WebDriverLog::kDriverType, Log::kAll)); |
| 178 const base::DictionaryValue* desired_caps; | 178 const base::DictionaryValue* desired_caps; |
| 179 bool w3c_capability = false; | 179 bool w3c_capability = false; |
| 180 if (params.GetDictionary("capabilities.desiredCapabilities", &desired_caps) | 180 if (params.GetDictionary("capabilities.alwaysMatch", &desired_caps) |
| 181 && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability) | 181 && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability) |
| 182 && w3c_capability) | 182 && w3c_capability) { |
| 183 // TODO(johnchen): Handle capabilities.firstMatch. |
| 183 session->w3c_compliant = true; | 184 session->w3c_compliant = true; |
| 184 else if (!params.GetDictionary("desiredCapabilities", &desired_caps) && | 185 } else if (params.GetDictionary("capabilities.desiredCapabilities", |
| 185 !params.GetDictionary("capabilities.desiredCapabilities", &desired_caps)) | 186 &desired_caps) |
| 186 return Status(kUnknownError, "cannot find dict 'desiredCapabilities'"); | 187 && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability) |
| 188 && w3c_capability) { |
| 189 // TODO(johnchen): Remove when clients stop using this. |
| 190 session->w3c_compliant = true; |
| 191 } else if (!params.GetDictionary("desiredCapabilities", &desired_caps)) { |
| 192 return Status(kSessionNotCreatedException, |
| 193 "Missing or invalid capabilities"); |
| 194 } |
| 187 | 195 |
| 188 Capabilities capabilities; | 196 Capabilities capabilities; |
| 189 Status status = capabilities.Parse(*desired_caps); | 197 Status status = capabilities.Parse(*desired_caps); |
| 190 if (status.IsError()) | 198 if (status.IsError()) |
| 191 return status; | 199 return status; |
| 192 | 200 |
| 193 desired_caps->GetString("unexpectedAlertBehaviour", | 201 desired_caps->GetString("unexpectedAlertBehaviour", |
| 194 &session->unexpected_alert_behaviour); | 202 &session->unexpected_alert_behaviour); |
| 195 | 203 |
| 196 Log::Level driver_level = Log::kWarning; | 204 Log::Level driver_level = Log::kWarning; |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 std::unique_ptr<base::Value>* value) { | 896 std::unique_ptr<base::Value>* value) { |
| 889 WebView* web_view = nullptr; | 897 WebView* web_view = nullptr; |
| 890 Status status = session->GetTargetWindow(&web_view); | 898 Status status = session->GetTargetWindow(&web_view); |
| 891 if (status.IsError()) | 899 if (status.IsError()) |
| 892 return status; | 900 return status; |
| 893 status = web_view->DeleteScreenOrientation(); | 901 status = web_view->DeleteScreenOrientation(); |
| 894 if (status.IsError()) | 902 if (status.IsError()) |
| 895 return status; | 903 return status; |
| 896 return Status(kOk); | 904 return Status(kOk); |
| 897 } | 905 } |
| OLD | NEW |