| 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 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 content::WebContents* web_contents() { | 26 content::WebContents* web_contents() { |
| 27 return browser()->tab_strip_model()->GetActiveWebContents(); | 27 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 SearchIPCRouter::Policy* GetSearchIPCRouterPolicy() { | 30 SearchIPCRouter::Policy* GetSearchIPCRouterPolicy() { |
| 31 SearchTabHelper* search_tab_helper = | 31 SearchTabHelper* search_tab_helper = |
| 32 SearchTabHelper::FromWebContents(web_contents()); | 32 SearchTabHelper::FromWebContents(web_contents()); |
| 33 EXPECT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 33 EXPECT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 34 return search_tab_helper->ipc_router().policy(); | 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) { | 44 TEST_F(SearchIPCRouterPolicyTest, ProcessVoiceSearchSupportMsg) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 216 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
| 217 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 217 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 218 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 218 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { | 221 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { |
| 222 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 222 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 223 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); | 223 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); |
| 224 } | 224 } |
| OLD | NEW |