OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 | 258 |
259 MATCHER_P(MatchMessage, type, "") { | 259 MATCHER_P(MatchMessage, type, "") { |
260 return arg->type() == type; | 260 return arg->type() == type; |
261 } | 261 } |
262 | 262 |
263 MATCHER_P(MatchPacketMessage, packet_content, "") { | 263 MATCHER_P(MatchPacketMessage, packet_content, "") { |
264 if (arg->type() != P2PMsg_OnDataReceived::ID) | 264 if (arg->type() != P2PMsg_OnDataReceived::ID) |
265 return false; | 265 return false; |
266 P2PMsg_OnDataReceived::Param params; | 266 P2PMsg_OnDataReceived::Param params; |
267 IPC::MessageWithTuple<P2PMsg_OnDataReceived::Param>::Read(arg, ¶ms); | 267 P2PMsg_OnDataReceived::Read(arg, ¶ms); |
268 return params.c == packet_content; | 268 return params.c == packet_content; |
269 } | 269 } |
270 | 270 |
271 MATCHER_P(MatchIncomingSocketMessage, address, "") { | 271 MATCHER_P(MatchIncomingSocketMessage, address, "") { |
272 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) | 272 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) |
273 return false; | 273 return false; |
274 P2PMsg_OnIncomingTcpConnection::Param params; | 274 P2PMsg_OnIncomingTcpConnection::Param params; |
275 IPC::MessageWithTuple<P2PMsg_OnIncomingTcpConnection::Param>::Read( | 275 P2PMsg_OnIncomingTcpConnection::Read( |
276 arg, ¶ms); | 276 arg, ¶ms); |
277 return params.b == address; | 277 return params.b == address; |
278 } | 278 } |
279 | 279 |
280 } // namespace | 280 } // namespace |
281 | 281 |
282 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 282 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
OLD | NEW |