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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 101 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
102 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessChromeIdentityCheck()); | 102 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessChromeIdentityCheck()); |
103 } | 103 } |
104 | 104 |
105 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessChromeIdentityCheck) { | 105 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessChromeIdentityCheck) { |
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, ProcessHistorySyncCheck) { |
| 112 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 113 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessHistorySyncCheck()); |
| 114 } |
| 115 |
| 116 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessHistorySyncCheck) { |
| 117 // Process message only if the underlying page is an InstantNTP. |
| 118 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 119 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessHistorySyncCheck()); |
| 120 } |
| 121 |
111 TEST_F(SearchIPCRouterPolicyTest, ProcessNavigateToURL) { | 122 TEST_F(SearchIPCRouterPolicyTest, ProcessNavigateToURL) { |
112 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 123 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
113 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); | 124 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); |
114 } | 125 } |
115 | 126 |
116 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessNavigateToURL) { | 127 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessNavigateToURL) { |
117 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 128 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
118 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); | 129 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessNavigateToURL(true)); |
119 | 130 |
120 NavigateAndCommitActiveTab(GURL("file://foo/bar")); | 131 NavigateAndCommitActiveTab(GURL("file://foo/bar")); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 234 |
224 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 235 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
225 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 236 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
226 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 237 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
227 } | 238 } |
228 | 239 |
229 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { | 240 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { |
230 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 241 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
231 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); | 242 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); |
232 } | 243 } |
OLD | NEW |