| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 content::Details<InfoBarAddedDetails>(infobar_added.details()).ptr(); | 166 content::Details<InfoBarAddedDetails>(infobar_added.details()).ptr(); |
| 167 ConfirmInfoBarDelegate* confirm_info_bar_delegate = | 167 ConfirmInfoBarDelegate* confirm_info_bar_delegate = |
| 168 info_bar_delegate->AsConfirmInfoBarDelegate(); | 168 info_bar_delegate->AsConfirmInfoBarDelegate(); |
| 169 ASSERT_TRUE(confirm_info_bar_delegate); | 169 ASSERT_TRUE(confirm_info_bar_delegate); |
| 170 | 170 |
| 171 content::WindowedNotificationObserver infobar_removed( | 171 content::WindowedNotificationObserver infobar_removed( |
| 172 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 172 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| 173 content::NotificationService::AllSources()); | 173 content::NotificationService::AllSources()); |
| 174 InfoBarService* infobar_service = | 174 InfoBarService* infobar_service = |
| 175 InfoBarService::FromWebContents(tab); | 175 InfoBarService::FromWebContents(tab); |
| 176 content::WindowedNotificationObserver back_observer( |
| 177 content::NOTIFICATION_LOAD_STOP, |
| 178 content::Source<NavigationController>(&tab->GetController())); |
| 176 | 179 |
| 177 switch (infobar_action) { | 180 switch (infobar_action) { |
| 178 case INFOBAR_ACCEPT: | 181 case INFOBAR_ACCEPT: |
| 179 confirm_info_bar_delegate->InfoBarDismissed(); | 182 confirm_info_bar_delegate->InfoBarDismissed(); |
| 180 ASSERT_TRUE(confirm_info_bar_delegate->Accept()); | 183 ASSERT_TRUE(confirm_info_bar_delegate->Accept()); |
| 181 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); | 184 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); |
| 182 break; | 185 break; |
| 183 case INFOBAR_CANCEL: | 186 case INFOBAR_CANCEL: |
| 184 confirm_info_bar_delegate->InfoBarDismissed(); | 187 confirm_info_bar_delegate->InfoBarDismissed(); |
| 185 ASSERT_FALSE(confirm_info_bar_delegate->Cancel()); | 188 ASSERT_FALSE(confirm_info_bar_delegate->Cancel()); |
| 189 back_observer.Wait(); |
| 186 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); | 190 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); |
| 187 break; | 191 break; |
| 188 case INFOBAR_ALREADY_ADDED: | 192 case INFOBAR_ALREADY_ADDED: |
| 189 confirm_info_bar_delegate->InfoBarDismissed(); | 193 confirm_info_bar_delegate->InfoBarDismissed(); |
| 190 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); | 194 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); |
| 191 break; | 195 break; |
| 192 case INFOBAR_NOT_USED: | 196 case INFOBAR_NOT_USED: |
| 193 NOTREACHED(); | 197 NOTREACHED(); |
| 194 break; | 198 break; |
| 195 } | 199 } |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 interstitial_page->GetDelegateForTesting(); | 611 interstitial_page->GetDelegateForTesting(); |
| 608 | 612 |
| 609 // Simulate the click on the "preview" button. | 613 // Simulate the click on the "preview" button. |
| 610 delegate->CommandReceived("\"preview\""); | 614 delegate->CommandReceived("\"preview\""); |
| 611 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 615 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 612 WebContentsModalDialogManager::FromWebContents(tab); | 616 WebContentsModalDialogManager::FromWebContents(tab); |
| 613 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); | 617 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); |
| 614 } | 618 } |
| 615 | 619 |
| 616 } // namespace | 620 } // namespace |
| OLD | NEW |