| Index: chrome/browser/search/instant_service_unittest.cc
|
| diff --git a/chrome/browser/search/instant_service_unittest.cc b/chrome/browser/search/instant_service_unittest.cc
|
| index c9fd5c2b116b1efcc467c341b2f53b98827d17b0..fe7cc5e88f6390daf7d872cdd43feb8fa36aeeeb 100644
|
| --- a/chrome/browser/search/instant_service_unittest.cc
|
| +++ b/chrome/browser/search/instant_service_unittest.cc
|
| @@ -34,22 +34,6 @@ class MockInstantServiceObserver : public InstantServiceObserver {
|
| MOCK_METHOD0(GoogleURLUpdated, void());
|
| };
|
|
|
| -class MockWebContentsObserver : public content::WebContentsObserver {
|
| - public:
|
| - MOCK_METHOD1(WebContentsDestroyed, void(content::WebContents*));
|
| -
|
| - // Dumb override to make MSVC happy.
|
| - void Observe_(content::WebContents* contents) {
|
| - content::WebContentsObserver::Observe(contents);
|
| - }
|
| -
|
| - protected:
|
| - friend class InstantServiceTest;
|
| - FRIEND_TEST_ALL_PREFIXES(InstantServiceTest,
|
| - DispatchDefaultSearchProviderChanged);
|
| - FRIEND_TEST_ALL_PREFIXES(InstantServiceTest, DispatchGoogleURLUpdated);
|
| -};
|
| -
|
| class InstantServiceTest : public InstantUnitTestBase {
|
| protected:
|
| virtual void SetUp() OVERRIDE {
|
| @@ -57,15 +41,10 @@ class InstantServiceTest : public InstantUnitTestBase {
|
|
|
| instant_service_observer_.reset(new MockInstantServiceObserver());
|
| instant_service_->AddObserver(instant_service_observer_.get());
|
| -
|
| - instant_ntp_contents_observer_.reset(new MockWebContentsObserver());
|
| - instant_ntp_contents_observer_->Observe_(
|
| - instant_service_->GetNTPContents());
|
| }
|
|
|
| virtual void TearDown() OVERRIDE {
|
| instant_service_->RemoveObserver(instant_service_observer_.get());
|
| - instant_ntp_contents_observer_->Observe_(NULL);
|
| InstantUnitTestBase::TearDown();
|
| }
|
|
|
| @@ -74,36 +53,21 @@ class InstantServiceTest : public InstantUnitTestBase {
|
| }
|
|
|
| scoped_ptr<MockInstantServiceObserver> instant_service_observer_;
|
| - scoped_ptr<MockWebContentsObserver> instant_ntp_contents_observer_;
|
| };
|
|
|
| TEST_F(InstantServiceTest, DispatchDefaultSearchProviderChanged) {
|
| EXPECT_CALL(*instant_service_observer_.get(), DefaultSearchProviderChanged())
|
| .Times(1);
|
| - EXPECT_CALL(*instant_ntp_contents_observer_.get(),
|
| - WebContentsDestroyed(instant_service_->GetNTPContents()))
|
| - .Times(1);
|
|
|
| - GURL ntp_url = instant_service_->GetNTPContents()->GetURL();
|
| const std::string& new_base_url = "https://bar.com/";
|
| SetDefaultSearchProvider(new_base_url);
|
| - GURL new_ntp_url = instant_service_->GetNTPContents()->GetURL();
|
| - EXPECT_NE(ntp_url, new_ntp_url);
|
| - EXPECT_TRUE(StartsWithASCII(new_ntp_url.spec(), new_base_url, true));
|
| }
|
|
|
| TEST_F(InstantServiceTest, DispatchGoogleURLUpdated) {
|
| EXPECT_CALL(*instant_service_observer_.get(), GoogleURLUpdated()).Times(1);
|
| - EXPECT_CALL(*instant_ntp_contents_observer_.get(),
|
| - WebContentsDestroyed(instant_service_->GetNTPContents()))
|
| - .Times(1);
|
|
|
| - GURL ntp_url = instant_service_->GetNTPContents()->GetURL();
|
| const std::string& new_base_url = "https://www.google.es/";
|
| NotifyGoogleBaseURLUpdate(new_base_url);
|
| - GURL new_ntp_url = instant_service_->GetNTPContents()->GetURL();
|
| - EXPECT_NE(ntp_url, new_ntp_url);
|
| - EXPECT_TRUE(StartsWithASCII(new_ntp_url.spec(), new_base_url, true));
|
| }
|
|
|
| TEST_F(InstantServiceTest, SendsSearchURLsToRenderer) {
|
|
|