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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 content::Details<InfoBarAddedDetails>(infobar_added.details()).ptr(); | 168 content::Details<InfoBarAddedDetails>(infobar_added.details()).ptr(); |
169 ConfirmInfoBarDelegate* confirm_info_bar_delegate = | 169 ConfirmInfoBarDelegate* confirm_info_bar_delegate = |
170 info_bar_delegate->AsConfirmInfoBarDelegate(); | 170 info_bar_delegate->AsConfirmInfoBarDelegate(); |
171 ASSERT_TRUE(confirm_info_bar_delegate); | 171 ASSERT_TRUE(confirm_info_bar_delegate); |
172 | 172 |
173 content::WindowedNotificationObserver infobar_removed( | 173 content::WindowedNotificationObserver infobar_removed( |
174 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 174 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
175 content::NotificationService::AllSources()); | 175 content::NotificationService::AllSources()); |
176 InfoBarService* infobar_service = | 176 InfoBarService* infobar_service = |
177 InfoBarService::FromWebContents(tab); | 177 InfoBarService::FromWebContents(tab); |
178 content::WindowedNotificationObserver back_observer( | |
179 content::NOTIFICATION_LOAD_STOP, | |
180 content::Source<NavigationController>(&tab->GetController())); | |
181 | 178 |
182 switch (infobar_action) { | 179 switch (infobar_action) { |
183 case INFOBAR_ACCEPT: | 180 case INFOBAR_ACCEPT: |
184 confirm_info_bar_delegate->InfoBarDismissed(); | 181 confirm_info_bar_delegate->InfoBarDismissed(); |
185 ASSERT_TRUE(confirm_info_bar_delegate->Accept()); | 182 ASSERT_TRUE(confirm_info_bar_delegate->Accept()); |
186 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); | 183 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); |
187 break; | 184 break; |
188 case INFOBAR_CANCEL: | 185 case INFOBAR_CANCEL: |
189 confirm_info_bar_delegate->InfoBarDismissed(); | 186 confirm_info_bar_delegate->InfoBarDismissed(); |
190 ASSERT_FALSE(confirm_info_bar_delegate->Cancel()); | 187 ASSERT_FALSE(confirm_info_bar_delegate->Cancel()); |
191 back_observer.Wait(); | |
192 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); | 188 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); |
193 break; | 189 break; |
194 case INFOBAR_ALREADY_ADDED: | 190 case INFOBAR_ALREADY_ADDED: |
195 confirm_info_bar_delegate->InfoBarDismissed(); | 191 confirm_info_bar_delegate->InfoBarDismissed(); |
196 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); | 192 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); |
197 break; | 193 break; |
198 case INFOBAR_NOT_USED: | 194 case INFOBAR_NOT_USED: |
199 NOTREACHED(); | 195 NOTREACHED(); |
200 break; | 196 break; |
201 } | 197 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 // Simulate the click on the "preview" button. | 620 // Simulate the click on the "preview" button. |
625 delegate->CommandReceived("\"preview\""); | 621 delegate->CommandReceived("\"preview\""); |
626 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 622 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
627 WebContentsModalDialogManager::FromWebContents(tab); | 623 WebContentsModalDialogManager::FromWebContents(tab); |
628 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); | 624 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); |
629 } | 625 } |
630 | 626 |
631 #endif // OS_CHROMEOS | 627 #endif // OS_CHROMEOS |
632 | 628 |
633 } // namespace | 629 } // namespace |
OLD | NEW |