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

Unified Diff: chrome/browser/notifications/notification_browsertest.cc

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments Created 6 years, 9 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
Index: chrome/browser/notifications/notification_browsertest.cc
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
index 4f2944341785d6bf9322d9a8cd57384b19654c15..671db01f33e9af4570154d712e6ac25b53fac864 100644
--- a/chrome/browser/notifications/notification_browsertest.cc
+++ b/chrome/browser/notifications/notification_browsertest.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/infobars/infobar_manager.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/notifications/balloon.h"
#include "chrome/browser/notifications/balloon_collection.h"
@@ -318,10 +319,11 @@ void NotificationsTest::AllowAllOrigins() {
void NotificationsTest::VerifyInfoBar(const Browser* browser, int index) {
InfoBarService* infobar_service = InfoBarService::FromWebContents(
browser->tab_strip_model()->GetWebContentsAt(index));
+ InfoBarManager* infobar_manager = infobar_service->infobar_manager();
- ASSERT_EQ(1U, infobar_service->infobar_count());
+ ASSERT_EQ(1U, infobar_manager->infobar_count());
ConfirmInfoBarDelegate* confirm_infobar =
- infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
+ infobar_manager->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
ASSERT_TRUE(confirm_infobar);
int buttons = confirm_infobar->GetButtons();
EXPECT_TRUE(buttons & ConfirmInfoBarDelegate::BUTTON_OK);
@@ -402,17 +404,18 @@ bool NotificationsTest::PerformActionOnInfoBar(
int tab_index) {
InfoBarService* infobar_service = InfoBarService::FromWebContents(
browser->tab_strip_model()->GetWebContentsAt(tab_index));
- if (infobar_index >= infobar_service->infobar_count()) {
+ InfoBarManager* infobar_manager = infobar_service->infobar_manager();
+ if (infobar_index >= infobar_manager->infobar_count()) {
ADD_FAILURE();
return false;
}
- InfoBar* infobar = infobar_service->infobar_at(infobar_index);
+ InfoBar* infobar = infobar_manager->infobar_at(infobar_index);
InfoBarDelegate* infobar_delegate = infobar->delegate();
switch (action) {
case DISMISS:
infobar_delegate->InfoBarDismissed();
- infobar_service->RemoveInfoBar(infobar);
+ infobar_manager->RemoveInfoBar(infobar);
return true;
case ALLOW: {
@@ -421,7 +424,7 @@ bool NotificationsTest::PerformActionOnInfoBar(
if (!confirm_infobar_delegate) {
ADD_FAILURE();
} else if (confirm_infobar_delegate->Accept()) {
- infobar_service->RemoveInfoBar(infobar);
+ infobar_manager->RemoveInfoBar(infobar);
return true;
}
}
@@ -432,7 +435,7 @@ bool NotificationsTest::PerformActionOnInfoBar(
if (!confirm_infobar_delegate) {
ADD_FAILURE();
} else if (confirm_infobar_delegate->Cancel()) {
- infobar_service->RemoveInfoBar(infobar);
+ infobar_manager->RemoveInfoBar(infobar);
return true;
}
}
@@ -496,8 +499,9 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestUserGestureInfobar) {
&result));
EXPECT_TRUE(result);
- EXPECT_EQ(1U, InfoBarService::FromWebContents(
- browser()->tab_strip_model()->GetWebContentsAt(0))->infobar_count());
+ InfoBarService* infobar_service = InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0));
+ EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count());
}
// If this flakes, use http://crbug.com/62311.
@@ -511,8 +515,9 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNoUserGestureInfobar) {
embedded_test_server()->GetURL(
"/notifications/notifications_request_inline.html"));
- EXPECT_EQ(0U, InfoBarService::FromWebContents(
- browser()->tab_strip_model()->GetWebContentsAt(0))->infobar_count());
+ InfoBarService* infobar_service = InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0));
+ EXPECT_EQ(0U, infobar_service->infobar_manager()->infobar_count());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) {
@@ -652,8 +657,9 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowNotificationsFromAllSites) {
EXPECT_NE("-1", result);
ASSERT_EQ(1, GetNotificationCount());
- EXPECT_EQ(0U, InfoBarService::FromWebContents(
- browser()->tab_strip_model()->GetWebContentsAt(0))->infobar_count());
+ InfoBarService* infobar_service = InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0));
+ EXPECT_EQ(0U, infobar_service->infobar_manager()->infobar_count());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyNotificationsFromAllSites) {
@@ -719,8 +725,9 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyAndThenAllowDomain) {
EXPECT_NE("-1", result);
ASSERT_EQ(1, GetNotificationCount());
- EXPECT_EQ(0U, InfoBarService::FromWebContents(
- browser()->tab_strip_model()->GetWebContentsAt(0))->infobar_count());
+ InfoBarService* infobar_service = InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0));
+ EXPECT_EQ(0U, infobar_service->infobar_manager()->infobar_count());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateDenyCloseNotifications) {
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.cc ('k') | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698