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" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "chrome/test/base/browser_with_test_window_test.h" | 14 #include "chrome/test/base/browser_with_test_window_test.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 class SearchIPCRouterPolicyTest : public BrowserWithTestWindowTest { | 18 class SearchIPCRouterPolicyTest : public BrowserWithTestWindowTest { |
19 public: | 19 public: |
20 virtual void SetUp() { | 20 virtual void SetUp() { |
21 CommandLine::ForCurrentProcess()->AppendSwitch( | |
22 switches::kEnableInstantExtendedAPI); | |
23 BrowserWithTestWindowTest::SetUp(); | 21 BrowserWithTestWindowTest::SetUp(); |
24 AddTab(browser(), GURL("chrome://blank")); | 22 AddTab(browser(), GURL("chrome://blank")); |
25 SearchTabHelper::CreateForWebContents(web_contents()); | 23 SearchTabHelper::CreateForWebContents(web_contents()); |
26 } | 24 } |
27 | 25 |
28 content::WebContents* web_contents() { | 26 content::WebContents* web_contents() { |
29 return browser()->tab_strip_model()->GetActiveWebContents(); | 27 return browser()->tab_strip_model()->GetActiveWebContents(); |
30 } | 28 } |
31 | 29 |
32 SearchIPCRouter::Policy* GetSearchIPCRouterPolicy() { | 30 SearchIPCRouter::Policy* GetSearchIPCRouterPolicy() { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 206 |
209 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 207 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
210 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 208 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
211 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 209 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
212 } | 210 } |
213 | 211 |
214 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { | 212 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { |
215 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 213 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
216 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); | 214 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); |
217 } | 215 } |
OLD | NEW |