| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" | 8 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" |
| 9 #include "chrome/browser/ui/search/search_tab_helper.h" | 9 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 class SearchIPCRouterPolicyTest : public ChromeRenderViewHostTestHarness { | 15 class SearchIPCRouterPolicyTest : public ChromeRenderViewHostTestHarness { |
| 16 public: | 16 public: |
| 17 virtual void SetUp() { | 17 virtual void SetUp() { |
| 18 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 19 switches::kEnableInstantExtendedAPI); | |
| 20 ChromeRenderViewHostTestHarness::SetUp(); | 18 ChromeRenderViewHostTestHarness::SetUp(); |
| 21 SearchTabHelper::CreateForWebContents(web_contents()); | 19 SearchTabHelper::CreateForWebContents(web_contents()); |
| 22 } | 20 } |
| 23 }; | 21 }; |
| 24 | 22 |
| 25 TEST_F(SearchIPCRouterPolicyTest, ProcessVoiceSearchSupportMsg) { | 23 TEST_F(SearchIPCRouterPolicyTest, ProcessVoiceSearchSupportMsg) { |
| 26 NavigateAndCommit(GURL("chrome-search://foo/bar")); | 24 NavigateAndCommit(GURL("chrome-search://foo/bar")); |
| 27 SearchTabHelper* search_tab_helper = | 25 SearchTabHelper* search_tab_helper = |
| 28 SearchTabHelper::FromWebContents(web_contents()); | 26 SearchTabHelper::FromWebContents(web_contents()); |
| 29 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 27 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 SearchTabHelper* search_tab_helper = | 44 SearchTabHelper* search_tab_helper = |
| 47 SearchTabHelper::FromWebContents(web_contents()); | 45 SearchTabHelper::FromWebContents(web_contents()); |
| 48 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 46 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 49 SearchIPCRouterPolicyImpl* policy = | 47 SearchIPCRouterPolicyImpl* policy = |
| 50 static_cast<SearchIPCRouterPolicyImpl*>( | 48 static_cast<SearchIPCRouterPolicyImpl*>( |
| 51 search_tab_helper->ipc_router().policy()); | 49 search_tab_helper->ipc_router().policy()); |
| 52 policy->set_is_incognito(true); | 50 policy->set_is_incognito(true); |
| 53 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> | 51 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> |
| 54 ShouldSendSetDisplayInstantResults()); | 52 ShouldSendSetDisplayInstantResults()); |
| 55 } | 53 } |
| OLD | NEW |