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

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

Issue 1827003004: [Chromedriver] Chromedriver should handle unexpected alert automatically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove getter, use variable directly. Created 4 years, 1 month 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/capabilities.h ('k') | chrome/test/chromedriver/client/chromedriver.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/capabilities.cc
diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc
index 75d021ba7068da6d41cb898c6298008e8c57a278..60ad11cd71f64c961a035e5b0798d5feee7e39c7 100644
--- a/chrome/test/chromedriver/capabilities.cc
+++ b/chrome/test/chromedriver/capabilities.cc
@@ -23,6 +23,7 @@
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/logging.h"
+#include "chrome/test/chromedriver/session.h"
namespace {
@@ -190,6 +191,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 == kAccept ||
+ capabilities->unexpected_alert_behaviour == kDismiss ||
+ capabilities->unexpected_alert_behaviour == kIgnore)
+ return Status(kOk);
+ return Status(kUnknownError, "unexpected alert behaviour unsupported");
+}
+
Status ParseSwitches(const base::Value& option,
Capabilities* capabilities) {
const base::ListValue* switches_list = NULL;
@@ -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)) {
« no previous file with comments | « chrome/test/chromedriver/capabilities.h ('k') | chrome/test/chromedriver/client/chromedriver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698