Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: chrome/browser/ui/search/search_ipc_router_unittest.cc

Issue 657333002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return SearchTabHelper::FromWebContents(web_contents); 133 return SearchTabHelper::FromWebContents(web_contents);
134 } 134 }
135 135
136 void SetupMockDelegateAndPolicy() { 136 void SetupMockDelegateAndPolicy() {
137 content::WebContents* contents = web_contents(); 137 content::WebContents* contents = web_contents();
138 ASSERT_NE(static_cast<content::WebContents*>(NULL), contents); 138 ASSERT_NE(static_cast<content::WebContents*>(NULL), contents);
139 SearchTabHelper* search_tab_helper = GetSearchTabHelper(contents); 139 SearchTabHelper* search_tab_helper = GetSearchTabHelper(contents);
140 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); 140 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper);
141 search_tab_helper->ipc_router().set_delegate_for_testing(mock_delegate()); 141 search_tab_helper->ipc_router().set_delegate_for_testing(mock_delegate());
142 search_tab_helper->ipc_router().set_policy_for_testing( 142 search_tab_helper->ipc_router().set_policy_for_testing(
143 make_scoped_ptr(new MockSearchIPCRouterPolicy) 143 make_scoped_ptr(new MockSearchIPCRouterPolicy));
144 .PassAs<SearchIPCRouter::Policy>());
145 } 144 }
146 145
147 bool MessageWasSent(uint32 id) { 146 bool MessageWasSent(uint32 id) {
148 return process()->sink().GetFirstMessageMatching(id) != NULL; 147 return process()->sink().GetFirstMessageMatching(id) != NULL;
149 } 148 }
150 149
151 void VerifyDisplayInstantResultsMsg(bool expected_param_value) { 150 void VerifyDisplayInstantResultsMsg(bool expected_param_value) {
152 SetupMockDelegateAndPolicy(); 151 SetupMockDelegateAndPolicy();
153 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); 152 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
154 EXPECT_CALL(*policy, ShouldSendSetDisplayInstantResults()).Times(1) 153 EXPECT_CALL(*policy, ShouldSendSetDisplayInstantResults()).Times(1)
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); 903 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar"));
905 SetupMockDelegateAndPolicy(); 904 SetupMockDelegateAndPolicy();
906 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); 905 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
907 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) 906 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1)
908 .WillOnce(testing::Return(false)); 907 .WillOnce(testing::Return(false));
909 908
910 process()->sink().ClearMessages(); 909 process()->sink().ClearMessages();
911 GetSearchIPCRouter().ToggleVoiceSearch(); 910 GetSearchIPCRouter().ToggleVoiceSearch();
912 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); 911 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID));
913 } 912 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698