| 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 void SetUp() override { |
| 21 BrowserWithTestWindowTest::SetUp(); | 21 BrowserWithTestWindowTest::SetUp(); |
| 22 AddTab(browser(), GURL("chrome://blank")); | 22 AddTab(browser(), GURL("chrome://blank")); |
| 23 SearchTabHelper::CreateForWebContents(web_contents()); | 23 SearchTabHelper::CreateForWebContents(web_contents()); |
| 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() { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { | 224 TEST_F(SearchIPCRouterPolicyTest, SubmitQuery) { |
| 225 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 225 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
| 226 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); | 226 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSubmitQuery()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { | 229 TEST_F(SearchIPCRouterPolicyTest, SendToggleVoiceSearch) { |
| 230 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 230 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 231 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); | 231 EXPECT_TRUE(GetSearchIPCRouterPolicy()->ShouldSendToggleVoiceSearch()); |
| 232 } | 232 } |
| OLD | NEW |