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

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

Issue 2776313003: Update ChromeDriver to accept W3C format InitSession (Closed)
Patch Set: Require chromeOptions.w3c to turn on w3c mode 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
« no previous file with comments | « chrome/test/chromedriver/client/chromedriver.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 params.GetDictionary("capabilities.desiredCapabilities", &desired_caps))
181 && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability) 182 && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability)
182 && w3c_capability) 183 && w3c_capability)
184 // TBD: Handle capabilities.firstMatch.
samuong 2017/03/28 23:02:48 s/TBD/TODO(johnchen)/
183 session->w3c_compliant = true; 185 session->w3c_compliant = true;
184 else if (!params.GetDictionary("desiredCapabilities", &desired_caps) && 186 else if (!params.GetDictionary("desiredCapabilities", &desired_caps) &&
187 !params.GetDictionary("capabilities.alwaysMatch", &desired_caps) &&
185 !params.GetDictionary("capabilities.desiredCapabilities", &desired_caps)) 188 !params.GetDictionary("capabilities.desiredCapabilities", &desired_caps))
samuong 2017/03/28 23:02:48 I think these last two checks are redundant, since
186 return Status(kUnknownError, "cannot find dict 'desiredCapabilities'"); 189 return Status(kUnknownError,
190 "cannot find dict 'alwaysMatch' or 'desiredCapabilities'");
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
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 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/client/chromedriver.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698