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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <tuple> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "content/common/p2p_messages.h" | 13 #include "content/common/p2p_messages.h" |
13 #include "ipc/ipc_sender.h" | 14 #include "ipc/ipc_sender.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "net/socket/stream_socket.h" | 16 #include "net/socket/stream_socket.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 const char kTestLocalIpAddress[] = "123.44.22.4"; | 20 const char kTestLocalIpAddress[] = "123.44.22.4"; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 MATCHER_P(MatchMessage, type, "") { | 103 MATCHER_P(MatchMessage, type, "") { |
103 return arg->type() == type; | 104 return arg->type() == type; |
104 } | 105 } |
105 | 106 |
106 MATCHER_P(MatchPacketMessage, packet_content, "") { | 107 MATCHER_P(MatchPacketMessage, packet_content, "") { |
107 if (arg->type() != P2PMsg_OnDataReceived::ID) | 108 if (arg->type() != P2PMsg_OnDataReceived::ID) |
108 return false; | 109 return false; |
109 P2PMsg_OnDataReceived::Param params; | 110 P2PMsg_OnDataReceived::Param params; |
110 P2PMsg_OnDataReceived::Read(arg, ¶ms); | 111 P2PMsg_OnDataReceived::Read(arg, ¶ms); |
111 return base::get<2>(params) == packet_content; | 112 return std::get<2>(params) == packet_content; |
112 } | 113 } |
113 | 114 |
114 MATCHER_P(MatchIncomingSocketMessage, address, "") { | 115 MATCHER_P(MatchIncomingSocketMessage, address, "") { |
115 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) | 116 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) |
116 return false; | 117 return false; |
117 P2PMsg_OnIncomingTcpConnection::Param params; | 118 P2PMsg_OnIncomingTcpConnection::Param params; |
118 P2PMsg_OnIncomingTcpConnection::Read( | 119 P2PMsg_OnIncomingTcpConnection::Read( |
119 arg, ¶ms); | 120 arg, ¶ms); |
120 return base::get<1>(params) == address; | 121 return std::get<1>(params) == address; |
121 } | 122 } |
122 | 123 |
123 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 124 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
OLD | NEW |