OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 public: | 277 public: |
278 BlockingWriter() : write_blocked_(false) {} | 278 BlockingWriter() : write_blocked_(false) {} |
279 | 279 |
280 virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; } | 280 virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; } |
281 virtual void SetWritable() OVERRIDE { write_blocked_ = false; } | 281 virtual void SetWritable() OVERRIDE { write_blocked_ = false; } |
282 | 282 |
283 virtual WriteResult WritePacket( | 283 virtual WriteResult WritePacket( |
284 const char* buffer, | 284 const char* buffer, |
285 size_t buf_len, | 285 size_t buf_len, |
286 const IPAddressNumber& self_address, | 286 const IPAddressNumber& self_address, |
287 const IPEndPoint& peer_address, | 287 const IPEndPoint& peer_address) OVERRIDE { |
288 QuicBlockedWriterInterface* blocked_writer) OVERRIDE { | |
289 if (write_blocked_) { | 288 if (write_blocked_) { |
290 return WriteResult(WRITE_STATUS_BLOCKED, EAGAIN); | 289 return WriteResult(WRITE_STATUS_BLOCKED, EAGAIN); |
291 } else { | 290 } else { |
292 return QuicPacketWriterWrapper::WritePacket( | 291 return QuicPacketWriterWrapper::WritePacket( |
293 buffer, buf_len, self_address, peer_address, blocked_writer); | 292 buffer, buf_len, self_address, peer_address); |
294 } | 293 } |
295 } | 294 } |
296 | 295 |
297 bool write_blocked_; | 296 bool write_blocked_; |
298 }; | 297 }; |
299 | 298 |
300 class QuicDispatcherWriteBlockedListTest : public QuicDispatcherTest { | 299 class QuicDispatcherWriteBlockedListTest : public QuicDispatcherTest { |
301 public: | 300 public: |
302 virtual void SetUp() { | 301 virtual void SetUp() { |
303 writer_ = new BlockingWriter; | 302 writer_ = new BlockingWriter; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 454 |
456 // And we'll resume where we left off when we get another call. | 455 // And we'll resume where we left off when we get another call. |
457 EXPECT_CALL(*connection2(), OnCanWrite()); | 456 EXPECT_CALL(*connection2(), OnCanWrite()); |
458 dispatcher_.OnCanWrite(); | 457 dispatcher_.OnCanWrite(); |
459 } | 458 } |
460 | 459 |
461 } // namespace | 460 } // namespace |
462 } // namespace test | 461 } // namespace test |
463 } // namespace tools | 462 } // namespace tools |
464 } // namespace net | 463 } // namespace net |
OLD | NEW |