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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Process message only if the underlying page is an InstantNTP. | 106 // Process message only if the underlying page is an InstantNTP. |
107 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 107 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
108 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessChromeIdentityCheck()); | 108 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessChromeIdentityCheck()); |
109 } | 109 } |
110 | 110 |
111 TEST_F(SearchIPCRouterPolicyTest, ProcessNavigateToURL) { | 111 TEST_F(SearchIPCRouterPolicyTest, ProcessNavigateToURL) { |
112 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 112 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
113 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); | 113 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); |
114 } | 114 } |
115 | 115 |
| 116 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessNavigateToURL) { |
| 117 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 118 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); |
| 119 |
| 120 NavigateAndCommitActiveTab(GURL("file://foo/bar")); |
| 121 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); |
| 122 } |
| 123 |
116 TEST_F(SearchIPCRouterPolicyTest, ProcessPasteIntoOmniboxMsg) { | 124 TEST_F(SearchIPCRouterPolicyTest, ProcessPasteIntoOmniboxMsg) { |
117 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 125 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
118 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessPasteIntoOmnibox(true)); | 126 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessPasteIntoOmnibox(true)); |
119 } | 127 } |
120 | 128 |
121 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessPasteIntoOmniboxMsg) { | 129 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessPasteIntoOmniboxMsg) { |
122 // Process message only if the current tab is an Instant NTP. | 130 // Process message only if the current tab is an Instant NTP. |
123 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 131 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
124 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessPasteIntoOmnibox(true)); | 132 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessPasteIntoOmnibox(true)); |
125 } | 133 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 223 |
216 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 224 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
217 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 225 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
218 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 226 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
219 } | 227 } |
220 | 228 |
221 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { | 229 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { |
222 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 230 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
223 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); | 231 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); |
224 } | 232 } |
OLD | NEW |