| 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 <tuple> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 int buf_len, | 51 int buf_len, |
| 52 const net::CompletionCallback& callback) override; | 52 const net::CompletionCallback& callback) override; |
| 53 int SetReceiveBufferSize(int32_t size) override; | 53 int SetReceiveBufferSize(int32_t size) override; |
| 54 int SetSendBufferSize(int32_t size) override; | 54 int SetSendBufferSize(int32_t size) override; |
| 55 int Connect(const net::CompletionCallback& callback) override; | 55 int Connect(const net::CompletionCallback& callback) override; |
| 56 void Disconnect() override; | 56 void Disconnect() override; |
| 57 bool IsConnected() const override; | 57 bool IsConnected() const override; |
| 58 bool IsConnectedAndIdle() const override; | 58 bool IsConnectedAndIdle() const override; |
| 59 int GetPeerAddress(net::IPEndPoint* address) const override; | 59 int GetPeerAddress(net::IPEndPoint* address) const override; |
| 60 int GetLocalAddress(net::IPEndPoint* address) const override; | 60 int GetLocalAddress(net::IPEndPoint* address) const override; |
| 61 const net::BoundNetLog& NetLog() const override; | 61 const net::NetLogWithSource& NetLog() const override; |
| 62 void SetSubresourceSpeculation() override; | 62 void SetSubresourceSpeculation() override; |
| 63 void SetOmniboxSpeculation() override; | 63 void SetOmniboxSpeculation() override; |
| 64 bool WasEverUsed() const override; | 64 bool WasEverUsed() const override; |
| 65 bool WasNpnNegotiated() const override; | 65 bool WasNpnNegotiated() const override; |
| 66 net::NextProto GetNegotiatedProtocol() const override; | 66 net::NextProto GetNegotiatedProtocol() const override; |
| 67 bool GetSSLInfo(net::SSLInfo* ssl_info) override; | 67 bool GetSSLInfo(net::SSLInfo* ssl_info) override; |
| 68 void GetConnectionAttempts(net::ConnectionAttempts* out) const override; | 68 void GetConnectionAttempts(net::ConnectionAttempts* out) const override; |
| 69 void ClearConnectionAttempts() override {} | 69 void ClearConnectionAttempts() override {} |
| 70 void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { | 70 void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { |
| 71 } | 71 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 std::string input_data_; | 83 std::string input_data_; |
| 84 int input_pos_; | 84 int input_pos_; |
| 85 | 85 |
| 86 std::string* written_data_; | 86 std::string* written_data_; |
| 87 bool async_write_; | 87 bool async_write_; |
| 88 bool write_pending_; | 88 bool write_pending_; |
| 89 | 89 |
| 90 net::IPEndPoint peer_address_; | 90 net::IPEndPoint peer_address_; |
| 91 net::IPEndPoint local_address_; | 91 net::IPEndPoint local_address_; |
| 92 | 92 |
| 93 net::BoundNetLog net_log_; | 93 net::NetLogWithSource net_log_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 void CreateRandomPacket(std::vector<char>* packet); | 96 void CreateRandomPacket(std::vector<char>* packet); |
| 97 void CreateStunRequest(std::vector<char>* packet); | 97 void CreateStunRequest(std::vector<char>* packet); |
| 98 void CreateStunResponse(std::vector<char>* packet); | 98 void CreateStunResponse(std::vector<char>* packet); |
| 99 void CreateStunError(std::vector<char>* packet); | 99 void CreateStunError(std::vector<char>* packet); |
| 100 | 100 |
| 101 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16_t port); | 101 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16_t port); |
| 102 | 102 |
| 103 MATCHER_P(MatchMessage, type, "") { | 103 MATCHER_P(MatchMessage, type, "") { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 115 MATCHER_P(MatchIncomingSocketMessage, address, "") { | 115 MATCHER_P(MatchIncomingSocketMessage, address, "") { |
| 116 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) | 116 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) |
| 117 return false; | 117 return false; |
| 118 P2PMsg_OnIncomingTcpConnection::Param params; | 118 P2PMsg_OnIncomingTcpConnection::Param params; |
| 119 P2PMsg_OnIncomingTcpConnection::Read( | 119 P2PMsg_OnIncomingTcpConnection::Read( |
| 120 arg, ¶ms); | 120 arg, ¶ms); |
| 121 return std::get<1>(params) == address; | 121 return std::get<1>(params) == address; |
| 122 } | 122 } |
| 123 | 123 |
| 124 #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 |