Chromium Code Reviews| Index: content/browser/renderer_host/p2p/socket_host_test_utils.cc |
| diff --git a/content/browser/renderer_host/p2p/socket_host_test_utils.cc b/content/browser/renderer_host/p2p/socket_host_test_utils.cc |
| index 67c461a6b97c64a225ee47521d1ee01f5c366f99..9c3572f204dc5fce55fc56a49b8dafa54833b53e 100644 |
| --- a/content/browser/renderer_host/p2p/socket_host_test_utils.cc |
| +++ b/content/browser/renderer_host/p2p/socket_host_test_utils.cc |
| @@ -199,10 +199,29 @@ void CreateStunResponse(std::vector<char>* packet) { |
| CreateStunPacket(packet, kStunBindingResponse); |
| } |
| + |
| void CreateStunError(std::vector<char>* packet) { |
| CreateStunPacket(packet, kStunBindingError); |
| } |
| +void CreateRtpPacket(std::vector<char>* packet) { |
| + CreateRandomPacket(packet); // Minimum length is 20 bytes. |
| + *reinterpret_cast<uint8*>(&*packet->begin()) = 0x80; |
| + // Extension bit not set. |
| +} |
| + |
| +void CreateRtpPacketWithSendtimeExtension(std::vector<char>* packet, |
| + int extension_id) { |
| + CreateRandomPacket(packet); |
| + *reinterpret_cast<uint8*>(&*packet->begin()) = 0x81; |
| + *reinterpret_cast<uint16*>(&*packet->begin() + kRtpHeaderSize) = 0xBEDE; |
|
juberti2
2014/02/22 01:16:05
Need to use SetBE16 to get the right endianness
|
| + *reinterpret_cast<uint16*>(&*packet->begin() + kRtpHeaderSize + 2) = 1; |
| + *reinterpret_cast<uint8*>(&*packet->begin() + kRtpHeaderSize + 4) = |
| + (extension_id << 4) + 2; |
| +} |
| + |
| +void CreateTurn |
| + |
| net::IPEndPoint ParseAddress(const std::string ip_str, int port) { |
| net::IPAddressNumber ip; |
| EXPECT_TRUE(net::ParseIPLiteralToNumber(ip_str, &ip)); |