| Index: chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm
|
| diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm
|
| index 7af27a8e2a908c11b63986cb7f7908a6f7682484..1bf11e8776279edb12f99dbe7205eb2c32b76fd6 100644
|
| --- a/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm
|
| +++ b/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm
|
| @@ -12,8 +12,8 @@
|
| #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
|
| #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
|
| #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h"
|
| +#include "chrome/browser/ui/cocoa/infobars/mock_alternate_nav_infobar_delegate.h"
|
| #include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h"
|
| -#include "chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h"
|
| #include "chrome/browser/ui/cocoa/run_loop_testing.h"
|
| #import "content/public/browser/web_contents.h"
|
| #include "ipc/ipc_message.h"
|
| @@ -69,11 +69,11 @@ using content::WebContents;
|
| // Calls to removeSelf normally start an animation, which removes the infobar
|
| // completely when finished. For testing purposes, we create a mock controller
|
| // which calls close: immediately, rather than kicking off an animation.
|
| -@interface TestLinkInfoBarController : LinkInfoBarController
|
| +@interface TestAlternateNavInfoBarController : AlternateNavInfoBarController
|
| - (void)removeSelf;
|
| @end
|
|
|
| -@implementation TestLinkInfoBarController
|
| +@implementation TestAlternateNavInfoBarController
|
| - (void)removeSelf {
|
| [self close];
|
| }
|
| @@ -94,8 +94,9 @@ namespace {
|
| ///////////////////////////////////////////////////////////////////////////
|
| // Test fixtures
|
|
|
| -class LinkInfoBarControllerTest : public CocoaProfileTest,
|
| - public MockLinkInfoBarDelegate::Owner {
|
| +class AlternateNavInfoBarControllerTest
|
| + : public CocoaProfileTest,
|
| + public MockAlternateNavInfoBarDelegate::Owner {
|
| public:
|
| virtual void SetUp() {
|
| CocoaProfileTest::SetUp();
|
| @@ -105,8 +106,8 @@ class LinkInfoBarControllerTest : public CocoaProfileTest,
|
|
|
| InfoBarService* infobar_service =
|
| InfoBarService::FromWebContents(web_contents_.get());
|
| - delegate_ = new MockLinkInfoBarDelegate(this);
|
| - controller_.reset([[TestLinkInfoBarController alloc]
|
| + delegate_ = new MockAlternateNavInfoBarDelegate(this);
|
| + controller_.reset([[TestAlternateNavInfoBarController alloc]
|
| initWithDelegate:delegate_ owner:infobar_service]);
|
| container_.reset(
|
| [[InfoBarContainerTest alloc] initWithController:controller_]);
|
| @@ -125,9 +126,9 @@ class LinkInfoBarControllerTest : public CocoaProfileTest,
|
| // Hopefully-obvious: If this returns true, you must not deref |delegate_|!
|
| bool delegate_closed() const { return delegate_ == NULL; }
|
|
|
| - MockLinkInfoBarDelegate* delegate_; // Owns itself.
|
| + MockAlternateNavInfoBarDelegate* delegate_; // Owns itself.
|
| scoped_nsobject<id> container_;
|
| - scoped_nsobject<LinkInfoBarController> controller_;
|
| + scoped_nsobject<AlternateNavInfoBarController> controller_;
|
| bool closed_delegate_link_clicked_;
|
|
|
| private:
|
| @@ -194,9 +195,9 @@ class ConfirmInfoBarControllerTest : public CocoaProfileTest,
|
| ////////////////////////////////////////////////////////////////////////////
|
| // Tests
|
|
|
| -TEST_VIEW(LinkInfoBarControllerTest, [controller_ view]);
|
| +TEST_VIEW(AlternateNavInfoBarControllerTest, [controller_ view]);
|
|
|
| -TEST_F(LinkInfoBarControllerTest, ShowAndDismiss) {
|
| +TEST_F(AlternateNavInfoBarControllerTest, ShowAndDismiss) {
|
| // Make sure someone looked at the message, link, and icon.
|
| EXPECT_TRUE(delegate_->message_text_accessed());
|
| EXPECT_TRUE(delegate_->link_text_accessed());
|
| @@ -208,7 +209,7 @@ TEST_F(LinkInfoBarControllerTest, ShowAndDismiss) {
|
| EXPECT_FALSE(closed_delegate_link_clicked_);
|
| }
|
|
|
| -TEST_F(LinkInfoBarControllerTest, ShowAndClickLink) {
|
| +TEST_F(AlternateNavInfoBarControllerTest, ShowAndClickLink) {
|
| // Check that clicking on the link calls LinkClicked() on the
|
| // delegate. It should also close the infobar.
|
| [controller_ linkClicked];
|
| @@ -221,7 +222,7 @@ TEST_F(LinkInfoBarControllerTest, ShowAndClickLink) {
|
| EXPECT_TRUE(closed_delegate_link_clicked_);
|
| }
|
|
|
| -TEST_F(LinkInfoBarControllerTest, ShowAndClickLinkWithoutClosing) {
|
| +TEST_F(AlternateNavInfoBarControllerTest, ShowAndClickLinkWithoutClosing) {
|
| delegate_->set_dont_close_on_action();
|
|
|
| // Check that clicking on the link calls LinkClicked() on the
|
| @@ -231,7 +232,7 @@ TEST_F(LinkInfoBarControllerTest, ShowAndClickLinkWithoutClosing) {
|
| EXPECT_TRUE(delegate_->link_clicked());
|
| }
|
|
|
| -TEST_F(LinkInfoBarControllerTest, DeallocController) {
|
| +TEST_F(AlternateNavInfoBarControllerTest, DeallocController) {
|
| // Test that dealloc'ing the controller does not delete the delegate.
|
| controller_.reset(nil);
|
| ASSERT_FALSE(delegate_closed());
|
|
|