Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / net / tools / quic / quic_dispatcher_test.cc
index 4c778cb..45cddb0 100644 (file)
@@ -48,6 +48,7 @@ class TestDispatcher : public QuicDispatcher {
       : QuicDispatcher(config,
                        crypto_config,
                        QuicSupportedVersions(),
+                       new QuicDispatcher::DefaultPacketWriterFactory(),
                        eps) {
   }
 
@@ -101,12 +102,12 @@ class QuicDispatcherTest : public ::testing::Test {
       : crypto_config_(QuicCryptoServerConfig::TESTING,
                        QuicRandom::GetInstance()),
         dispatcher_(config_, crypto_config_, &eps_),
-        session1_(NULL),
-        session2_(NULL) {
+        session1_(nullptr),
+        session2_(nullptr) {
     dispatcher_.Initialize(1);
   }
 
-  virtual ~QuicDispatcherTest() {}
+  ~QuicDispatcherTest() override {}
 
   MockConnection* connection1() {
     return reinterpret_cast<MockConnection*>(session1_->connection());
@@ -263,20 +264,18 @@ class BlockingWriter : public QuicPacketWriterWrapper {
  public:
   BlockingWriter() : write_blocked_(false) {}
 
-  virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; }
-  virtual void SetWritable() OVERRIDE { write_blocked_ = false; }
-
-  virtual WriteResult WritePacket(
-      const char* buffer,
-      size_t buf_len,
-      const IPAddressNumber& self_client_address,
-      const IPEndPoint& peer_client_address) OVERRIDE {
-    if (write_blocked_) {
-      return WriteResult(WRITE_STATUS_BLOCKED, EAGAIN);
-    } else {
-      return QuicPacketWriterWrapper::WritePacket(
-          buffer, buf_len, self_client_address, peer_client_address);
-    }
+  bool IsWriteBlocked() const override { return write_blocked_; }
+  void SetWritable() override { write_blocked_ = false; }
+
+  WriteResult WritePacket(const char* buffer,
+                          size_t buf_len,
+                          const IPAddressNumber& self_client_address,
+                          const IPEndPoint& peer_client_address) override {
+    // It would be quite possible to actually implement this method here with
+    // the fake blocked status, but it would be significantly more work in
+    // Chromium, and since it's not called anyway, don't bother.
+    LOG(DFATAL) << "Not supported";
+    return WriteResult();
   }
 
   bool write_blocked_;
@@ -284,8 +283,10 @@ class BlockingWriter : public QuicPacketWriterWrapper {
 
 class QuicDispatcherWriteBlockedListTest : public QuicDispatcherTest {
  public:
-  virtual void SetUp() {
+  void SetUp() override {
     writer_ = new BlockingWriter;
+    QuicDispatcherPeer::SetPacketWriterFactory(&dispatcher_,
+                                               new TestWriterFactory());
     QuicDispatcherPeer::UseWriter(&dispatcher_, writer_);
 
     IPEndPoint client_address(net::test::Loopback4(), 1);
@@ -303,7 +304,7 @@ class QuicDispatcherWriteBlockedListTest : public QuicDispatcherTest {
     blocked_list_ = QuicDispatcherPeer::GetWriteBlockedList(&dispatcher_);
   }
 
-  virtual void TearDown() {
+  void TearDown() override {
     EXPECT_CALL(*connection1(), SendConnectionClose(QUIC_PEER_GOING_AWAY));
     EXPECT_CALL(*connection2(), SendConnectionClose(QUIC_PEER_GOING_AWAY));
     dispatcher_.Shutdown();