| 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/search_ipc_router.h" | 5 #include "chrome/browser/ui/search/search_ipc_router.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" | 9 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" |
| 10 #include "chrome/browser/ui/search/search_tab_helper.h" | 10 #include "chrome/browser/ui/search/search_tab_helper.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 45 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 46 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); | 46 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessFocusOmnibox) { | 49 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessFocusOmnibox) { |
| 50 // Process message only if the underlying page is an InstantNTP. | 50 // Process message only if the underlying page is an InstantNTP. |
| 51 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 51 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 52 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); | 52 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 TEST_F(SearchIPCRouterPolicyTest, SendSetPromoInformation) { | |
| 56 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | |
| 57 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendSetPromoInformation()); | |
| 58 } | |
| 59 | |
| 60 TEST_F(SearchIPCRouterPolicyTest, DoNotSendSetPromoInformation) { | |
| 61 // Send promo information only if the underlying page is an InstantNTP. | |
| 62 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | |
| 63 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldSendSetPromoInformation()); | |
| 64 } | |
| 65 | |
| 66 TEST_F(SearchIPCRouterPolicyTest, ProcessDeleteMostVisitedItem) { | 55 TEST_F(SearchIPCRouterPolicyTest, ProcessDeleteMostVisitedItem) { |
| 67 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 56 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 68 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessDeleteMostVisitedItem()); | 57 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessDeleteMostVisitedItem()); |
| 69 } | 58 } |
| 70 | 59 |
| 71 TEST_F(SearchIPCRouterPolicyTest, ProcessUndoMostVisitedDeletion) { | 60 TEST_F(SearchIPCRouterPolicyTest, ProcessUndoMostVisitedDeletion) { |
| 72 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 61 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 73 EXPECT_TRUE(GetSearchIPCRouterPolicy()-> | 62 EXPECT_TRUE(GetSearchIPCRouterPolicy()-> |
| 74 ShouldProcessUndoMostVisitedDeletion()); | 63 ShouldProcessUndoMostVisitedDeletion()); |
| 75 } | 64 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 147 } |
| 159 | 148 |
| 160 TEST_F(SearchIPCRouterPolicyTest, | 149 TEST_F(SearchIPCRouterPolicyTest, |
| 161 DoNotSendSetMessagesForIncognitoPage) { | 150 DoNotSendSetMessagesForIncognitoPage) { |
| 162 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 151 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 163 SetIncognitoProfile(); | 152 SetIncognitoProfile(); |
| 164 | 153 |
| 165 SearchIPCRouter::Policy* router_policy = GetSearchIPCRouterPolicy(); | 154 SearchIPCRouter::Policy* router_policy = GetSearchIPCRouterPolicy(); |
| 166 EXPECT_FALSE(router_policy->ShouldSendSetSuggestionToPrefetch()); | 155 EXPECT_FALSE(router_policy->ShouldSendSetSuggestionToPrefetch()); |
| 167 EXPECT_FALSE(router_policy->ShouldSendSetDisplayInstantResults()); | 156 EXPECT_FALSE(router_policy->ShouldSendSetDisplayInstantResults()); |
| 168 EXPECT_FALSE(router_policy->ShouldSendSetPromoInformation()); | |
| 169 EXPECT_FALSE(router_policy->ShouldSendThemeBackgroundInfo()); | 157 EXPECT_FALSE(router_policy->ShouldSendThemeBackgroundInfo()); |
| 170 EXPECT_FALSE(router_policy->ShouldSendMostVisitedItems()); | 158 EXPECT_FALSE(router_policy->ShouldSendMostVisitedItems()); |
| 171 EXPECT_FALSE(router_policy->ShouldSendSetInputInProgress(true)); | 159 EXPECT_FALSE(router_policy->ShouldSendSetInputInProgress(true)); |
| 172 EXPECT_FALSE(router_policy->ShouldSendOmniboxFocusChanged()); | 160 EXPECT_FALSE(router_policy->ShouldSendOmniboxFocusChanged()); |
| 173 } | 161 } |
| 174 | 162 |
| 175 TEST_F(SearchIPCRouterPolicyTest, | 163 TEST_F(SearchIPCRouterPolicyTest, |
| 176 AppropriateMessagesSentToIncognitoPages) { | 164 AppropriateMessagesSentToIncognitoPages) { |
| 177 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 165 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 178 SetIncognitoProfile(); | 166 SetIncognitoProfile(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 200 // Send theme background information only if the current tab is an | 188 // Send theme background information only if the current tab is an |
| 201 // Instant NTP. | 189 // Instant NTP. |
| 202 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 190 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 203 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldSendThemeBackgroundInfo()); | 191 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldSendThemeBackgroundInfo()); |
| 204 } | 192 } |
| 205 | 193 |
| 206 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 194 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
| 207 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 195 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 208 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 196 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
| 209 } | 197 } |
| OLD | NEW |