Land Recent QUIC changes.

Move the QuicPacketWriter to the QuicConnection from the Helper. Also
changes the TestWriters to wrap another writer, instead of
re-implementing the default writer logic.

Merge internal change: 53858038

Adding an end to end test to simulate the socket being write blocked 10%
of the time.

Merge internal change: 53813433

[email protected]

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230566 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 ceb6418..71a62a5 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -13,6 +13,7 @@
 #include "net/quic/crypto/quic_encrypter.h"
 #include "net/quic/quic_framer.h"
 #include "net/quic/quic_packet_creator.h"
+#include "net/quic/test_tools/quic_connection_peer.h"
 #include "net/spdy/spdy_frame_builder.h"
 
 using base::StringPiece;
@@ -207,15 +208,19 @@
                                IPEndPoint address,
                                bool is_server)
     : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(),
+                     new testing::NiceMock<MockPacketWriter>(),
                      is_server, QuicVersionMax()),
-      has_mock_helper_(true) {
+      has_mock_helper_(true),
+      writer_(QuicConnectionPeer::GetWriter(this)) {
 }
 
 MockConnection::MockConnection(QuicGuid guid,
                                IPEndPoint address,
                                QuicConnectionHelperInterface* helper,
+                               QuicPacketWriter* writer,
                                bool is_server)
-    : QuicConnection(guid, address, helper, is_server, QuicVersionMax()),
+    : QuicConnection(guid, address, helper, writer, is_server,
+                     QuicVersionMax()),
       has_mock_helper_(false) {
 }
 
@@ -280,6 +285,12 @@
   return crypto_stream_;
 }
 
+MockPacketWriter::MockPacketWriter() {
+}
+
+MockPacketWriter::~MockPacketWriter() {
+}
+
 MockSendAlgorithm::MockSendAlgorithm() {
 }