Landing Recent QUIC changes until 4AM, Aug 7, 2016 UTC-4

Update quic flags.
https://codereview.chromium.org/2233943002/#ps40001

Removing obselete TODO
Merge internal change: 129550025
https://codereview.chromium.org/2228403004/#ps20001

Fix bug in QUIC force HOL blocking experiment, guarded by --quic_enable_version_36_v2.
Make sure that new QUIC paramenter FHOL (force head of line blocking)
propagates to and from CHLO correctly.
Merge internal change: 129481622
https://codereview.chromium.org/2230223003/#ps20001

Refactor SendAlgorithmSimulator to accept arbitrary termination predicates
Also, correct the description of SendAlgorithmSimulator::TransferBytes() to
reflect its actual behavior.
n/a (test-only change)
Merge internal change: 129468670
https://codereview.chromium.org/2236533002/#ps20001

Adding a test utility to print QuicTagValueMaps.
Merge internal change: 129456177
https://codereview.chromium.org/2236513002/#ps20001

Rename QuicSupportedVersions to QuicAllSupportedVersions. Add QuicCurrentSupportedVersions which returns filtered supported versions based on flags. Not flag protected.
Merge internal change: 129440821
https://codereview.chromium.org/2236463004/#ps40001

Test only. Fix quic e2e test flakiness caused by quic_buffer_packet_till_chlo.
Add this flag into test argument permutation to avoid testing cheap
stateless reject without enabling buffering out of order packets.
Merge internal change: 129437595
https://codereview.chromium.org/2231463003/#ps20001

Introduce TTL in QuicReceivedPacket.
Merge internal change: 129363578
https://codereview.chromium.org/2229703003/#ps20001

Change use of std::tuple/std::get to testing::tuple/testing::get so that parameterized test in quic_headers_stream_test.cc compiles not only for internal and chromium, but also for the proto-quic environment.
n/a (Testing only.)
Merge internal change: 129359661
https://codereview.chromium.org/2233453002/#ps20001

Fix memory corruption from SetMaxPacingRate by inlining PacingSender.
This behavior can be disabled by setting
quic_disable_pacing_for_perf_tests to true.
Merge internal change: 129356268
https://codereview.chromium.org/2228783004/#ps20001

Track when QUIC connections are application limited. Protected by quic_enable_app_limited_check.
This CL notifies the congestion control algorithm when the connection
has no outstanding data to send. No behavior change is expected.
Merge internal change: 129351671
https://codereview.chromium.org/2229023002/#ps20001

Make QuicDispatcher to queue packets for new connections while waiting for CHLOs. Flag protected by --quic_buffer_packet_till_chlo
Merge internal change: 129327247
https://codereview.chromium.org/2222393002/#ps20001

QuicSession no longer directly owns its QuicConnection. Not flag protected.
Merge internal change: 129318081
https://codereview.chromium.org/2226643004/

Add VersionOfIndex() to quic_protocol.h
Merge internal change: 129226757
https://codereview.chromium.org/2220333003/

Increments spdy_framer_use_new_methods2 to spdy_framer_use_new_methods3.
Merge internal change: 129220409
https://codereview.chromium.org/2225153002/

Use the CHLO packet size, not message size when determining how large a REJ can be. Protected by --quic_use_chlo_packet_size
This should reduce number of round trips during the handshake slightly.
Merge internal change: 129160718
https://codereview.chromium.org/2227553003/

Rollback of internal changelist 128865569.
*** Original change description ***
Inline PacingSender into QuicSentPacketManager. Guarded by
quic_use_inline_pacing.
***
Merge internal change: 129101660
https://codereview.chromium.org/2228613002/

Add GetDebugState() in SendAlgorithmInterface().
Merge internal change: 129053230
https://codereview.chromium.org/2222093002/

Remove v33 connection id public flags hack. Protected by --quic_remove_v33_hacks.
Merge internal change: 129015386
https://codereview.chromium.org/2223993002/

Deprecate --quic_socket_walltimestamps
Merge internal change: 129001103
https://codereview.chromium.org/2229553003/

Deprecate --quic_do_not_migrate_on_old_packet.
Merge internal change: 128998762
https://codereview.chromium.org/2221093002/

Flatten GeneralLossAlgorithm into QuicSentPacketManager. Not flag protected.
Also reorder GeneralLossAlgorithm per the class layout optimizer
recommendation.
Merge internal change: 128997036
https://codereview.chromium.org/2223983002/

Review-Url: https://codereview.chromium.org/2236973002
Cr-Commit-Position: refs/heads/master@{#411638}
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index 5b3b3b0e..6069fa3 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -251,7 +251,7 @@
                          helper,
                          alarm_factory,
                          perspective,
-                         QuicSupportedVersions()) {}
+                         AllSupportedVersions()) {}
 
 MockQuicConnection::MockQuicConnection(IPEndPoint address,
                                        MockQuicConnectionHelper* helper,
@@ -262,7 +262,7 @@
                          helper,
                          alarm_factory,
                          perspective,
-                         QuicSupportedVersions()) {}
+                         AllSupportedVersions()) {}
 
 MockQuicConnection::MockQuicConnection(QuicConnectionId connection_id,
                                        MockQuicConnectionHelper* helper,
@@ -273,7 +273,7 @@
                          helper,
                          alarm_factory,
                          perspective,
-                         QuicSupportedVersions()) {}
+                         CurrentSupportedVersions()) {}
 
 MockQuicConnection::MockQuicConnection(
     MockQuicConnectionHelper* helper,
@@ -350,7 +350,9 @@
       .WillByDefault(testing::Return(QuicConsumedData(0, false)));
 }
 
-MockQuicSession::~MockQuicSession() {}
+MockQuicSession::~MockQuicSession() {
+  delete connection();
+}
 
 // static
 QuicConsumedData MockQuicSession::ConsumeAllData(
@@ -371,7 +373,9 @@
       .WillByDefault(testing::Return(QuicConsumedData(0, false)));
 }
 
-MockQuicSpdySession::~MockQuicSpdySession() {}
+MockQuicSpdySession::~MockQuicSpdySession() {
+  delete connection();
+}
 
 TestQuicSpdyServerSession::TestQuicSpdyServerSession(
     QuicConnection* connection,
@@ -392,7 +396,9 @@
       .WillByDefault(testing::Return(true));
 }
 
-TestQuicSpdyServerSession::~TestQuicSpdyServerSession() {}
+TestQuicSpdyServerSession::~TestQuicSpdyServerSession() {
+  delete connection();
+}
 
 QuicCryptoServerStreamBase*
 TestQuicSpdyServerSession::CreateQuicCryptoServerStream(
@@ -502,11 +508,11 @@
 }
 
 QuicVersion QuicVersionMax() {
-  return QuicSupportedVersions().front();
+  return AllSupportedVersions().front();
 }
 
 QuicVersion QuicVersionMin() {
-  return QuicSupportedVersions().back();
+  return AllSupportedVersions().back();
 }
 
 IPAddress Loopback4() {
@@ -601,8 +607,9 @@
   QuicFrame frame(&stream_frame);
   QuicFrames frames;
   frames.push_back(frame);
-  QuicFramer framer(versions != nullptr ? *versions : QuicSupportedVersions(),
-                    QuicTime::Zero(), perspective);
+  QuicFramer framer(
+      versions != nullptr ? *versions : CurrentSupportedVersions(),
+      QuicTime::Zero(), perspective);
 
   std::unique_ptr<QuicPacket> packet(
       BuildUnsizedDataPacket(&framer, header, frames));
@@ -651,7 +658,7 @@
   QuicFrame frame(&stream_frame);
   QuicFrames frames;
   frames.push_back(frame);
-  QuicFramer framer(versions != nullptr ? *versions : QuicSupportedVersions(),
+  QuicFramer framer(versions != nullptr ? *versions : AllSupportedVersions(),
                     QuicTime::Zero(), perspective);
 
   std::unique_ptr<QuicPacket> packet(
@@ -730,7 +737,7 @@
   CryptoFramer crypto_framer;
   std::unique_ptr<QuicData> data(
       crypto_framer.ConstructHandshakeMessage(message));
-  QuicFramer quic_framer(QuicSupportedVersions(), QuicTime::Zero(),
+  QuicFramer quic_framer(AllSupportedVersions(), QuicTime::Zero(),
                          Perspective::IS_CLIENT);
 
   QuicPacketHeader header;