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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 } | 205 } |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 return params; | 209 return params; |
210 } | 210 } |
211 | 211 |
212 class ServerDelegate : public PacketDroppingTestWriter::Delegate { | 212 class ServerDelegate : public PacketDroppingTestWriter::Delegate { |
213 public: | 213 public: |
214 ServerDelegate(TestWriterFactory* writer_factory, | 214 explicit ServerDelegate(QuicDispatcher* dispatcher) |
215 QuicDispatcher* dispatcher) | 215 : dispatcher_(dispatcher) {} |
216 : writer_factory_(writer_factory), | |
217 dispatcher_(dispatcher) {} | |
218 ~ServerDelegate() override {} | 216 ~ServerDelegate() override {} |
219 void OnPacketSent(WriteResult result) override { | |
220 writer_factory_->OnPacketSent(result); | |
221 } | |
222 void OnCanWrite() override { dispatcher_->OnCanWrite(); } | 217 void OnCanWrite() override { dispatcher_->OnCanWrite(); } |
223 | 218 |
224 private: | 219 private: |
225 TestWriterFactory* writer_factory_; | |
226 QuicDispatcher* dispatcher_; | 220 QuicDispatcher* dispatcher_; |
227 }; | 221 }; |
228 | 222 |
229 class ClientDelegate : public PacketDroppingTestWriter::Delegate { | 223 class ClientDelegate : public PacketDroppingTestWriter::Delegate { |
230 public: | 224 public: |
231 explicit ClientDelegate(QuicClient* client) : client_(client) {} | 225 explicit ClientDelegate(QuicClient* client) : client_(client) {} |
232 ~ClientDelegate() override {} | 226 ~ClientDelegate() override {} |
233 void OnPacketSent(WriteResult /*result*/) override {} | |
234 void OnCanWrite() override { | 227 void OnCanWrite() override { |
235 EpollEvent event(EPOLLOUT, false); | 228 EpollEvent event(EPOLLOUT, false); |
236 client_->OnEvent(client_->fd(), &event); | 229 client_->OnEvent(client_->fd(), &event); |
237 } | 230 } |
238 | 231 |
239 private: | 232 private: |
240 QuicClient* client_; | 233 QuicClient* client_; |
241 }; | 234 }; |
242 | 235 |
243 class EndToEndTest : public ::testing::TestWithParam<TestParams> { | 236 class EndToEndTest : public ::testing::TestWithParam<TestParams> { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // them. | 398 // them. |
406 FLAGS_enable_quic_stateless_reject_support = true; | 399 FLAGS_enable_quic_stateless_reject_support = true; |
407 FLAGS_quic_session_map_threshold_for_stateless_rejects = 0; | 400 FLAGS_quic_session_map_threshold_for_stateless_rejects = 0; |
408 } else { | 401 } else { |
409 FLAGS_enable_quic_stateless_reject_support = false; | 402 FLAGS_enable_quic_stateless_reject_support = false; |
410 FLAGS_quic_session_map_threshold_for_stateless_rejects = -1; | 403 FLAGS_quic_session_map_threshold_for_stateless_rejects = -1; |
411 } | 404 } |
412 | 405 |
413 server_writer_->Initialize( | 406 server_writer_->Initialize( |
414 QuicDispatcherPeer::GetHelper(dispatcher), | 407 QuicDispatcherPeer::GetHelper(dispatcher), |
415 new ServerDelegate(packet_writer_factory, dispatcher)); | 408 new ServerDelegate(dispatcher)); |
416 if (stream_factory_ != nullptr) { | 409 if (stream_factory_ != nullptr) { |
417 static_cast<QuicTestServer*>(server_thread_->server()) | 410 static_cast<QuicTestServer*>(server_thread_->server()) |
418 ->SetSpdyStreamFactory(stream_factory_); | 411 ->SetSpdyStreamFactory(stream_factory_); |
419 } | 412 } |
420 | 413 |
421 server_thread_->Start(); | 414 server_thread_->Start(); |
422 server_started_ = true; | 415 server_started_ = true; |
423 } | 416 } |
424 | 417 |
425 void StopServer() { | 418 void StopServer() { |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 // There will be buffered data to write in the client's stream. | 2094 // There will be buffered data to write in the client's stream. |
2102 ReliableQuicStream* stream = client_->client()->session()->GetStream(5); | 2095 ReliableQuicStream* stream = client_->client()->session()->GetStream(5); |
2103 EXPECT_TRUE(stream != nullptr && stream->HasBufferedData()); | 2096 EXPECT_TRUE(stream != nullptr && stream->HasBufferedData()); |
2104 } | 2097 } |
2105 } | 2098 } |
2106 | 2099 |
2107 } // namespace | 2100 } // namespace |
2108 } // namespace test | 2101 } // namespace test |
2109 } // namespace tools | 2102 } // namespace tools |
2110 } // namespace net | 2103 } // namespace net |
OLD | NEW |