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

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

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: New DevToolsEventsLogger 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/capabilities.cc
diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc
index 28d42ab5a9a46a4bb7717a9895f7255f3681afe1..7a57d4baf9c1cbc599f2fca4b6b42e7e419f4714 100644
--- a/chrome/test/chromedriver/capabilities.cc
+++ b/chrome/test/chromedriver/capabilities.cc
@@ -399,6 +399,17 @@ Status ParsePerfLoggingPrefs(const base::Value& option,
return Status(kOk);
}
+Status ParseDevToolsEventsLoggingPrefs(const base::Value& option,
+ Capabilities* capabilities) {
+ const base::ListValue* dt_events_logging_prefs = NULL;
samuong 2017/03/27 18:42:10 use nullptr instead of NULL
+ if (!option.GetAsList(&dt_events_logging_prefs))
+ return Status(kUnknownError, "must be a list");
+ if (dt_events_logging_prefs->empty())
+ return Status(kUnknownError, "list must contain values");
+ capabilities->dt_events_logging_prefs = dt_events_logging_prefs->DeepCopy();
+ return Status(kOk);
+}
+
Status ParseWindowTypes(const base::Value& option, Capabilities* capabilities) {
const base::ListValue* window_types = NULL;
if (!option.GetAsList(&window_types))
@@ -437,6 +448,8 @@ Status ParseChromeOptions(
parser_map["extensions"] = base::Bind(&IgnoreCapability);
parser_map["perfLoggingPrefs"] = base::Bind(&ParsePerfLoggingPrefs);
+ parser_map["devToolsEventsToLog"] = base::Bind(
+ &ParseDevToolsEventsLoggingPrefs);
parser_map["windowTypes"] = base::Bind(&ParseWindowTypes);
// Compliance is read when session is initialized and correct response is
// sent if not parsed correctly.
@@ -662,5 +675,16 @@ Status Capabilities::Parse(const base::DictionaryValue& desired_caps) {
"but performance logging was not enabled");
}
}
+ LoggingPrefs::const_iterator dt_events_logging_iter = logging_prefs.find(
+ WebDriverLog::kDevToolsType);
+ if (dt_events_logging_iter == logging_prefs.end()
+ || dt_events_logging_iter->second == Log::kOff) {
+ const base::DictionaryValue* chrome_options = NULL;
+ if (desired_caps.GetDictionary("chromeOptions", &chrome_options) &&
+ chrome_options->HasKey("devToolsEventsToLog")) {
+ return Status(kUnknownError, "devToolsEventsToLog specified, "
+ "but devtools events logging was not enabled");
+ }
+ }
return Status(kOk);
}

Powered by Google App Engine
This is Rietveld 408576698