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

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

Issue 115463002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 4de2cadd2e5b6367297fcafc822f6d682b686a16..d85f92fa07ee3f03dac41102bae5c1f708ce5bcc 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -231,40 +231,46 @@ void MockHelper::AdvanceTime(QuicTime::Delta delta) {
clock_.AdvanceTime(delta);
}
-MockConnection::MockConnection(QuicGuid guid,
- IPEndPoint address,
+MockConnection::MockConnection(bool is_server)
+ : QuicConnection(kTestGuid,
+ IPEndPoint(Loopback4(), kTestPort),
+ new testing::NiceMock<MockHelper>(),
+ new testing::NiceMock<MockPacketWriter>(),
+ is_server, QuicSupportedVersions()),
+ writer_(QuicConnectionPeer::GetWriter(this)),
+ helper_(helper()) {
+}
+
+MockConnection::MockConnection(IPEndPoint address,
bool is_server)
- : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(),
+ : QuicConnection(kTestGuid, address,
+ new testing::NiceMock<MockHelper>(),
new testing::NiceMock<MockPacketWriter>(),
is_server, QuicSupportedVersions()),
- has_mock_helper_(true),
writer_(QuicConnectionPeer::GetWriter(this)),
helper_(helper()) {
}
MockConnection::MockConnection(QuicGuid guid,
- IPEndPoint address,
- QuicConnectionHelperInterface* helper,
- QuicPacketWriter* writer,
bool is_server)
- : QuicConnection(guid, address, helper, writer, is_server,
- QuicSupportedVersions()),
- has_mock_helper_(false) {
+ : QuicConnection(guid,
+ IPEndPoint(Loopback4(), kTestPort),
+ new testing::NiceMock<MockHelper>(),
+ new testing::NiceMock<MockPacketWriter>(),
+ is_server, QuicSupportedVersions()),
+ writer_(QuicConnectionPeer::GetWriter(this)),
+ helper_(helper()) {
}
MockConnection::~MockConnection() {
}
void MockConnection::AdvanceTime(QuicTime::Delta delta) {
- CHECK(has_mock_helper_) << "Cannot advance time unless a MockClock is being"
- " used";
static_cast<MockHelper*>(helper())->AdvanceTime(delta);
}
-PacketSavingConnection::PacketSavingConnection(QuicGuid guid,
- IPEndPoint address,
- bool is_server)
- : MockConnection(guid, address, is_server) {
+PacketSavingConnection::PacketSavingConnection(bool is_server)
+ : MockConnection(is_server) {
}
PacketSavingConnection::~PacketSavingConnection() {
@@ -283,8 +289,8 @@ bool PacketSavingConnection::SendOrQueuePacket(
return true;
}
-MockSession::MockSession(QuicConnection* connection, bool is_server)
- : QuicSession(connection, DefaultQuicConfig(), is_server) {
+MockSession::MockSession(QuicConnection* connection)
+ : QuicSession(connection, DefaultQuicConfig()) {
ON_CALL(*this, WritevData(_, _, _, _, _, _))
.WillByDefault(testing::Return(QuicConsumedData(0, false)));
}
@@ -293,9 +299,8 @@ MockSession::~MockSession() {
}
TestSession::TestSession(QuicConnection* connection,
- const QuicConfig& config,
- bool is_server)
- : QuicSession(connection, config, is_server),
+ const QuicConfig& config)
+ : QuicSession(connection, config),
crypto_stream_(NULL) {
}
@@ -372,6 +377,12 @@ QuicVersion QuicVersionMax() { return QuicSupportedVersions().front(); }
QuicVersion QuicVersionMin() { return QuicSupportedVersions().back(); }
+IPAddressNumber Loopback4() {
+ net::IPAddressNumber addr;
+ CHECK(net::ParseIPLiteralToNumber("127.0.0.1", &addr));
+ return addr;
+}
+
void CompareCharArraysWithHexError(
const string& description,
const char* actual,
« 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