Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/test/chromedriver/session_commands.cc

Issue 2776313003: Update ChromeDriver to accept W3C format InitSession (Closed)
Patch Set: Disallow using W3C format without setting W3C option flag Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
samuong 2017/03/29 17:07:48 When you go and implement this TODO, you'll need t
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;
samuong 2017/03/29 17:07:48 nit: style guide says to use {}s when there are mo
191 else if (!params.GetDictionary("desiredCapabilities", &desired_caps))
192 return Status(kUnknownError,
samuong 2017/03/29 17:07:48 can you change this to kSessionNotCreatedException
193 "cannot find dict 'alwaysMatch' or 'desiredCapabilities'");
samuong 2017/03/29 17:07:48 nit: update error message
187 194
188 Capabilities capabilities; 195 Capabilities capabilities;
189 Status status = capabilities.Parse(*desired_caps); 196 Status status = capabilities.Parse(*desired_caps);
190 if (status.IsError()) 197 if (status.IsError())
191 return status; 198 return status;
192 199
193 desired_caps->GetString("unexpectedAlertBehaviour", 200 desired_caps->GetString("unexpectedAlertBehaviour",
194 &session->unexpected_alert_behaviour); 201 &session->unexpected_alert_behaviour);
195 202
196 Log::Level driver_level = Log::kWarning; 203 Log::Level driver_level = Log::kWarning;
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 std::unique_ptr<base::Value>* value) { 895 std::unique_ptr<base::Value>* value) {
889 WebView* web_view = nullptr; 896 WebView* web_view = nullptr;
890 Status status = session->GetTargetWindow(&web_view); 897 Status status = session->GetTargetWindow(&web_view);
891 if (status.IsError()) 898 if (status.IsError())
892 return status; 899 return status;
893 status = web_view->DeleteScreenOrientation(); 900 status = web_view->DeleteScreenOrientation();
894 if (status.IsError()) 901 if (status.IsError())
895 return status; 902 return status;
896 return Status(kOk); 903 return Status(kOk);
897 } 904 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698