OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/renderer_host/p2p/socket_host_test_utils.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 14 #include "net/base/ip_address.h" |
14 | 15 |
15 const int kStunHeaderSize = 20; | 16 const int kStunHeaderSize = 20; |
16 const uint16_t kStunBindingRequest = 0x0001; | 17 const uint16_t kStunBindingRequest = 0x0001; |
17 const uint16_t kStunBindingResponse = 0x0102; | 18 const uint16_t kStunBindingResponse = 0x0102; |
18 const uint16_t kStunBindingError = 0x0111; | 19 const uint16_t kStunBindingError = 0x0111; |
19 const uint32_t kStunMagicCookie = 0x2112A442; | 20 const uint32_t kStunMagicCookie = 0x2112A442; |
20 | 21 |
21 MockIPCSender::MockIPCSender() { } | 22 MockIPCSender::MockIPCSender() { } |
22 MockIPCSender::~MockIPCSender() { } | 23 MockIPCSender::~MockIPCSender() { } |
23 | 24 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 207 |
207 void CreateStunResponse(std::vector<char>* packet) { | 208 void CreateStunResponse(std::vector<char>* packet) { |
208 CreateStunPacket(packet, kStunBindingResponse); | 209 CreateStunPacket(packet, kStunBindingResponse); |
209 } | 210 } |
210 | 211 |
211 void CreateStunError(std::vector<char>* packet) { | 212 void CreateStunError(std::vector<char>* packet) { |
212 CreateStunPacket(packet, kStunBindingError); | 213 CreateStunPacket(packet, kStunBindingError); |
213 } | 214 } |
214 | 215 |
215 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16_t port) { | 216 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16_t port) { |
216 net::IPAddressNumber ip; | 217 net::IPAddress ip; |
217 EXPECT_TRUE(net::ParseIPLiteralToNumber(ip_str, &ip)); | 218 EXPECT_TRUE(ip.AssignFromIPLiteral(ip_str)); |
218 return net::IPEndPoint(ip, port); | 219 return net::IPEndPoint(ip, port); |
219 } | 220 } |
OLD | NEW |