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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 MOCK_METHOD0(ShouldSendToggleVoiceSearch, bool()); | 84 MOCK_METHOD0(ShouldSendToggleVoiceSearch, bool()); |
85 MOCK_METHOD0(ShouldSubmitQuery, bool()); | 85 MOCK_METHOD0(ShouldSubmitQuery, bool()); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace | 88 } // namespace |
89 | 89 |
90 class SearchIPCRouterTest : public BrowserWithTestWindowTest { | 90 class SearchIPCRouterTest : public BrowserWithTestWindowTest { |
91 public: | 91 public: |
92 SearchIPCRouterTest() : field_trial_list_(NULL) {} | 92 SearchIPCRouterTest() : field_trial_list_(NULL) {} |
93 | 93 |
94 virtual void SetUp() { | 94 void SetUp() override { |
95 BrowserWithTestWindowTest::SetUp(); | 95 BrowserWithTestWindowTest::SetUp(); |
96 AddTab(browser(), GURL("chrome://blank")); | 96 AddTab(browser(), GURL("chrome://blank")); |
97 SearchTabHelper::CreateForWebContents(web_contents()); | 97 SearchTabHelper::CreateForWebContents(web_contents()); |
98 | 98 |
99 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 99 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
100 profile(), | 100 profile(), |
101 &TemplateURLServiceFactory::BuildInstanceFor); | 101 &TemplateURLServiceFactory::BuildInstanceFor); |
102 TemplateURLService* template_url_service = | 102 TemplateURLService* template_url_service = |
103 TemplateURLServiceFactory::GetForProfile(profile()); | 103 TemplateURLServiceFactory::GetForProfile(profile()); |
104 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); | 104 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 903 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
904 SetupMockDelegateAndPolicy(); | 904 SetupMockDelegateAndPolicy(); |
905 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); | 905 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
906 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) | 906 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) |
907 .WillOnce(testing::Return(false)); | 907 .WillOnce(testing::Return(false)); |
908 | 908 |
909 process()->sink().ClearMessages(); | 909 process()->sink().ClearMessages(); |
910 GetSearchIPCRouter().ToggleVoiceSearch(); | 910 GetSearchIPCRouter().ToggleVoiceSearch(); |
911 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 911 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
912 } | 912 } |
OLD | NEW |