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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 data.SetURL("http://foo.com/url?bar={searchTerms}"); | 107 data.SetURL("http://foo.com/url?bar={searchTerms}"); |
108 data.instant_url = "http://foo.com/instant?" | 108 data.instant_url = "http://foo.com/instant?" |
109 "{google:omniboxStartMarginParameter}foo=foo#foo=foo&espv"; | 109 "{google:omniboxStartMarginParameter}foo=foo#foo=foo&espv"; |
110 data.new_tab_url = "https://foo.com/newtab?espv"; | 110 data.new_tab_url = "https://foo.com/newtab?espv"; |
111 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); | 111 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); |
112 data.search_terms_replacement_key = "espv"; | 112 data.search_terms_replacement_key = "espv"; |
113 | 113 |
114 TemplateURL* template_url = new TemplateURL(profile(), data); | 114 TemplateURL* template_url = new TemplateURL(profile(), data); |
115 // Takes ownership of |template_url|. | 115 // Takes ownership of |template_url|. |
116 template_url_service->Add(template_url); | 116 template_url_service->Add(template_url); |
117 template_url_service->SetDefaultSearchProvider(template_url); | 117 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
118 process()->sink().ClearMessages(); | 118 process()->sink().ClearMessages(); |
119 } | 119 } |
120 | 120 |
121 content::WebContents* web_contents() { | 121 content::WebContents* web_contents() { |
122 return browser()->tab_strip_model()->GetActiveWebContents(); | 122 return browser()->tab_strip_model()->GetActiveWebContents(); |
123 } | 123 } |
124 | 124 |
125 content::MockRenderProcessHost* process() { | 125 content::MockRenderProcessHost* process() { |
126 return static_cast<content::MockRenderProcessHost*>( | 126 return static_cast<content::MockRenderProcessHost*>( |
127 web_contents()->GetRenderViewHost()->GetProcess()); | 127 web_contents()->GetRenderViewHost()->GetProcess()); |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 920 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
921 SetupMockDelegateAndPolicy(); | 921 SetupMockDelegateAndPolicy(); |
922 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); | 922 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
923 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) | 923 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) |
924 .WillOnce(testing::Return(false)); | 924 .WillOnce(testing::Return(false)); |
925 | 925 |
926 process()->sink().ClearMessages(); | 926 process()->sink().ClearMessages(); |
927 GetSearchIPCRouter().ToggleVoiceSearch(); | 927 GetSearchIPCRouter().ToggleVoiceSearch(); |
928 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 928 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
929 } | 929 } |
OLD | NEW |