Chromium Code Reviews| Index: chrome/test/chromedriver/capabilities.cc |
| diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc |
| index 75d021ba7068da6d41cb898c6298008e8c57a278..ab54effff38eee0c9d2a8ef569ff57679f2798a1 100644 |
| --- a/chrome/test/chromedriver/capabilities.cc |
| +++ b/chrome/test/chromedriver/capabilities.cc |
| @@ -190,6 +190,17 @@ Status ParsePageLoadStrategy(const base::Value& option, |
| return Status(kUnknownError, "page load strategy unsupported"); |
| } |
| +Status ParseUnexpectedAlertBehaviour(const base::Value& option, |
| + Capabilities* capabilities) { |
| + if (!option.GetAsString(&capabilities->unexpected_alert_behaviour)) |
| + return Status(kUnknownError, "must be a string"); |
| + if (capabilities->unexpected_alert_behaviour == "accept" || |
| + capabilities->unexpected_alert_behaviour == "dismiss" || |
| + capabilities->unexpected_alert_behaviour == "ignore") |
| + return Status(kOk); |
| + return Status(kUnknownError, "unexpected alert behaviour unsupported"); |
| +} |
| + |
| Status ParseSwitches(const base::Value& option, |
| Capabilities* capabilities) { |
| const base::ListValue* switches_list = NULL; |
| @@ -602,6 +613,7 @@ Capabilities::Capabilities() |
| detach(false), |
| force_devtools_screenshot(false), |
| page_load_strategy(PageLoadStrategy::kNormal), |
| + unexpected_alert_behaviour(""), |
|
samuong
2016/11/02 22:48:48
should this be the empty string, or "ignore"?
gmanikpure
2016/11/04 00:23:24
Done.Making ignore value as default.
|
| network_emulation_enabled(false) {} |
| Capabilities::~Capabilities() {} |
| @@ -620,6 +632,8 @@ Status Capabilities::Parse(const base::DictionaryValue& desired_caps) { |
| parser_map["loggingPrefs"] = base::Bind(&ParseLoggingPrefs); |
| parser_map["proxy"] = base::Bind(&ParseProxy); |
| parser_map["pageLoadStrategy"] = base::Bind(&ParsePageLoadStrategy); |
| + parser_map["unexpectedAlertBehaviour"] = |
| + base::Bind(&ParseUnexpectedAlertBehaviour); |
| // Network emulation requires device mode, which is only enabled when |
| // mobile emulation is on. |
| if (desired_caps.GetDictionary("chromeOptions.mobileEmulation", nullptr)) { |