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/test_tools/quic_test_utils.h" | 5 #include "net/tools/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "net/quic/quic_connection.h" | 7 #include "net/quic/quic_connection.h" |
8 #include "net/quic/test_tools/quic_connection_peer.h" | 8 #include "net/quic/test_tools/quic_connection_peer.h" |
9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
10 #include "net/tools/quic/quic_epoll_connection_helper.h" | 10 #include "net/tools/quic/quic_epoll_connection_helper.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 TestWriterFactory::TestWriterFactory() : current_writer_(NULL) {} | 132 TestWriterFactory::TestWriterFactory() : current_writer_(NULL) {} |
133 TestWriterFactory::~TestWriterFactory() {} | 133 TestWriterFactory::~TestWriterFactory() {} |
134 | 134 |
135 QuicPacketWriter* TestWriterFactory::Create(QuicPacketWriter* writer, | 135 QuicPacketWriter* TestWriterFactory::Create(QuicPacketWriter* writer, |
136 QuicConnection* connection) { | 136 QuicConnection* connection) { |
137 return new PerConnectionPacketWriter(this, writer, connection); | 137 return new PerConnectionPacketWriter(this, writer, connection); |
138 } | 138 } |
139 | 139 |
140 void TestWriterFactory::OnPacketSent(WriteResult result) { | 140 void TestWriterFactory::OnPacketSent(WriteResult result) { |
141 if (current_writer_ != NULL) { | 141 if (current_writer_ != NULL && result.status == WRITE_STATUS_ERROR) { |
142 current_writer_->connection()->OnPacketSent(result); | 142 current_writer_->connection()->OnWriteError(result.error_code); |
143 current_writer_ = NULL; | 143 current_writer_ = NULL; |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 void TestWriterFactory::Unregister(PerConnectionPacketWriter* writer) { | 147 void TestWriterFactory::Unregister(PerConnectionPacketWriter* writer) { |
148 if (current_writer_ == writer) { | 148 if (current_writer_ == writer) { |
149 current_writer_ = NULL; | 149 current_writer_ = NULL; |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
(...skipping 20 matching lines...) Expand all Loading... |
173 factory_->current_writer_ = this; | 173 factory_->current_writer_ = this; |
174 return QuicPerConnectionPacketWriter::WritePacket(buffer, | 174 return QuicPerConnectionPacketWriter::WritePacket(buffer, |
175 buf_len, | 175 buf_len, |
176 self_address, | 176 self_address, |
177 peer_address); | 177 peer_address); |
178 } | 178 } |
179 | 179 |
180 } // namespace test | 180 } // namespace test |
181 } // namespace tools | 181 } // namespace tools |
182 } // namespace net | 182 } // namespace net |
OLD | NEW |