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

Unified Diff: net/socket/socket_test_util.cc

Issue 107803002: Consistently suggest ephemeral port for QUIC client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix DCHECK typo, an update Mocks to be compatible 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
Index: net/socket/socket_test_util.cc
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index 148b11c5698927c210c7a8b46b7b0224313b3d03..475c6519dc4d50864e43c79d0b91f52fd2ba5bf1 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -663,6 +663,12 @@ MockClientSocketFactory::CreateDatagramClientSocket(
const RandIntCallback& rand_int_cb,
net::NetLog* net_log,
const net::NetLog::Source& source) {
+ // Socket connect is supposed to call for some random suggestions for ports.
+ // We call 3 times so that the quic_stream_factory will know this function
+ // was consulted (it has a DCHECK), but will not actually DCHECK the
+ // resulting ephemeral port (which we don't set).
+ for (int count = 3; count > 0; --count)
+ rand_int_cb.Run(1000, 2000);
SocketDataProvider* data_provider = mock_data_.GetNext();
scoped_ptr<MockUDPClientSocket> socket(
new MockUDPClientSocket(data_provider, net_log));
@@ -1803,6 +1809,12 @@ DeterministicMockClientSocketFactory::CreateDatagramClientSocket(
const RandIntCallback& rand_int_cb,
net::NetLog* net_log,
const NetLog::Source& source) {
+ // Socket connect is supposed to call for some random suggestions for ports.
+ // We call 3 times so that the quic_stream_factory will know this function
+ // was consulted (it has a DCHECK), but will not actually DCHECK the
+ // resulting ephemeral port (which we don't set).
+ for (int count = 3; count > 0; --count)
+ rand_int_cb.Run(1000, 2000);
DeterministicSocketData* data_provider = mock_data().GetNext();
scoped_ptr<DeterministicMockUDPClientSocket> socket(
new DeterministicMockUDPClientSocket(net_log, data_provider));

Powered by Google App Engine
This is Rietveld 408576698