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 23 matching lines...) Expand all Loading... |
34 return search_tab_helper->ipc_router().policy_for_testing(); | 34 return search_tab_helper->ipc_router().policy_for_testing(); |
35 } | 35 } |
36 | 36 |
37 void SetIncognitoProfile() { | 37 void SetIncognitoProfile() { |
38 SearchIPCRouterPolicyImpl* policy = | 38 SearchIPCRouterPolicyImpl* policy = |
39 static_cast<SearchIPCRouterPolicyImpl*>(GetSearchIPCRouterPolicy()); | 39 static_cast<SearchIPCRouterPolicyImpl*>(GetSearchIPCRouterPolicy()); |
40 policy->set_is_incognito(true); | 40 policy->set_is_incognito(true); |
41 } | 41 } |
42 }; | 42 }; |
43 | 43 |
44 TEST_F(SearchIPCRouterPolicyTest, ProcessVoiceSearchSupportMsg) { | |
45 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | |
46 EXPECT_TRUE(GetSearchIPCRouterPolicy()-> | |
47 ShouldProcessSetVoiceSearchSupport()); | |
48 } | |
49 | |
50 TEST_F(SearchIPCRouterPolicyTest, ProcessFocusOmnibox) { | 44 TEST_F(SearchIPCRouterPolicyTest, ProcessFocusOmnibox) { |
51 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 45 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
52 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); | 46 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); |
53 } | 47 } |
54 | 48 |
55 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessFocusOmnibox) { | 49 TEST_F(SearchIPCRouterPolicyTest, DoNotProcessFocusOmnibox) { |
56 // Process message only if the underlying page is an InstantNTP. | 50 // Process message only if the underlying page is an InstantNTP. |
57 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 51 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
58 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); | 52 EXPECT_FALSE(GetSearchIPCRouterPolicy()->ShouldProcessFocusOmnibox(true)); |
59 } | 53 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 228 |
235 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 229 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
236 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 230 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
237 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 231 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
238 } | 232 } |
239 | 233 |
240 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { | 234 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { |
241 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 235 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
242 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); | 236 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); |
243 } | 237 } |
OLD | NEW |