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

Unified Diff: net/quic/quic_http_stream_test.cc

Issue 475113005: Refactoring: Create per-connection packet writers in QuicDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add new files to net/BUILD.gn Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_dispatcher.cc ('k') | net/quic/quic_per_connection_packet_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_http_stream_test.cc
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 932f566d4a525c7efbc299e83188c6fc7177028a..269752ad1c2bc7d71d403891ee84d3cb14864778 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -59,12 +59,12 @@ class TestQuicConnection : public QuicConnection {
QuicConnectionId connection_id,
IPEndPoint address,
QuicConnectionHelper* helper,
- QuicPacketWriter* writer)
+ const QuicConnection::PacketWriterFactory& writer_factory)
: QuicConnection(connection_id,
address,
helper,
- writer,
- false /* owns_writer */,
+ writer_factory,
+ true /* owns_writer */,
false /* is_server */,
versions) {
}
@@ -103,6 +103,20 @@ class AutoClosingStream : public QuicHttpStream {
}
};
+class TestPacketWriterFactory : public QuicConnection::PacketWriterFactory {
+ public:
+ explicit TestPacketWriterFactory(DatagramClientSocket* socket)
+ : socket_(socket) {}
+ virtual ~TestPacketWriterFactory() {}
+
+ virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE {
+ return new QuicDefaultPacketWriter(socket_);
+ }
+
+ private:
+ DatagramClientSocket* socket_;
+};
+
} // namespace
class QuicHttpStreamPeer {
@@ -202,10 +216,10 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber());
helper_.reset(new QuicConnectionHelper(runner_.get(), &clock_,
&random_generator_));
- writer_.reset(new QuicDefaultPacketWriter(socket));
+ TestPacketWriterFactory writer_factory(socket);
connection_ = new TestQuicConnection(SupportedVersions(GetParam()),
connection_id_, peer_addr_,
- helper_.get(), writer_.get());
+ helper_.get(), writer_factory);
connection_->set_visitor(&visitor_);
connection_->SetSendAlgorithm(send_algorithm_);
connection_->SetReceiveAlgorithm(receive_algorithm_);
@@ -213,7 +227,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
session_.reset(
new QuicClientSession(connection_,
scoped_ptr<DatagramClientSocket>(socket),
- writer_.Pass(), NULL,
+ NULL,
&crypto_client_stream_factory_,
&transport_security_state_,
make_scoped_ptr((QuicServerInfo*)NULL),
@@ -300,7 +314,6 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
scoped_ptr<QuicConnectionHelper> helper_;
testing::StrictMock<MockConnectionVisitor> visitor_;
scoped_ptr<QuicHttpStream> stream_;
- scoped_ptr<QuicDefaultPacketWriter> writer_;
TransportSecurityState transport_security_state_;
scoped_ptr<QuicClientSession> session_;
QuicCryptoClientConfig crypto_config_;
« no previous file with comments | « net/quic/quic_dispatcher.cc ('k') | net/quic/quic_per_connection_packet_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698