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

Unified Diff: net/quic/test_tools/quic_test_utils.cc

Issue 1905843003: Split out QuicAlarm creation from QuicConnectionHelper to new QuicAlarmFactory. No behavior change,… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119753783
Patch Set: Rebase Created 4 years, 8 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/test_tools/quic_test_utils.h ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/quic_test_utils.cc
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index c6cae977958fc927189ce2d894df256c881943ef..c9b81de0c8029230dc92c5d07fe5991766e72b6a 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -201,18 +201,18 @@ QuicRandom* MockConnectionHelper::GetRandomGenerator() {
return &random_generator_;
}
-QuicAlarm* MockConnectionHelper::CreateAlarm(QuicAlarm::Delegate* delegate) {
- return new MockConnectionHelper::TestAlarm(
+QuicAlarm* MockAlarmFactory::CreateAlarm(QuicAlarm::Delegate* delegate) {
+ return new MockAlarmFactory::TestAlarm(
QuicArenaScopedPtr<QuicAlarm::Delegate>(delegate));
}
-QuicArenaScopedPtr<QuicAlarm> MockConnectionHelper::CreateAlarm(
+QuicArenaScopedPtr<QuicAlarm> MockAlarmFactory::CreateAlarm(
QuicArenaScopedPtr<QuicAlarm::Delegate> delegate,
QuicConnectionArena* arena) {
if (arena != nullptr) {
- return arena->New<MockConnectionHelper::TestAlarm>(std::move(delegate));
+ return arena->New<MockAlarmFactory::TestAlarm>(std::move(delegate));
} else {
- return QuicArenaScopedPtr<MockConnectionHelper::TestAlarm>(
+ return QuicArenaScopedPtr<MockAlarmFactory::TestAlarm>(
new TestAlarm(std::move(delegate)));
}
}
@@ -226,48 +226,58 @@ void MockConnectionHelper::AdvanceTime(QuicTime::Delta delta) {
}
MockConnection::MockConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective)
: MockConnection(kTestConnectionId,
IPEndPoint(TestPeerIPAddress(), kTestPort),
helper,
+ alarm_factory,
perspective,
QuicSupportedVersions()) {}
MockConnection::MockConnection(IPEndPoint address,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective)
: MockConnection(kTestConnectionId,
address,
helper,
+ alarm_factory,
perspective,
QuicSupportedVersions()) {}
MockConnection::MockConnection(QuicConnectionId connection_id,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective)
: MockConnection(connection_id,
IPEndPoint(TestPeerIPAddress(), kTestPort),
helper,
+ alarm_factory,
perspective,
QuicSupportedVersions()) {}
MockConnection::MockConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective,
const QuicVersionVector& supported_versions)
: MockConnection(kTestConnectionId,
IPEndPoint(TestPeerIPAddress(), kTestPort),
helper,
+ alarm_factory,
perspective,
supported_versions) {}
MockConnection::MockConnection(QuicConnectionId connection_id,
IPEndPoint address,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective,
const QuicVersionVector& supported_versions)
: QuicConnection(connection_id,
address,
helper,
+ alarm_factory,
new testing::NiceMock<MockPacketWriter>(),
/* owns_writer= */ true,
perspective,
@@ -284,14 +294,16 @@ void MockConnection::AdvanceTime(QuicTime::Delta delta) {
}
PacketSavingConnection::PacketSavingConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective)
- : MockConnection(helper, perspective) {}
+ : MockConnection(helper, alarm_factory, perspective) {}
PacketSavingConnection::PacketSavingConnection(
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective,
const QuicVersionVector& supported_versions)
- : MockConnection(helper, perspective, supported_versions) {}
+ : MockConnection(helper, alarm_factory, perspective, supported_versions) {}
PacketSavingConnection::~PacketSavingConnection() {
STLDeleteElements(&encrypted_packets_);
@@ -761,6 +773,7 @@ void CreateClientSessionForTest(QuicServerId server_id,
QuicTime::Delta connection_start_time,
QuicVersionVector supported_versions,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
QuicCryptoClientConfig* crypto_client_config,
PacketSavingConnection** client_connection,
TestQuicSpdyClientSession** client_session) {
@@ -775,7 +788,7 @@ void CreateClientSessionForTest(QuicServerId server_id,
? DefaultQuicConfigStatelessRejects()
: DefaultQuicConfig();
*client_connection = new PacketSavingConnection(
- helper, Perspective::IS_CLIENT, supported_versions);
+ helper, alarm_factory, Perspective::IS_CLIENT, supported_versions);
*client_session = new TestQuicSpdyClientSession(
*client_connection, config, server_id, crypto_client_config);
(*client_connection)->AdvanceTime(connection_start_time);
@@ -786,6 +799,7 @@ void CreateServerSessionForTest(
QuicTime::Delta connection_start_time,
QuicVersionVector supported_versions,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
QuicCryptoServerConfig* server_crypto_config,
QuicCompressedCertsCache* compressed_certs_cache,
PacketSavingConnection** server_connection,
@@ -798,7 +812,7 @@ void CreateServerSessionForTest(
<< "strike-register will be unhappy.";
*server_connection = new PacketSavingConnection(
- helper, Perspective::IS_SERVER, supported_versions);
+ helper, alarm_factory, Perspective::IS_SERVER, supported_versions);
*server_session = new TestQuicSpdyServerSession(
*server_connection, DefaultQuicConfig(), server_crypto_config,
compressed_certs_cache);
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698