| 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 <sys/epoll.h> | 6 #include <sys/epoll.h> |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "net/quic/core/quic_packets.h" | 27 #include "net/quic/core/quic_packets.h" |
| 28 #include "net/quic/core/quic_server_id.h" | 28 #include "net/quic/core/quic_server_id.h" |
| 29 #include "net/quic/core/quic_session.h" | 29 #include "net/quic/core/quic_session.h" |
| 30 #include "net/quic/core/quic_utils.h" | 30 #include "net/quic/core/quic_utils.h" |
| 31 #include "net/quic/platform/api/quic_flags.h" | 31 #include "net/quic/platform/api/quic_flags.h" |
| 32 #include "net/quic/platform/api/quic_logging.h" | 32 #include "net/quic/platform/api/quic_logging.h" |
| 33 #include "net/quic/platform/api/quic_ptr_util.h" | 33 #include "net/quic/platform/api/quic_ptr_util.h" |
| 34 #include "net/quic/platform/api/quic_socket_address.h" | 34 #include "net/quic/platform/api/quic_socket_address.h" |
| 35 #include "net/quic/platform/api/quic_str_cat.h" | 35 #include "net/quic/platform/api/quic_str_cat.h" |
| 36 #include "net/quic/platform/api/quic_string_piece.h" | 36 #include "net/quic/platform/api/quic_string_piece.h" |
| 37 #include "net/quic/platform/api/quic_test.h" |
| 37 #include "net/quic/platform/api/quic_text_utils.h" | 38 #include "net/quic/platform/api/quic_text_utils.h" |
| 38 #include "net/quic/test_tools/crypto_test_utils.h" | 39 #include "net/quic/test_tools/crypto_test_utils.h" |
| 39 #include "net/quic/test_tools/quic_config_peer.h" | 40 #include "net/quic/test_tools/quic_config_peer.h" |
| 40 #include "net/quic/test_tools/quic_connection_peer.h" | 41 #include "net/quic/test_tools/quic_connection_peer.h" |
| 41 #include "net/quic/test_tools/quic_flow_controller_peer.h" | 42 #include "net/quic/test_tools/quic_flow_controller_peer.h" |
| 42 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 43 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| 43 #include "net/quic/test_tools/quic_session_peer.h" | 44 #include "net/quic/test_tools/quic_session_peer.h" |
| 44 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 45 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| 45 #include "net/quic/test_tools/quic_stream_peer.h" | 46 #include "net/quic/test_tools/quic_stream_peer.h" |
| 46 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" | 47 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 ~ClientDelegate() override {} | 287 ~ClientDelegate() override {} |
| 287 void OnCanWrite() override { | 288 void OnCanWrite() override { |
| 288 EpollEvent event(EPOLLOUT); | 289 EpollEvent event(EPOLLOUT); |
| 289 client_->OnEvent(client_->GetLatestFD(), &event); | 290 client_->OnEvent(client_->GetLatestFD(), &event); |
| 290 } | 291 } |
| 291 | 292 |
| 292 private: | 293 private: |
| 293 QuicClient* client_; | 294 QuicClient* client_; |
| 294 }; | 295 }; |
| 295 | 296 |
| 296 class EndToEndTest : public ::testing::TestWithParam<TestParams> { | 297 class EndToEndTest : public QuicTestWithParam<TestParams> { |
| 297 protected: | 298 protected: |
| 298 EndToEndTest() | 299 EndToEndTest() |
| 299 : initialized_(false), | 300 : initialized_(false), |
| 300 server_address_(QuicSocketAddress(QuicIpAddress::Loopback4(), 0)), | 301 server_address_(QuicSocketAddress(QuicIpAddress::Loopback4(), 0)), |
| 301 server_hostname_("test.example.com"), | 302 server_hostname_("test.example.com"), |
| 302 client_writer_(nullptr), | 303 client_writer_(nullptr), |
| 303 server_writer_(nullptr), | 304 server_writer_(nullptr), |
| 304 server_started_(false), | 305 server_started_(false), |
| 305 chlo_multiplier_(0), | 306 chlo_multiplier_(0), |
| 306 stream_factory_(nullptr), | 307 stream_factory_(nullptr), |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 QuicFlowControllerPeer::ReceiveWindowSize(server)); | 596 QuicFlowControllerPeer::ReceiveWindowSize(server)); |
| 596 EXPECT_EQ(QuicFlowControllerPeer::ReceiveWindowSize(client), | 597 EXPECT_EQ(QuicFlowControllerPeer::ReceiveWindowSize(client), |
| 597 QuicFlowControllerPeer::SendWindowSize(server)); | 598 QuicFlowControllerPeer::SendWindowSize(server)); |
| 598 } | 599 } |
| 599 | 600 |
| 600 // Must be called before Initialize to have effect. | 601 // Must be called before Initialize to have effect. |
| 601 void SetSpdyStreamFactory(QuicTestServer::StreamFactory* factory) { | 602 void SetSpdyStreamFactory(QuicTestServer::StreamFactory* factory) { |
| 602 stream_factory_ = factory; | 603 stream_factory_ = factory; |
| 603 } | 604 } |
| 604 | 605 |
| 605 QuicFlagSaver flags_; // Save/restore all QUIC flag values. | |
| 606 bool initialized_; | 606 bool initialized_; |
| 607 QuicSocketAddress server_address_; | 607 QuicSocketAddress server_address_; |
| 608 string server_hostname_; | 608 string server_hostname_; |
| 609 QuicHttpResponseCache response_cache_; | 609 QuicHttpResponseCache response_cache_; |
| 610 std::unique_ptr<ServerThread> server_thread_; | 610 std::unique_ptr<ServerThread> server_thread_; |
| 611 std::unique_ptr<QuicTestClient> client_; | 611 std::unique_ptr<QuicTestClient> client_; |
| 612 PacketDroppingTestWriter* client_writer_; | 612 PacketDroppingTestWriter* client_writer_; |
| 613 PacketDroppingTestWriter* server_writer_; | 613 PacketDroppingTestWriter* server_writer_; |
| 614 bool server_started_; | 614 bool server_started_; |
| 615 QuicConfig client_config_; | 615 QuicConfig client_config_; |
| (...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3109 client_->WaitForResponse(); | 3109 client_->WaitForResponse(); |
| 3110 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3110 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 3111 QuicConnectionStats client_stats = | 3111 QuicConnectionStats client_stats = |
| 3112 client_->client()->session()->connection()->GetStats(); | 3112 client_->client()->session()->connection()->GetStats(); |
| 3113 EXPECT_EQ(0u, client_stats.packets_lost); | 3113 EXPECT_EQ(0u, client_stats.packets_lost); |
| 3114 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3114 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 3115 } | 3115 } |
| 3116 } // namespace | 3116 } // namespace |
| 3117 } // namespace test | 3117 } // namespace test |
| 3118 } // namespace net | 3118 } // namespace net |
| OLD | NEW |