| 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 <string> | 10 #include <string> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 MATCHER_P(MatchIncomingSocketMessage, address, "") { | 117 MATCHER_P(MatchIncomingSocketMessage, address, "") { |
| 118 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) | 118 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) |
| 119 return false; | 119 return false; |
| 120 P2PMsg_OnIncomingTcpConnection::Param params; | 120 P2PMsg_OnIncomingTcpConnection::Param params; |
| 121 P2PMsg_OnIncomingTcpConnection::Read( | 121 P2PMsg_OnIncomingTcpConnection::Read( |
| 122 arg, ¶ms); | 122 arg, ¶ms); |
| 123 return std::get<1>(params) == address; | 123 return std::get<1>(params) == address; |
| 124 } | 124 } |
| 125 | 125 |
| 126 MATCHER_P2(MatchSendPacketMetrics, rtc_packet_id, test_start_time, "") { |
| 127 if (arg->type() != P2PMsg_OnSendComplete::ID) |
| 128 return false; |
| 129 |
| 130 P2PMsg_OnSendComplete::Param params; |
| 131 P2PMsg_OnSendComplete::Read(arg, ¶ms); |
| 132 return std::get<1>(params).rtc_packet_id == rtc_packet_id && |
| 133 std::get<1>(params).send_time >= test_start_time && |
| 134 std::get<1>(params).send_time <= base::TimeTicks::Now(); |
| 135 } |
| 136 |
| 126 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 137 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
| OLD | NEW |