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

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

Issue 821453003: Update legacy Tuple-using code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void VerifyDisplayInstantResultsMsg(bool expected_param_value) { 153 void VerifyDisplayInstantResultsMsg(bool expected_param_value) {
154 SetupMockDelegateAndPolicy(); 154 SetupMockDelegateAndPolicy();
155 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); 155 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
156 EXPECT_CALL(*policy, ShouldSendSetDisplayInstantResults()).Times(1) 156 EXPECT_CALL(*policy, ShouldSendSetDisplayInstantResults()).Times(1)
157 .WillOnce(testing::Return(true)); 157 .WillOnce(testing::Return(true));
158 158
159 GetSearchIPCRouter().SetDisplayInstantResults(); 159 GetSearchIPCRouter().SetDisplayInstantResults();
160 const IPC::Message* message = process()->sink().GetFirstMessageMatching( 160 const IPC::Message* message = process()->sink().GetFirstMessageMatching(
161 ChromeViewMsg_SearchBoxSetDisplayInstantResults::ID); 161 ChromeViewMsg_SearchBoxSetDisplayInstantResults::ID);
162 EXPECT_NE(static_cast<const IPC::Message*>(NULL), message); 162 EXPECT_NE(static_cast<const IPC::Message*>(NULL), message);
163 Tuple1<bool> display_instant_results_param; 163 Tuple<bool> display_instant_results_param;
164 ChromeViewMsg_SearchBoxSetDisplayInstantResults::Read( 164 ChromeViewMsg_SearchBoxSetDisplayInstantResults::Read(
165 message, &display_instant_results_param); 165 message, &display_instant_results_param);
166 EXPECT_EQ(expected_param_value, display_instant_results_param.a); 166 EXPECT_EQ(expected_param_value, get<0>(display_instant_results_param));
167 } 167 }
168 168
169 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } 169 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; }
170 170
171 MockSearchIPCRouterPolicy* GetSearchIPCRouterPolicy() { 171 MockSearchIPCRouterPolicy* GetSearchIPCRouterPolicy() {
172 content::WebContents* contents = web_contents(); 172 content::WebContents* contents = web_contents();
173 EXPECT_NE(static_cast<content::WebContents*>(NULL), contents); 173 EXPECT_NE(static_cast<content::WebContents*>(NULL), contents);
174 SearchTabHelper* search_tab_helper = GetSearchTabHelper(contents); 174 SearchTabHelper* search_tab_helper = GetSearchTabHelper(contents);
175 EXPECT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); 175 EXPECT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper);
176 return static_cast<MockSearchIPCRouterPolicy*>( 176 return static_cast<MockSearchIPCRouterPolicy*>(
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 899
900 // Construct a series of synthetic messages for each valid IPC message type, 900 // Construct a series of synthetic messages for each valid IPC message type,
901 // ensuring the router ignores them all. 901 // ensuring the router ignores them all.
902 for (int i = 0; i < LastIPCMsgStart; ++i) { 902 for (int i = 0; i < LastIPCMsgStart; ++i) {
903 const int message_id = i << 16; 903 const int message_id = i << 16;
904 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); 904 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i);
905 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); 905 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW);
906 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; 906 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i;
907 } 907 }
908 } 908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698