| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessMessagesForInactiveTab) { | 129 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessMessagesForInactiveTab) { |
| 130 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 130 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 131 | 131 |
| 132 // Assume the NTP is deactivated. | 132 // Assume the NTP is deactivated. |
| 133 SearchIPCRouter::Policy* router_policy = GetSearchIPCRouterPolicy(); | 133 SearchIPCRouter::Policy* router_policy = GetSearchIPCRouterPolicy(); |
| 134 EXPECT_FALSE(router_policy->ShouldProcessFocusOmnibox(false)); | 134 EXPECT_FALSE(router_policy->ShouldProcessFocusOmnibox(false)); |
| 135 EXPECT_FALSE(router_policy->ShouldProcessPasteIntoOmnibox(false)); | 135 EXPECT_FALSE(router_policy->ShouldProcessPasteIntoOmnibox(false)); |
| 136 EXPECT_FALSE(router_policy->ShouldSendSetInputInProgress(false)); | 136 EXPECT_FALSE(router_policy->ShouldSendSetInputInProgress(false)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TEST_F(SearchIPCRouterPolicyTest, SendSetDisplayInstantResults) { | |
| 140 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | |
| 141 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendSetDisplayInstantResults()); | |
| 142 } | |
| 143 | |
| 144 TEST_F(SearchIPCRouterPolicyTest, SendSetSuggestionToPrefetch) { | 139 TEST_F(SearchIPCRouterPolicyTest, SendSetSuggestionToPrefetch) { |
| 145 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 140 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 146 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendSetSuggestionToPrefetch()); | 141 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendSetSuggestionToPrefetch()); |
| 147 } | 142 } |
| 148 | 143 |
| 149 TEST_F(SearchIPCRouterPolicyTest, | 144 TEST_F(SearchIPCRouterPolicyTest, |
| 150 DoNotSendSetMessagesForIncognitoPage) { | 145 DoNotSendSetMessagesForIncognitoPage) { |
| 151 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 146 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 152 SetIncognitoProfile(); | 147 SetIncognitoProfile(); |
| 153 | 148 |
| 154 SearchIPCRouter::Policy* router_policy = GetSearchIPCRouterPolicy(); | 149 SearchIPCRouter::Policy* router_policy = GetSearchIPCRouterPolicy(); |
| 155 EXPECT_FALSE(router_policy->ShouldSendSetSuggestionToPrefetch()); | 150 EXPECT_FALSE(router_policy->ShouldSendSetSuggestionToPrefetch()); |
| 156 EXPECT_FALSE(router_policy->ShouldSendSetDisplayInstantResults()); | |
| 157 EXPECT_FALSE(router_policy->ShouldSendThemeBackgroundInfo()); | 151 EXPECT_FALSE(router_policy->ShouldSendThemeBackgroundInfo()); |
| 158 EXPECT_FALSE(router_policy->ShouldSendMostVisitedItems()); | 152 EXPECT_FALSE(router_policy->ShouldSendMostVisitedItems()); |
| 159 EXPECT_FALSE(router_policy->ShouldSendSetInputInProgress(true)); | 153 EXPECT_FALSE(router_policy->ShouldSendSetInputInProgress(true)); |
| 160 EXPECT_FALSE(router_policy->ShouldSendOmniboxFocusChanged()); | 154 EXPECT_FALSE(router_policy->ShouldSendOmniboxFocusChanged()); |
| 161 } | 155 } |
| 162 | 156 |
| 163 TEST_F(SearchIPCRouterPolicyTest, | 157 TEST_F(SearchIPCRouterPolicyTest, |
| 164 AppropriateMessagesSentToIncognitoPages) { | 158 AppropriateMessagesSentToIncognitoPages) { |
| 165 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 159 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 166 SetIncognitoProfile(); | 160 SetIncognitoProfile(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 188 // Send theme background information only if the current tab is an | 182 // Send theme background information only if the current tab is an |
| 189 // Instant NTP. | 183 // Instant NTP. |
| 190 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 184 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 191 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldSendThemeBackgroundInfo()); | 185 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldSendThemeBackgroundInfo()); |
| 192 } | 186 } |
| 193 | 187 |
| 194 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 188 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
| 195 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 189 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 196 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 190 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
| 197 } | 191 } |
| OLD | NEW |