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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void VerifyDisplayInstantResultsMsg(bool expected_param_value) { | 155 void VerifyDisplayInstantResultsMsg(bool expected_param_value) { |
156 SetupMockDelegateAndPolicy(); | 156 SetupMockDelegateAndPolicy(); |
157 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); | 157 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
158 EXPECT_CALL(*policy, ShouldSendSetDisplayInstantResults()).Times(1) | 158 EXPECT_CALL(*policy, ShouldSendSetDisplayInstantResults()).Times(1) |
159 .WillOnce(testing::Return(true)); | 159 .WillOnce(testing::Return(true)); |
160 | 160 |
161 GetSearchIPCRouter().SetDisplayInstantResults(); | 161 GetSearchIPCRouter().SetDisplayInstantResults(); |
162 const IPC::Message* message = process()->sink().GetFirstMessageMatching( | 162 const IPC::Message* message = process()->sink().GetFirstMessageMatching( |
163 ChromeViewMsg_SearchBoxSetDisplayInstantResults::ID); | 163 ChromeViewMsg_SearchBoxSetDisplayInstantResults::ID); |
164 EXPECT_NE(static_cast<const IPC::Message*>(NULL), message); | 164 EXPECT_NE(static_cast<const IPC::Message*>(NULL), message); |
165 Tuple<bool> display_instant_results_param; | 165 base::Tuple<bool> display_instant_results_param; |
166 ChromeViewMsg_SearchBoxSetDisplayInstantResults::Read( | 166 ChromeViewMsg_SearchBoxSetDisplayInstantResults::Read( |
167 message, &display_instant_results_param); | 167 message, &display_instant_results_param); |
168 EXPECT_EQ(expected_param_value, get<0>(display_instant_results_param)); | 168 EXPECT_EQ(expected_param_value, |
| 169 base::get<0>(display_instant_results_param)); |
169 } | 170 } |
170 | 171 |
171 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } | 172 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } |
172 | 173 |
173 MockSearchIPCRouterPolicy* GetSearchIPCRouterPolicy() { | 174 MockSearchIPCRouterPolicy* GetSearchIPCRouterPolicy() { |
174 content::WebContents* contents = web_contents(); | 175 content::WebContents* contents = web_contents(); |
175 EXPECT_NE(static_cast<content::WebContents*>(NULL), contents); | 176 EXPECT_NE(static_cast<content::WebContents*>(NULL), contents); |
176 SearchTabHelper* search_tab_helper = GetSearchTabHelper(contents); | 177 SearchTabHelper* search_tab_helper = GetSearchTabHelper(contents); |
177 EXPECT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 178 EXPECT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
178 return static_cast<MockSearchIPCRouterPolicy*>( | 179 return static_cast<MockSearchIPCRouterPolicy*>( |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 908 |
908 // Construct a series of synthetic messages for each valid IPC message type, | 909 // Construct a series of synthetic messages for each valid IPC message type, |
909 // ensuring the router ignores them all. | 910 // ensuring the router ignores them all. |
910 for (int i = 0; i < LastIPCMsgStart; ++i) { | 911 for (int i = 0; i < LastIPCMsgStart; ++i) { |
911 const int message_id = i << 16; | 912 const int message_id = i << 16; |
912 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); | 913 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); |
913 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); | 914 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); |
914 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; | 915 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; |
915 } | 916 } |
916 } | 917 } |
OLD | NEW |