Chromium Code Reviews| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 return Status(kOk); | 169 return Status(kOk); |
| 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 const base::DictionaryValue default_desired_caps; |
|
samuong
2017/03/28 21:30:00
What is the difference between |desired_caps| and
| |
| 180 if (params.GetDictionary("capabilities.desiredCapabilities", &desired_caps) | 180 if (params.GetDictionary("desiredCapabilities", &desired_caps) || |
| 181 && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability) | 181 params.GetDictionary("capabilities.desiredCapabilities", &desired_caps)) { |
|
samuong
2017/03/28 21:30:00
If we're going to continue supporting capabilties.
| |
| 182 && w3c_capability) | 182 } else if (params.GetDictionary("capabilities", nullptr)) { |
| 183 session->w3c_compliant = true; | 183 session->w3c_compliant = true; |
| 184 else if (!params.GetDictionary("desiredCapabilities", &desired_caps) && | 184 if (!params.GetDictionary("capabilities.alwaysMatch", &desired_caps)) |
| 185 !params.GetDictionary("capabilities.desiredCapabilities", &desired_caps)) | 185 desired_caps = &default_desired_caps; |
| 186 return Status(kUnknownError, "cannot find dict 'desiredCapabilities'"); | 186 // TBD: Handle capabilities.firstMatch. |
| 187 } else { | |
| 188 return Status(kUnknownError, | |
| 189 "cannot find dict 'capabilities' or 'desiredCapabilities'"); | |
|
samuong
2017/03/28 21:30:00
This error message needs to be updated
| |
| 190 } | |
| 187 | 191 |
| 188 Capabilities capabilities; | 192 Capabilities capabilities; |
| 189 Status status = capabilities.Parse(*desired_caps); | 193 Status status = capabilities.Parse(*desired_caps); |
| 190 if (status.IsError()) | 194 if (status.IsError()) |
| 191 return status; | 195 return status; |
| 192 | 196 |
| 193 desired_caps->GetString("unexpectedAlertBehaviour", | 197 desired_caps->GetString("unexpectedAlertBehaviour", |
| 194 &session->unexpected_alert_behaviour); | 198 &session->unexpected_alert_behaviour); |
| 195 | 199 |
| 196 Log::Level driver_level = Log::kWarning; | 200 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) { | 892 std::unique_ptr<base::Value>* value) { |
| 889 WebView* web_view = nullptr; | 893 WebView* web_view = nullptr; |
| 890 Status status = session->GetTargetWindow(&web_view); | 894 Status status = session->GetTargetWindow(&web_view); |
| 891 if (status.IsError()) | 895 if (status.IsError()) |
| 892 return status; | 896 return status; |
| 893 status = web_view->DeleteScreenOrientation(); | 897 status = web_view->DeleteScreenOrientation(); |
| 894 if (status.IsError()) | 898 if (status.IsError()) |
| 895 return status; | 899 return status; |
| 896 return Status(kOk); | 900 return Status(kOk); |
| 897 } | 901 } |
| OLD | NEW |