| 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 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // TODO(rch) handle this better when we have different encryption options. | 326 // TODO(rch) handle this better when we have different encryption options. |
| 327 size_t stream_data = 3; | 327 size_t stream_data = 3; |
| 328 size_t stream_payload_size = QuicFramer::GetMinStreamFrameSize() + | 328 size_t stream_payload_size = QuicFramer::GetMinStreamFrameSize() + |
| 329 stream_data; | 329 stream_data; |
| 330 size_t min_payload_size = | 330 size_t min_payload_size = |
| 331 std::max(kCongestionFeedbackFrameSize, stream_payload_size); | 331 std::max(kCongestionFeedbackFrameSize, stream_payload_size); |
| 332 size_t ciphertext_size = NullEncrypter().GetCiphertextSize(min_payload_size); | 332 size_t ciphertext_size = NullEncrypter().GetCiphertextSize(min_payload_size); |
| 333 // TODO(satyashekhar): Fix this when versioning is implemented. | 333 // TODO(satyashekhar): Fix this when versioning is implemented. |
| 334 client_->options()->max_packet_length = | 334 client_->options()->max_packet_length = |
| 335 GetPacketHeaderSize(PACKET_8BYTE_GUID, !kIncludeVersion, | 335 GetPacketHeaderSize(PACKET_8BYTE_GUID, !kIncludeVersion, |
| 336 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP) + | 336 NOT_IN_FEC_GROUP) + |
| 337 ciphertext_size; | 337 ciphertext_size; |
| 338 | 338 |
| 339 // Make sure our request is too large to fit in one packet. | 339 // Make sure our request is too large to fit in one packet. |
| 340 EXPECT_GT(strlen(kLargeRequest), min_payload_size); | 340 EXPECT_GT(strlen(kLargeRequest), min_payload_size); |
| 341 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest(kLargeRequest)); | 341 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest(kLargeRequest)); |
| 342 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 342 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 TEST_F(EndToEndTest, MultipleFramesRandomOrder) { | 345 TEST_F(EndToEndTest, MultipleFramesRandomOrder) { |
| 346 // TODO(rtenneti): Delete this when NSS is supported. | 346 // TODO(rtenneti): Delete this when NSS is supported. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 358 // TODO(rch) handle this better when we have different encryption options. | 358 // TODO(rch) handle this better when we have different encryption options. |
| 359 size_t stream_data = 3; | 359 size_t stream_data = 3; |
| 360 size_t stream_payload_size = QuicFramer::GetMinStreamFrameSize() + | 360 size_t stream_payload_size = QuicFramer::GetMinStreamFrameSize() + |
| 361 stream_data; | 361 stream_data; |
| 362 size_t min_payload_size = | 362 size_t min_payload_size = |
| 363 std::max(kCongestionFeedbackFrameSize, stream_payload_size); | 363 std::max(kCongestionFeedbackFrameSize, stream_payload_size); |
| 364 size_t ciphertext_size = NullEncrypter().GetCiphertextSize(min_payload_size); | 364 size_t ciphertext_size = NullEncrypter().GetCiphertextSize(min_payload_size); |
| 365 // TODO(satyashekhar): Fix this when versioning is implemented. | 365 // TODO(satyashekhar): Fix this when versioning is implemented. |
| 366 client_->options()->max_packet_length = | 366 client_->options()->max_packet_length = |
| 367 GetPacketHeaderSize(PACKET_8BYTE_GUID, !kIncludeVersion, | 367 GetPacketHeaderSize(PACKET_8BYTE_GUID, !kIncludeVersion, |
| 368 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP) + | 368 NOT_IN_FEC_GROUP) + |
| 369 ciphertext_size; | 369 ciphertext_size; |
| 370 client_->options()->random_reorder = true; | 370 client_->options()->random_reorder = true; |
| 371 | 371 |
| 372 // Make sure our request is too large to fit in one packet. | 372 // Make sure our request is too large to fit in one packet. |
| 373 EXPECT_GT(strlen(kLargeRequest), min_payload_size); | 373 EXPECT_GT(strlen(kLargeRequest), min_payload_size); |
| 374 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest(kLargeRequest)); | 374 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest(kLargeRequest)); |
| 375 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 375 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 376 } | 376 } |
| 377 | 377 |
| 378 TEST_F(EndToEndTest, PostMissingBytes) { | 378 TEST_F(EndToEndTest, PostMissingBytes) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 QuicEpollConnectionHelperPeer::SetWriter(helper, NULL); | 599 QuicEpollConnectionHelperPeer::SetWriter(helper, NULL); |
| 600 | 600 |
| 601 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 601 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
| 602 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); | 602 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); |
| 603 } | 603 } |
| 604 | 604 |
| 605 } // namespace | 605 } // namespace |
| 606 } // namespace test | 606 } // namespace test |
| 607 } // namespace tools | 607 } // namespace tools |
| 608 } // namespace net | 608 } // namespace net |
| OLD | NEW |