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 "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
11 #include "content/common/p2p_messages.h" | 11 #include "content/common/p2p_messages.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_sender.h" |
13 #include "ipc/ipc_message_utils.h" | 13 #include "ipc/ipc_message_utils.h" |
14 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/socket/stream_socket.h" | 18 #include "net/socket/stream_socket.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 const char kTestLocalIpAddress[] = "123.44.22.4"; | 24 const char kTestLocalIpAddress[] = "123.44.22.4"; |
25 const char kTestIpAddress1[] = "123.44.22.31"; | 25 const char kTestIpAddress1[] = "123.44.22.31"; |
26 const int kTestPort1 = 234; | 26 const int kTestPort1 = 234; |
27 const char kTestIpAddress2[] = "133.11.22.33"; | 27 const char kTestIpAddress2[] = "133.11.22.33"; |
28 const int kTestPort2 = 543; | 28 const int kTestPort2 = 543; |
29 | 29 |
30 const int kStunHeaderSize = 20; | 30 const int kStunHeaderSize = 20; |
31 const uint16 kStunBindingRequest = 0x0001; | 31 const uint16 kStunBindingRequest = 0x0001; |
32 const uint16 kStunBindingResponse = 0x0102; | 32 const uint16 kStunBindingResponse = 0x0102; |
33 const uint16 kStunBindingError = 0x0111; | 33 const uint16 kStunBindingError = 0x0111; |
34 const uint32 kStunMagicCookie = 0x2112A442; | 34 const uint32 kStunMagicCookie = 0x2112A442; |
35 | 35 |
36 class MockIPCSender : public IPC::Message::Sender { | 36 class MockIPCSender : public IPC::Sender { |
37 public: | 37 public: |
38 MockIPCSender(); | 38 MockIPCSender(); |
39 virtual ~MockIPCSender(); | 39 virtual ~MockIPCSender(); |
40 | 40 |
41 MOCK_METHOD1(Send, bool(IPC::Message* msg)); | 41 MOCK_METHOD1(Send, bool(IPC::Message* msg)); |
42 }; | 42 }; |
43 | 43 |
44 MockIPCSender::MockIPCSender() { } | 44 MockIPCSender::MockIPCSender() { } |
45 MockIPCSender::~MockIPCSender() { } | 45 MockIPCSender::~MockIPCSender() { } |
46 | 46 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 return false; | 278 return false; |
279 P2PMsg_OnIncomingTcpConnection::Param params; | 279 P2PMsg_OnIncomingTcpConnection::Param params; |
280 P2PMsg_OnIncomingTcpConnection::Read( | 280 P2PMsg_OnIncomingTcpConnection::Read( |
281 arg, ¶ms); | 281 arg, ¶ms); |
282 return params.b == address; | 282 return params.b == address; |
283 } | 283 } |
284 | 284 |
285 } // namespace | 285 } // namespace |
286 | 286 |
287 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 287 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
OLD | NEW |