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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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/ui/cocoa/browser_window_controller_browsertest.mm
===================================================================
--- chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm (revision 226624)
+++ chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm (working copy)
@@ -8,8 +8,8 @@
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
#include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
@@ -68,25 +68,6 @@
VIEW_ID_COUNT,
};
-// A very simple info bar implementation used to show an infobar on the browser
-// window.
-class DummyInfoBar : public ConfirmInfoBarDelegate {
- public:
- explicit DummyInfoBar(InfoBarService* service)
- : ConfirmInfoBarDelegate(service) {
- }
-
- virtual ~DummyInfoBar() {
- }
-
- virtual string16 GetMessageText() const OVERRIDE {
- return string16();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DummyInfoBar);
-};
-
} // namespace
class BrowserWindowControllerTest : public InProcessBrowserTest {
@@ -104,13 +85,11 @@
browser()->window()->GetNativeWindow()];
}
- void ShowInfoBar() {
- content::WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
- InfoBarService* service =
- InfoBarService::FromWebContents(web_contents);
- scoped_ptr<InfoBarDelegate> info_bar_delegate(new DummyInfoBar(service));
- service->AddInfoBar(info_bar_delegate.Pass());
+ static void ShowInfoBar(Browser* browser) {
+ SimpleAlertInfoBarDelegate::Create(
+ InfoBarService::FromWebContents(
+ browser->tab_strip_model()->GetActiveWebContents()),
+ 0, string16(), false);
}
NSView* GetViewWithID(ViewID view_id) const {
@@ -349,7 +328,7 @@
// Verify that the info bar tip is hidden when the toolbar is not visible.
IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
InfoBarTipHiddenForWindowWithoutToolbar) {
- ShowInfoBar();
+ ShowInfoBar(browser());
EXPECT_FALSE(
[[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]);
@@ -364,11 +343,7 @@
EXPECT_FALSE([popupController hasToolbar]);
// Show infobar for controller.
- content::WebContents* web_contents =
- popup_browser->tab_strip_model()->GetActiveWebContents();
- InfoBarService* service = InfoBarService::FromWebContents(web_contents);
- scoped_ptr<InfoBarDelegate> info_bar_delegate(new DummyInfoBar(service));
- service->AddInfoBar(info_bar_delegate.Pass());
+ ShowInfoBar(popup_browser);
EXPECT_TRUE(
[[popupController infoBarContainerController]
shouldSuppressTopInfoBarTip]);

Powered by Google App Engine
This is Rietveld 408576698