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

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

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes 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..9f3f85529ca47d46a3c2a9291d02066ae47eb4bc 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"
@@ -319,9 +320,11 @@ void NotificationsTest::VerifyInfoBar(const Browser* browser, int index) {
InfoBarService* infobar_service = InfoBarService::FromWebContents(
browser->tab_strip_model()->GetWebContentsAt(index));
- ASSERT_EQ(1U, infobar_service->infobar_count());
- ConfirmInfoBarDelegate* confirm_infobar =
- infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
+ ASSERT_EQ(1U, infobar_service->infobar_manager().infobar_count());
+ ConfirmInfoBarDelegate* confirm_infobar = infobar_service->infobar_manager()
+ .infobar_at(0)
+ ->delegate()
+ ->AsConfirmInfoBarDelegate();
ASSERT_TRUE(confirm_infobar);
int buttons = confirm_infobar->GetButtons();
EXPECT_TRUE(buttons & ConfirmInfoBarDelegate::BUTTON_OK);
@@ -402,17 +405,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 +425,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 +436,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 +500,11 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestUserGestureInfobar) {
&result));
EXPECT_TRUE(result);
- EXPECT_EQ(1U, InfoBarService::FromWebContents(
- browser()->tab_strip_model()->GetWebContentsAt(0))->infobar_count());
+ EXPECT_EQ(1U,
+ InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0))
+ ->infobar_manager()
+ .infobar_count());
}
// If this flakes, use http://crbug.com/62311.
@@ -511,8 +518,11 @@ 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());
+ EXPECT_EQ(0U,
+ InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0))
+ ->infobar_manager()
+ .infobar_count());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) {
@@ -652,8 +662,11 @@ 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());
+ EXPECT_EQ(0U,
+ InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0))
+ ->infobar_manager()
+ .infobar_count());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyNotificationsFromAllSites) {
@@ -719,8 +732,11 @@ 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());
+ EXPECT_EQ(0U,
+ InfoBarService::FromWebContents(
+ browser()->tab_strip_model()->GetWebContentsAt(0))
+ ->infobar_manager()
+ .infobar_count());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateDenyCloseNotifications) {

Powered by Google App Engine
This is Rietveld 408576698