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/quic/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/quic/crypto/crypto_framer.h" | 10 #include "net/quic/crypto/crypto_framer.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 625 |
626 TestWriterFactory::TestWriterFactory() : current_writer_(NULL) {} | 626 TestWriterFactory::TestWriterFactory() : current_writer_(NULL) {} |
627 TestWriterFactory::~TestWriterFactory() {} | 627 TestWriterFactory::~TestWriterFactory() {} |
628 | 628 |
629 QuicPacketWriter* TestWriterFactory::Create(QuicServerPacketWriter* writer, | 629 QuicPacketWriter* TestWriterFactory::Create(QuicServerPacketWriter* writer, |
630 QuicConnection* connection) { | 630 QuicConnection* connection) { |
631 return new PerConnectionPacketWriter(this, writer, connection); | 631 return new PerConnectionPacketWriter(this, writer, connection); |
632 } | 632 } |
633 | 633 |
634 void TestWriterFactory::OnPacketSent(WriteResult result) { | 634 void TestWriterFactory::OnPacketSent(WriteResult result) { |
635 if (current_writer_ != NULL) { | 635 if (current_writer_ != NULL && result.status == WRITE_STATUS_ERROR) { |
636 current_writer_->connection()->OnPacketSent(result); | 636 current_writer_->connection()->OnWriteError(result.error_code); |
637 current_writer_ = NULL; | 637 current_writer_ = NULL; |
638 } | 638 } |
639 } | 639 } |
640 | 640 |
641 void TestWriterFactory::Unregister(PerConnectionPacketWriter* writer) { | 641 void TestWriterFactory::Unregister(PerConnectionPacketWriter* writer) { |
642 if (current_writer_ == writer) { | 642 if (current_writer_ == writer) { |
643 current_writer_ = NULL; | 643 current_writer_ = NULL; |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
(...skipping 19 matching lines...) Expand all Loading... |
666 // different way, so TestWriterFactory::OnPacketSent might never be called. | 666 // different way, so TestWriterFactory::OnPacketSent might never be called. |
667 factory_->current_writer_ = this; | 667 factory_->current_writer_ = this; |
668 return QuicPerConnectionPacketWriter::WritePacket(buffer, | 668 return QuicPerConnectionPacketWriter::WritePacket(buffer, |
669 buf_len, | 669 buf_len, |
670 self_address, | 670 self_address, |
671 peer_address); | 671 peer_address); |
672 } | 672 } |
673 | 673 |
674 } // namespace test | 674 } // namespace test |
675 } // namespace net | 675 } // namespace net |
OLD | NEW |