Index: chrome/browser/automation/automation_provider_observers.cc |
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc |
index 03039b1c0750a35361b56da5fa622b7d73016770..dfea17c8b4432a525a26c874a351a56bfb025b75 100644 |
--- a/chrome/browser/automation/automation_provider_observers.cc |
+++ b/chrome/browser/automation/automation_provider_observers.cc |
@@ -174,18 +174,16 @@ void NavigationNotificationObserver::Observe( |
// occur while authentication is ongoing. |
navigation_started_ = true; |
} else if (type == NotificationType::AUTH_NEEDED) { |
- if (navigation_started_) { |
- // Remember the login handler that wants authentication. |
- LoginHandler* handler = |
- Details<LoginNotificationDetails>(details)->handler(); |
- automation_->AddLoginHandler(controller_, handler); |
- |
- // Respond that authentication is needed. |
- navigation_started_ = false; |
- ConditionMet(AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED); |
- } else { |
- NOTREACHED(); |
- } |
+ // Remember the login handler that wants authentication. |
+ // We do this in all cases (not just when navigation_started_ == true) so |
+ // tests can still wait for auth dialogs outside of navigation. |
+ LoginHandler* handler = |
+ Details<LoginNotificationDetails>(details)->handler(); |
+ automation_->AddLoginHandler(controller_, handler); |
+ |
+ // Respond that authentication is needed. |
+ navigation_started_ = false; |
+ ConditionMet(AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED); |
} else { |
NOTREACHED(); |
} |