summaryrefslogtreecommitdiffstats
path: root/chrome/test/webdriver/webdriver_session.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/webdriver/webdriver_session.cc')
-rw-r--r--chrome/test/webdriver/webdriver_session.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc
index efd7b1e..f93ed46 100644
--- a/chrome/test/webdriver/webdriver_session.cc
+++ b/chrome/test/webdriver/webdriver_session.cc
@@ -93,15 +93,29 @@ Error* Session::Init(const Automation::BrowserOptions& options) {
}
Error* Session::BeforeExecuteCommand() {
+ Error* error = AfterExecuteCommand();
+ if (!error) {
+ scoped_ptr<Error> switch_error(SwitchToTopFrameIfCurrentFrameInvalid());
+ if (switch_error.get()) {
+ std::string text;
+ scoped_ptr<Error> alert_error(GetAlertMessage(&text));
+ if (alert_error.get()) {
+ // Only return a frame checking error if a modal dialog is not present.
+ // TODO(kkania): This is ugly. Fix.
+ return switch_error.release();
+ }
+ }
+ }
+ return error;
+}
+
+Error* Session::AfterExecuteCommand() {
Error* error = NULL;
if (!options_.load_async) {
LOG(INFO) << "Waiting for the page to stop loading";
error = WaitForAllTabsToStopLoading();
LOG(INFO) << "Done waiting for the page to stop loading";
}
- if (!error) {
- error = SwitchToTopFrameIfCurrentFrameInvalid();
- }
return error;
}