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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/session_commands.cc
diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc
index 1a39f53bc3a0574e07e8fb9e9ea019677c0ae3ee..4cfebf9a8d8aab610e5f2a35c2024bc03a1b54fb 100644
--- a/chrome/test/chromedriver/session_commands.cc
+++ b/chrome/test/chromedriver/session_commands.cc
@@ -177,13 +177,20 @@ Status InitSessionHelper(const InitSessionParams& bound_params,
new WebDriverLog(WebDriverLog::kDriverType, Log::kAll));
const base::DictionaryValue* desired_caps;
bool w3c_capability = false;
- if (params.GetDictionary("capabilities.desiredCapabilities", &desired_caps)
+ if (params.GetDictionary("capabilities.alwaysMatch", &desired_caps)
&& desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability)
&& w3c_capability)
+ // TODO(johnchen): Handle capabilities.firstMatch.
samuong 2017/03/29 17:07:48 When you go and implement this TODO, you'll need t
session->w3c_compliant = true;
- else if (!params.GetDictionary("desiredCapabilities", &desired_caps) &&
- !params.GetDictionary("capabilities.desiredCapabilities", &desired_caps))
- return Status(kUnknownError, "cannot find dict 'desiredCapabilities'");
+ else if (params.GetDictionary("capabilities.desiredCapabilities",
+ &desired_caps)
+ && desired_caps->GetBoolean("chromeOptions.w3c", &w3c_capability)
+ && w3c_capability)
+ // TODO(johnchen): Remove when clients stop using this.
+ session->w3c_compliant = true;
samuong 2017/03/29 17:07:48 nit: style guide says to use {}s when there are mo
+ else if (!params.GetDictionary("desiredCapabilities", &desired_caps))
+ return Status(kUnknownError,
samuong 2017/03/29 17:07:48 can you change this to kSessionNotCreatedException
+ "cannot find dict 'alwaysMatch' or 'desiredCapabilities'");
samuong 2017/03/29 17:07:48 nit: update error message
Capabilities capabilities;
Status status = capabilities.Parse(*desired_caps);

Powered by Google App Engine
This is Rietveld 408576698