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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 headers[":scheme"] = "https"; | 3013 headers[":scheme"] = "https"; |
3014 headers[":authority"] = server_hostname_; | 3014 headers[":authority"] = server_hostname_; |
3015 headers["key"] = string(64 * 1024, 'a'); | 3015 headers["key"] = string(64 * 1024, 'a'); |
3016 | 3016 |
3017 client_->SendMessage(headers, ""); | 3017 client_->SendMessage(headers, ""); |
3018 client_->WaitForResponse(); | 3018 client_->WaitForResponse(); |
3019 EXPECT_EQ(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE, | 3019 EXPECT_EQ(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE, |
3020 client_->connection_error()); | 3020 client_->connection_error()); |
3021 } | 3021 } |
3022 | 3022 |
| 3023 class WindowUpdateObserver : public QuicConnectionDebugVisitor { |
| 3024 public: |
| 3025 WindowUpdateObserver() : num_window_update_frames_(0) {} |
| 3026 |
| 3027 size_t num_window_update_frames() const { return num_window_update_frames_; } |
| 3028 |
| 3029 void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override { |
| 3030 ++num_window_update_frames_; |
| 3031 } |
| 3032 |
| 3033 private: |
| 3034 size_t num_window_update_frames_; |
| 3035 }; |
| 3036 |
| 3037 TEST_P(EndToEndTest, WindowUpdateInAck) { |
| 3038 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true; |
| 3039 FLAGS_quic_enable_version_39 = true; |
| 3040 ASSERT_TRUE(Initialize()); |
| 3041 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 3042 WindowUpdateObserver observer; |
| 3043 QuicConnection* client_connection = |
| 3044 client_->client()->session()->connection(); |
| 3045 client_connection->set_debug_visitor(&observer); |
| 3046 QuicVersion version = client_connection->version(); |
| 3047 // 100KB body. |
| 3048 string body(100 * 1024, 'a'); |
| 3049 SpdyHeaderBlock headers; |
| 3050 headers[":method"] = "POST"; |
| 3051 headers[":path"] = "/foo"; |
| 3052 headers[":scheme"] = "https"; |
| 3053 headers[":authority"] = server_hostname_; |
| 3054 |
| 3055 EXPECT_EQ(kFooResponseBody, |
| 3056 client_->SendCustomSynchronousRequest(headers, body)); |
| 3057 client_->Disconnect(); |
| 3058 if (version > QUIC_VERSION_38) { |
| 3059 EXPECT_LT(0u, observer.num_window_update_frames()); |
| 3060 } else { |
| 3061 EXPECT_EQ(0u, observer.num_window_update_frames()); |
| 3062 } |
| 3063 } |
| 3064 |
3023 class EndToEndBufferedPacketsTest : public EndToEndTest { | 3065 class EndToEndBufferedPacketsTest : public EndToEndTest { |
3024 public: | 3066 public: |
3025 void CreateClientWithWriter() override { | 3067 void CreateClientWithWriter() override { |
3026 QUIC_LOG(ERROR) << "create client with reorder_writer_ "; | 3068 QUIC_LOG(ERROR) << "create client with reorder_writer_ "; |
3027 reorder_writer_ = new PacketReorderingWriter(); | 3069 reorder_writer_ = new PacketReorderingWriter(); |
3028 client_.reset(EndToEndTest::CreateQuicClient(reorder_writer_)); | 3070 client_.reset(EndToEndTest::CreateQuicClient(reorder_writer_)); |
3029 } | 3071 } |
3030 | 3072 |
3031 void SetUp() override { | 3073 void SetUp() override { |
3032 // Don't initialize client writer in base class. | 3074 // Don't initialize client writer in base class. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 client_->WaitForResponse(); | 3109 client_->WaitForResponse(); |
3068 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3110 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
3069 QuicConnectionStats client_stats = | 3111 QuicConnectionStats client_stats = |
3070 client_->client()->session()->connection()->GetStats(); | 3112 client_->client()->session()->connection()->GetStats(); |
3071 EXPECT_EQ(0u, client_stats.packets_lost); | 3113 EXPECT_EQ(0u, client_stats.packets_lost); |
3072 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3114 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
3073 } | 3115 } |
3074 } // namespace | 3116 } // namespace |
3075 } // namespace test | 3117 } // namespace test |
3076 } // namespace net | 3118 } // namespace net |
OLD | NEW |