Land Recent QUIC Changes.

Add convenience HighestPriority and LowestPriority methods to QuicUtils

Merge internal change: 58122394
https://codereview.chromium.org/112463003/


Change QUIC to only ack every other packet when there are no losses
within the last four received packets.

Merge internal change: 58111242
https://codereview.chromium.org/113123004/


Add a version() convenience method to ReliableQuicStream.

Merge internal change: 58110960
https://codereview.chromium.org/112273003/


Fix two tests that fail when FLAGS_enable_quic_pacing is enabled

Merge internal change: 58101756
https://codereview.chromium.org/115393003/


Remove deprecated flag FLAGS_pad_quic_handshake_packets.

Merge internal change: 58101024
https://codereview.chromium.org/114923007/


Remove the is_server argument from the QuicSession constructor.
In a previous CL, I removed this from TestSession, but I missed, that
it's an argument of the main QuicSession constructor.

Merge internal change: 58059515
https://codereview.chromium.org/102313005/


Fix QUIC's TCP style retransmission logic to only send a maximum of 2
packets per incoming ack instead of 10.

Merge internal change: 58059328
https://codereview.chromium.org/109993008/


Remove redundant |is_server| argument from TestSession and call the
connection's is_server() method instead.

Merge internal change: 58047118
https://codereview.chromium.org/110373004/


Minor cleanup of QUIC MockConnection and PacketSavingConnection
constructors.

Merge internal change: 58042657
https://codereview.chromium.org/114933003/


Cleanup in QUIC to merge the previous_transmissions_map in
QuicSentPacketManager with the unacked_packets map.

Merge internal change: 58011531
https://codereview.chromium.org/109323012/

[email protected]

Review URL: https://codereview.chromium.org/115463002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240972 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index 4de2cad..d85f92f 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -231,40 +231,46 @@
   clock_.AdvanceTime(delta);
 }
 
-MockConnection::MockConnection(QuicGuid guid,
-                               IPEndPoint address,
-                               bool is_server)
-    : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(),
+MockConnection::MockConnection(bool is_server)
+    : QuicConnection(kTestGuid,
+                     IPEndPoint(Loopback4(), kTestPort),
+                     new testing::NiceMock<MockHelper>(),
                      new testing::NiceMock<MockPacketWriter>(),
                      is_server, QuicSupportedVersions()),
-      has_mock_helper_(true),
+      writer_(QuicConnectionPeer::GetWriter(this)),
+      helper_(helper()) {
+}
+
+MockConnection::MockConnection(IPEndPoint address,
+                               bool is_server)
+    : QuicConnection(kTestGuid, address,
+                     new testing::NiceMock<MockHelper>(),
+                     new testing::NiceMock<MockPacketWriter>(),
+                     is_server, QuicSupportedVersions()),
       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 @@
   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 @@
 }
 
 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 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,