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

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

Issue 2350463002: [chromedriver] Avoid calling Runtime.evaluate when a dialog is showing. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | 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 827ebf9e1b409b98f20015f53981a020f1fecbc4..64d9e97dc7f79c78889ab6fae712a056951e9a77 100644
--- a/chrome/test/chromedriver/session_commands.cc
+++ b/chrome/test/chromedriver/session_commands.cc
@@ -27,6 +27,7 @@
#include "chrome/test/chromedriver/chrome/device_manager.h"
#include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
#include "chrome/test/chromedriver/chrome/geoposition.h"
+#include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/chrome/web_view.h"
#include "chrome/test/chromedriver/chrome_launcher.h"
@@ -76,6 +77,8 @@ Status EvaluateScriptAndIgnoreResult(Session* session, std::string expression) {
Status status = session->GetTargetWindow(&web_view);
if (status.IsError())
return status;
+ if (web_view->GetJavaScriptDialogManager()->IsDialogOpen())
+ return Status(kUnexpectedAlertOpen);
std::string frame_id = session->GetCurrentFrameId();
std::unique_ptr<base::Value> result;
return web_view->EvaluateScript(frame_id, expression, &result);
« no previous file with comments | « no previous file | chrome/test/chromedriver/test/run_py_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698