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

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

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_connection_peer.cc ('k') | net/quic/test_tools/quic_test_utils.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.h
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h
index a2cf2ffbcdf62badeb276f14d482d28ac789ff87..1ef96b692deca828a5fd38680d2bae289ff53eb3 100644
--- a/net/quic/test_tools/quic_test_utils.h
+++ b/net/quic/test_tools/quic_test_utils.h
@@ -320,12 +320,23 @@ class MockConnectionHelper : public QuicConnectionHelperInterface {
~MockConnectionHelper() override;
const QuicClock* GetClock() const override;
QuicRandom* GetRandomGenerator() override;
+ QuicBufferAllocator* GetBufferAllocator() override;
+ void AdvanceTime(QuicTime::Delta delta);
+
+ private:
+ MockClock clock_;
+ MockRandom random_generator_;
+ SimpleBufferAllocator buffer_allocator_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper);
+};
+
+class MockAlarmFactory : public QuicAlarmFactory {
+ public:
QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override;
QuicArenaScopedPtr<QuicAlarm> CreateAlarm(
QuicArenaScopedPtr<QuicAlarm::Delegate> delegate,
QuicConnectionArena* arena) override;
- QuicBufferAllocator* GetBufferAllocator() override;
- void AdvanceTime(QuicTime::Delta delta);
// No-op alarm implementation
class TestAlarm : public QuicAlarm {
@@ -342,38 +353,37 @@ class MockConnectionHelper : public QuicConnectionHelperInterface {
void FireAlarm(QuicAlarm* alarm) {
reinterpret_cast<TestAlarm*>(alarm)->Fire();
}
-
- private:
- MockClock clock_;
- MockRandom random_generator_;
- SimpleBufferAllocator buffer_allocator_;
-
- DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper);
};
class MockConnection : public QuicConnection {
public:
// Uses a ConnectionId of 42 and 127.0.0.1:123.
- MockConnection(MockConnectionHelper* helper, Perspective perspective);
+ MockConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
+ Perspective perspective);
// Uses a ConnectionId of 42.
MockConnection(IPEndPoint address,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective);
// Uses 127.0.0.1:123.
MockConnection(QuicConnectionId connection_id,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective);
// Uses a ConnectionId of 42, and 127.0.0.1:123.
MockConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective,
const QuicVersionVector& supported_versions);
MockConnection(QuicConnectionId connection_id,
IPEndPoint address,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective,
const QuicVersionVector& supported_versions);
@@ -437,9 +447,12 @@ class MockConnection : public QuicConnection {
class PacketSavingConnection : public MockConnection {
public:
- PacketSavingConnection(MockConnectionHelper* helper, Perspective perspective);
+ PacketSavingConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
+ Perspective perspective);
PacketSavingConnection(MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
Perspective perspective,
const QuicVersionVector& supported_versions);
@@ -803,6 +816,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);
@@ -827,6 +841,7 @@ void CreateServerSessionForTest(
QuicTime::Delta connection_start_time,
QuicVersionVector supported_versions,
MockConnectionHelper* helper,
+ MockAlarmFactory* alarm_factory,
QuicCryptoServerConfig* crypto_server_config,
QuicCompressedCertsCache* compressed_certs_cache,
PacketSavingConnection** server_connection,
« no previous file with comments | « net/quic/test_tools/quic_connection_peer.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698