| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/search/instant_page.h" | 5 #include "chrome/browser/ui/search/instant_page.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/ui/search/search_tab_helper.h" | 9 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 TEST_F(InstantPageTest, IsLocal) { | 123 TEST_F(InstantPageTest, IsLocal) { |
| 124 page.reset(new FakePage(&delegate, "", false)); | 124 page.reset(new FakePage(&delegate, "", false)); |
| 125 EXPECT_FALSE(page->supports_instant()); | 125 EXPECT_FALSE(page->supports_instant()); |
| 126 EXPECT_FALSE(page->IsLocal()); | 126 EXPECT_FALSE(page->IsLocal()); |
| 127 page->SetContents(web_contents()); | 127 page->SetContents(web_contents()); |
| 128 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | 128 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 129 EXPECT_TRUE(page->IsLocal()); | 129 EXPECT_TRUE(page->IsLocal()); |
| 130 NavigateAndCommit(GURL("http://example.com")); | 130 NavigateAndCommit(GURL("http://example.com")); |
| 131 EXPECT_FALSE(page->IsLocal()); | 131 EXPECT_FALSE(page->IsLocal()); |
| 132 NavigateAndCommit(GURL(chrome::kChromeSearchLocalGoogleNtpUrl)); | |
| 133 EXPECT_TRUE(page->IsLocal()); | |
| 134 } | 132 } |
| 135 | 133 |
| 136 TEST_F(InstantPageTest, DetermineIfPageSupportsInstant_Local) { | 134 TEST_F(InstantPageTest, DetermineIfPageSupportsInstant_Local) { |
| 137 page.reset(new FakePage(&delegate, "", false)); | 135 page.reset(new FakePage(&delegate, "", false)); |
| 138 EXPECT_FALSE(page->supports_instant()); | 136 EXPECT_FALSE(page->supports_instant()); |
| 139 page->SetContents(web_contents()); | 137 page->SetContents(web_contents()); |
| 140 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | 138 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 141 EXPECT_TRUE(page->IsLocal()); | 139 EXPECT_TRUE(page->IsLocal()); |
| 142 EXPECT_CALL(delegate, InstantSupportDetermined(web_contents(), true)) | 140 EXPECT_CALL(delegate, InstantSupportDetermined(web_contents(), true)) |
| 143 .Times(1); | 141 .Times(1); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 page->sender()->SetInputInProgress(false); | 347 page->sender()->SetInputInProgress(false); |
| 350 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); | 348 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); |
| 351 | 349 |
| 352 page->sender()->SendMostVisitedItems(std::vector<InstantMostVisitedItem>()); | 350 page->sender()->SendMostVisitedItems(std::vector<InstantMostVisitedItem>()); |
| 353 EXPECT_FALSE(MessageWasSent( | 351 EXPECT_FALSE(MessageWasSent( |
| 354 ChromeViewMsg_SearchBoxMostVisitedItemsChanged::ID)); | 352 ChromeViewMsg_SearchBoxMostVisitedItemsChanged::ID)); |
| 355 | 353 |
| 356 page->sender()->ToggleVoiceSearch(); | 354 page->sender()->ToggleVoiceSearch(); |
| 357 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 355 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
| 358 } | 356 } |
| OLD | NEW |