Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Side by Side Diff: net/tools/quic/test_tools/quic_test_utils.h

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Common utilities for Quic tests 5 // Common utilities for Quic tests
6 6
7 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 7 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
8 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 8 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 21 matching lines...) Expand all
32 static const uint32 kInitialStreamFlowControlWindowForTest = 32 static const uint32 kInitialStreamFlowControlWindowForTest =
33 32 * 1024; // 32 KB 33 32 * 1024; // 32 KB
34 static const uint32 kInitialSessionFlowControlWindowForTest = 34 static const uint32 kInitialSessionFlowControlWindowForTest =
35 64 * 1024; // 64 KB 35 64 * 1024; // 64 KB
36 36
37 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| 37 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges|
38 // nack ranges of width 1 packet, starting from |least_unacked|. 38 // nack ranges of width 1 packet, starting from |least_unacked|.
39 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, 39 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges,
40 QuicPacketSequenceNumber least_unacked); 40 QuicPacketSequenceNumber least_unacked);
41 41
42 class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory {
43 public:
44 NiceMockPacketWriterFactory() {}
45 ~NiceMockPacketWriterFactory() override {}
46
47 QuicPacketWriter* Create(QuicConnection* /*connection*/) const override;
48
49 private:
50 DISALLOW_COPY_AND_ASSIGN(NiceMockPacketWriterFactory);
51 };
52
42 class MockConnection : public QuicConnection { 53 class MockConnection : public QuicConnection {
43 public: 54 public:
44 // Uses a MockHelper, ConnectionId of 42, and 127.0.0.1:123. 55 // Uses a MockHelper, ConnectionId of 42, and 127.0.0.1:123.
45 explicit MockConnection(bool is_server); 56 explicit MockConnection(bool is_server);
46 57
58 // Uses a MockHelper, ConnectionId of 42, and 127.0.0.1:123.
59 MockConnection(bool is_server, bool is_secure);
60
47 // Uses a MockHelper, ConnectionId of 42. 61 // Uses a MockHelper, ConnectionId of 42.
48 MockConnection(IPEndPoint address, bool is_server); 62 MockConnection(IPEndPoint address, bool is_server);
49 63
50 // Uses a MockHelper, and 127.0.0.1:123 64 // Uses a MockHelper, and 127.0.0.1:123
51 MockConnection(QuicConnectionId connection_id, bool is_server); 65 MockConnection(QuicConnectionId connection_id, bool is_server);
52 66
53 // Uses a Mock helper, ConnectionId of 42, and 127.0.0.1:123. 67 // Uses a Mock helper, ConnectionId of 42, and 127.0.0.1:123.
54 MockConnection(bool is_server, const QuicVersionVector& supported_versions); 68 MockConnection(bool is_server, const QuicVersionVector& supported_versions);
55 69
56 virtual ~MockConnection(); 70 virtual ~MockConnection();
(...skipping 19 matching lines...) Expand all
76 const std::string& reason)); 90 const std::string& reason));
77 MOCK_METHOD1(SendBlocked, void(QuicStreamId id)); 91 MOCK_METHOD1(SendBlocked, void(QuicStreamId id));
78 MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id, 92 MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id,
79 QuicStreamOffset byte_offset)); 93 QuicStreamOffset byte_offset));
80 MOCK_METHOD0(OnCanWrite, void()); 94 MOCK_METHOD0(OnCanWrite, void());
81 MOCK_CONST_METHOD0(HasPendingWrites, bool()); 95 MOCK_CONST_METHOD0(HasPendingWrites, bool());
82 96
83 void ReallyProcessUdpPacket(const IPEndPoint& self_address, 97 void ReallyProcessUdpPacket(const IPEndPoint& self_address,
84 const IPEndPoint& peer_address, 98 const IPEndPoint& peer_address,
85 const QuicEncryptedPacket& packet) { 99 const QuicEncryptedPacket& packet) {
86 return QuicConnection::ProcessUdpPacket(self_address, peer_address, packet); 100 QuicConnection::ProcessUdpPacket(self_address, peer_address, packet);
87 } 101 }
88 102
89 virtual bool OnProtocolVersionMismatch(QuicVersion version) { return false; } 103 virtual bool OnProtocolVersionMismatch(QuicVersion version) override {
104 return false;
105 }
90 106
91 private: 107 private:
92 scoped_ptr<QuicConnectionHelperInterface> helper_; 108 scoped_ptr<QuicConnectionHelperInterface> helper_;
93 109
94 DISALLOW_COPY_AND_ASSIGN(MockConnection); 110 DISALLOW_COPY_AND_ASSIGN(MockConnection);
95 }; 111 };
96 112
97 class TestSession : public QuicSession { 113 class TestSession : public QuicSession {
98 public: 114 public:
99 TestSession(QuicConnection* connection, const QuicConfig& config); 115 TestSession(QuicConnection* connection, const QuicConfig& config);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void Unregister(PerConnectionPacketWriter* writer); 213 void Unregister(PerConnectionPacketWriter* writer);
198 214
199 PerConnectionPacketWriter* current_writer_; 215 PerConnectionPacketWriter* current_writer_;
200 }; 216 };
201 217
202 } // namespace test 218 } // namespace test
203 } // namespace tools 219 } // namespace tools
204 } // namespace net 220 } // namespace net
205 221
206 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 222 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_time_wait_list_manager.cc ('k') | net/tools/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698