Chromium Code Reviews| 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_P(MatchSendPacketMetrics, rtc_packet_id, "") { | |
| 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 (base::TimeTicks::Now() - std::get<1>(params).send_time) | |
| 134 .InMilliseconds() < 100; | |
|
Taylor_Brandstetter
2017/04/25 21:34:19
nit: Could you make the 100 milliseconds an argume
Sergey Ulanov
2017/04/26 00:11:52
+1. This test may be flaky. Also it currently does
Stefan
2017/04/26 09:02:39
Done.
| |
| 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 |