Index: chrome/browser/ui/search/search_ipc_router_unittest.cc |
diff --git a/chrome/browser/ui/search/search_ipc_router_unittest.cc b/chrome/browser/ui/search/search_ipc_router_unittest.cc |
index 101bdb48ac8fc7ef6b32de859cab07931a79ebab..152c5ca37741001cd5661a656009f050b53d9dbc 100644 |
--- a/chrome/browser/ui/search/search_ipc_router_unittest.cc |
+++ b/chrome/browser/ui/search/search_ipc_router_unittest.cc |
@@ -50,7 +50,6 @@ class MockSearchIPCRouterDelegate : public SearchIPCRouter::Delegate { |
MOCK_METHOD1(OnInstantSupportDetermined, void(bool supports_instant)); |
MOCK_METHOD1(FocusOmnibox, void(OmniboxFocusState state)); |
- MOCK_METHOD2(NavigateToURL, void(const GURL&, WindowOpenDisposition)); |
MOCK_METHOD1(OnDeleteMostVisitedItem, void(const GURL& url)); |
MOCK_METHOD1(OnUndoMostVisitedDeletion, void(const GURL& url)); |
MOCK_METHOD0(OnUndoAllMostVisitedDeletions, void()); |
@@ -70,7 +69,6 @@ class MockSearchIPCRouterPolicy : public SearchIPCRouter::Policy { |
virtual ~MockSearchIPCRouterPolicy() {} |
MOCK_METHOD1(ShouldProcessFocusOmnibox, bool(bool)); |
- MOCK_METHOD1(ShouldProcessNavigateToURL, bool(bool)); |
MOCK_METHOD0(ShouldProcessDeleteMostVisitedItem, bool()); |
MOCK_METHOD0(ShouldProcessUndoMostVisitedDeletion, bool()); |
MOCK_METHOD0(ShouldProcessUndoAllMostVisitedDeletions, bool()); |
@@ -209,19 +207,17 @@ class SearchIPCRouterTest : public BrowserWithTestWindowTest { |
TEST_F(SearchIPCRouterTest, IgnoreMessagesFromNonInstantRenderers) { |
NavigateAndCommitActiveTab(GURL("file://foo/bar")); |
SetupMockDelegateAndPolicy(); |
- GURL destination_url("www.foo.com"); |
- EXPECT_CALL(*mock_delegate(), |
- NavigateToURL(destination_url, CURRENT_TAB)).Times(0); |
+ EXPECT_CALL(*mock_delegate(), FocusOmnibox(OMNIBOX_FOCUS_VISIBLE)).Times(0); |
content::WebContents* contents = web_contents(); |
bool is_active_tab = IsActiveTab(contents); |
EXPECT_TRUE(is_active_tab); |
MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
- EXPECT_CALL(*policy, ShouldProcessNavigateToURL(is_active_tab)).Times(0); |
+ EXPECT_CALL(*policy, ShouldProcessFocusOmnibox(is_active_tab)).Times(0); |
- OnMessageReceived(ChromeViewHostMsg_SearchBoxNavigate( |
- contents->GetRoutingID(), GetSearchIPCRouterSeqNo(), destination_url, |
- CURRENT_TAB)); |
+ OnMessageReceived(ChromeViewHostMsg_FocusOmnibox( |
+ contents->GetRoutingID(), GetSearchIPCRouterSeqNo(), |
+ OMNIBOX_FOCUS_VISIBLE)); |
} |
TEST_F(SearchIPCRouterTest, ProcessFocusOmniboxMsg) { |
@@ -278,44 +274,6 @@ TEST_F(SearchIPCRouterTest, HandleTabChangedEvents) { |
EXPECT_TRUE(IsActiveTab(contents)); |
} |
-TEST_F(SearchIPCRouterTest, ProcessNavigateToURLMsg) { |
- NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
- SetupMockDelegateAndPolicy(); |
- GURL destination_url("www.foo.com"); |
- EXPECT_CALL(*mock_delegate(), |
- NavigateToURL(destination_url, CURRENT_TAB)).Times(1); |
- content::WebContents* contents = web_contents(); |
- bool is_active_tab = IsActiveTab(contents); |
- EXPECT_TRUE(is_active_tab); |
- |
- MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
- EXPECT_CALL(*policy, ShouldProcessNavigateToURL(is_active_tab)).Times(1) |
- .WillOnce(testing::Return(true)); |
- |
- OnMessageReceived(ChromeViewHostMsg_SearchBoxNavigate( |
- contents->GetRoutingID(), GetSearchIPCRouterSeqNo(), destination_url, |
- CURRENT_TAB)); |
-} |
- |
-TEST_F(SearchIPCRouterTest, IgnoreNavigateToURLMsg) { |
- NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
- SetupMockDelegateAndPolicy(); |
- GURL destination_url("www.foo.com"); |
- EXPECT_CALL(*mock_delegate(), |
- NavigateToURL(destination_url, CURRENT_TAB)).Times(0); |
- content::WebContents* contents = web_contents(); |
- bool is_active_tab = IsActiveTab(contents); |
- EXPECT_TRUE(is_active_tab); |
- |
- MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
- EXPECT_CALL(*policy, ShouldProcessNavigateToURL(is_active_tab)).Times(1) |
- .WillOnce(testing::Return(false)); |
- |
- OnMessageReceived(ChromeViewHostMsg_SearchBoxNavigate( |
- contents->GetRoutingID(), GetSearchIPCRouterSeqNo(), destination_url, |
- CURRENT_TAB)); |
-} |
- |
TEST_F(SearchIPCRouterTest, ProcessLogEventMsg) { |
base::TimeDelta delta = base::TimeDelta::FromMilliseconds(123); |
NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
@@ -523,14 +481,9 @@ TEST_F(SearchIPCRouterTest, IgnoreMessageIfThePageIsNotActive) { |
content::WebContents* contents = web_contents(); |
bool is_active_tab = IsActiveTab(contents); |
GURL item_url("www.foo.com"); |
- EXPECT_CALL(*mock_delegate(), NavigateToURL(item_url, CURRENT_TAB)).Times(0); |
- // At this point, in a real test, the navigation would cause the |
- // SearchIPCRouter's page sequence to advance. In this test it doesn't, so |
- // we'll decrement the sequence number on this side to simulate it. |
- --page_seq_no; |
- EXPECT_CALL(*policy, ShouldProcessNavigateToURL(is_active_tab)).Times(0); |
- OnMessageReceived(ChromeViewHostMsg_SearchBoxNavigate( |
- contents->GetRoutingID(), page_seq_no, item_url, CURRENT_TAB)); |
+ |
+ // Navigate away from the NTP. Afterwards, all messages should be ignored. |
+ NavigateAndCommitActiveTab(item_url); |
EXPECT_CALL(*mock_delegate(), OnDeleteMostVisitedItem(item_url)).Times(0); |
EXPECT_CALL(*policy, ShouldProcessDeleteMostVisitedItem()).Times(0); |