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 NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "net/quic/quic_connection.h" | 11 #include "net/quic/quic_connection.h" |
| 12 #include "net/quic/quic_session.h" |
12 #include "net/quic/quic_spdy_decompressor.h" | 13 #include "net/quic/quic_spdy_decompressor.h" |
13 #include "net/spdy/spdy_framer.h" | 14 #include "net/spdy/spdy_framer.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 class EpollServer; | 19 class EpollServer; |
19 class IPEndPoint; | 20 class IPEndPoint; |
20 | 21 |
21 namespace tools { | 22 namespace tools { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 QuicStreamId last_good_stream_id, | 56 QuicStreamId last_good_stream_id, |
56 const std::string& reason)); | 57 const std::string& reason)); |
57 MOCK_METHOD0(OnCanWrite, bool()); | 58 MOCK_METHOD0(OnCanWrite, bool()); |
58 | 59 |
59 void ReallyProcessUdpPacket(const IPEndPoint& self_address, | 60 void ReallyProcessUdpPacket(const IPEndPoint& self_address, |
60 const IPEndPoint& peer_address, | 61 const IPEndPoint& peer_address, |
61 const QuicEncryptedPacket& packet) { | 62 const QuicEncryptedPacket& packet) { |
62 return QuicConnection::ProcessUdpPacket(self_address, peer_address, packet); | 63 return QuicConnection::ProcessUdpPacket(self_address, peer_address, packet); |
63 } | 64 } |
64 | 65 |
65 virtual bool OnProtocolVersionMismatch(QuicVersionTag version) { | 66 virtual bool OnProtocolVersionMismatch(QuicTag version) { return false; } |
66 return false; | |
67 } | |
68 | 67 |
69 private: | 68 private: |
70 const bool has_mock_helper_; | 69 const bool has_mock_helper_; |
71 | 70 |
72 DISALLOW_COPY_AND_ASSIGN(MockConnection); | 71 DISALLOW_COPY_AND_ASSIGN(MockConnection); |
73 }; | 72 }; |
74 | 73 |
75 class TestDecompressorVisitor : public QuicSpdyDecompressor::Visitor { | 74 class TestDecompressorVisitor : public QuicSpdyDecompressor::Visitor { |
76 public: | 75 public: |
77 virtual ~TestDecompressorVisitor() {} | 76 virtual ~TestDecompressorVisitor() {} |
78 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; | 77 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; |
79 | 78 |
80 std::string data() { return data_; } | 79 std::string data() { return data_; } |
81 | 80 |
82 private: | 81 private: |
83 std::string data_; | 82 std::string data_; |
84 }; | 83 }; |
85 | 84 |
| 85 class TestSession : public QuicSession { |
| 86 public: |
| 87 TestSession(QuicConnection* connection, bool is_server); |
| 88 virtual ~TestSession(); |
| 89 |
| 90 MOCK_METHOD1(CreateIncomingReliableStream, |
| 91 ReliableQuicStream*(QuicStreamId id)); |
| 92 MOCK_METHOD0(CreateOutgoingReliableStream, ReliableQuicStream*()); |
| 93 |
| 94 void SetCryptoStream(QuicCryptoStream* stream); |
| 95 |
| 96 virtual QuicCryptoStream* GetCryptoStream(); |
| 97 |
| 98 private: |
| 99 QuicCryptoStream* crypto_stream_; |
| 100 DISALLOW_COPY_AND_ASSIGN(TestSession); |
| 101 }; |
| 102 |
86 } // namespace test | 103 } // namespace test |
87 } // namespace tools | 104 } // namespace tools |
88 } // namespace net | 105 } // namespace net |
89 | 106 |
90 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 107 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |