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

Unified Diff: chrome/test/chromedriver/session_commands.cc

Issue 2776313003: Update ChromeDriver to accept W3C format InitSession (Closed)
Patch Set: Update exception type, code formatting, and comments 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
« no previous file with comments | « chrome/test/chromedriver/client/chromedriver.py ('k') | chrome/test/chromedriver/test/run_py_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3bcbd9a92aa400a7c1ce15ad990fdf0ea9e445c6 100644
--- a/chrome/test/chromedriver/session_commands.cc
+++ b/chrome/test/chromedriver/session_commands.cc
@@ -177,13 +177,21 @@ 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)
+ && w3c_capability) {
+ // TODO(johnchen): Handle capabilities.firstMatch.
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;
+ } else if (!params.GetDictionary("desiredCapabilities", &desired_caps)) {
+ return Status(kSessionNotCreatedException,
+ "Missing or invalid capabilities");
+ }
Capabilities capabilities;
Status status = capabilities.Parse(*desired_caps);
« no previous file with comments | « chrome/test/chromedriver/client/chromedriver.py ('k') | chrome/test/chromedriver/test/run_py_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698