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

Unified Diff: net/quic/quic_http_stream_test.cc

Issue 467963002: Refactoring: Create per-connection packet writers in QuicDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto ToT 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 5e46258f2cbce5d46a4b131e3722ffcf0fdd7451..91cad75ef970b1759c62d27e91ed52d66475b508 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -58,12 +58,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) {
}
@@ -102,6 +102,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 {
@@ -201,10 +215,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_);
@@ -212,7 +226,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
session_.reset(
new QuicClientSession(connection_,
scoped_ptr<DatagramClientSocket>(socket),
- writer_.Pass(), NULL,
+ NULL,
&crypto_client_stream_factory_,
make_scoped_ptr((QuicServerInfo*)NULL),
QuicServerId(kServerHostname, kServerPort,
@@ -298,7 +312,6 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
scoped_ptr<QuicConnectionHelper> helper_;
testing::StrictMock<MockConnectionVisitor> visitor_;
scoped_ptr<QuicHttpStream> stream_;
- scoped_ptr<QuicDefaultPacketWriter> writer_;
scoped_ptr<QuicClientSession> session_;
QuicCryptoClientConfig crypto_config_;
TestCompletionCallback callback_;
« 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