OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 net::IPEndPoint local_address_; | 82 net::IPEndPoint local_address_; |
83 | 83 |
84 net::BoundNetLog net_log_; | 84 net::BoundNetLog net_log_; |
85 }; | 85 }; |
86 | 86 |
87 void CreateRandomPacket(std::vector<char>* packet); | 87 void CreateRandomPacket(std::vector<char>* packet); |
88 void CreateStunRequest(std::vector<char>* packet); | 88 void CreateStunRequest(std::vector<char>* packet); |
89 void CreateStunResponse(std::vector<char>* packet); | 89 void CreateStunResponse(std::vector<char>* packet); |
90 void CreateStunError(std::vector<char>* packet); | 90 void CreateStunError(std::vector<char>* packet); |
91 | 91 |
| 92 void CreateRtpPacket(std::vector<char>* packet); |
| 93 void CreateRtpPacketWithSendtimeExtension(std::vector<char>* packet, |
| 94 int extension_id); |
| 95 void CreateTurnChannelData(std::vector<char>* packet); |
| 96 |
92 net::IPEndPoint ParseAddress(const std::string ip_str, int port); | 97 net::IPEndPoint ParseAddress(const std::string ip_str, int port); |
93 | 98 |
94 MATCHER_P(MatchMessage, type, "") { | 99 MATCHER_P(MatchMessage, type, "") { |
95 return arg->type() == type; | 100 return arg->type() == type; |
96 } | 101 } |
97 | 102 |
98 MATCHER_P(MatchPacketMessage, packet_content, "") { | 103 MATCHER_P(MatchPacketMessage, packet_content, "") { |
99 if (arg->type() != P2PMsg_OnDataReceived::ID) | 104 if (arg->type() != P2PMsg_OnDataReceived::ID) |
100 return false; | 105 return false; |
101 P2PMsg_OnDataReceived::Param params; | 106 P2PMsg_OnDataReceived::Param params; |
102 P2PMsg_OnDataReceived::Read(arg, ¶ms); | 107 P2PMsg_OnDataReceived::Read(arg, ¶ms); |
103 return params.c == packet_content; | 108 return params.c == packet_content; |
104 } | 109 } |
105 | 110 |
106 MATCHER_P(MatchIncomingSocketMessage, address, "") { | 111 MATCHER_P(MatchIncomingSocketMessage, address, "") { |
107 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) | 112 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) |
108 return false; | 113 return false; |
109 P2PMsg_OnIncomingTcpConnection::Param params; | 114 P2PMsg_OnIncomingTcpConnection::Param params; |
110 P2PMsg_OnIncomingTcpConnection::Read( | 115 P2PMsg_OnIncomingTcpConnection::Read( |
111 arg, ¶ms); | 116 arg, ¶ms); |
112 return params.b == address; | 117 return params.b == address; |
113 } | 118 } |
114 | 119 |
115 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 120 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
OLD | NEW |