| 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/quic/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 EXPECT_TRUE(response_.headers->HasHeaderValue("Content-Type", "text/plain")); | 433 EXPECT_TRUE(response_.headers->HasHeaderValue("Content-Type", "text/plain")); |
| 434 | 434 |
| 435 // There is no body, so this should return immediately. | 435 // There is no body, so this should return immediately. |
| 436 EXPECT_EQ(0, stream_->ReadResponseBody(read_buffer_.get(), | 436 EXPECT_EQ(0, stream_->ReadResponseBody(read_buffer_.get(), |
| 437 read_buffer_->size(), | 437 read_buffer_->size(), |
| 438 callback_.callback())); | 438 callback_.callback())); |
| 439 EXPECT_TRUE(stream_->IsResponseBodyComplete()); | 439 EXPECT_TRUE(stream_->IsResponseBodyComplete()); |
| 440 EXPECT_TRUE(AtEof()); | 440 EXPECT_TRUE(AtEof()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 // Regression test for http://crbug.com/409101 |
| 444 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) { |
| 445 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 446 Initialize(); |
| 447 |
| 448 request_.method = "GET"; |
| 449 request_.url = GURL("http://www.google.com/"); |
| 450 |
| 451 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 452 net_log_, callback_.callback())); |
| 453 |
| 454 session_->connection()->CloseConnection(QUIC_NO_ERROR, true); |
| 455 |
| 456 EXPECT_EQ(ERR_CONNECTION_CLOSED, |
| 457 stream_->SendRequest(headers_, &response_, |
| 458 callback_.callback())); |
| 459 } |
| 460 |
| 443 TEST_P(QuicHttpStreamTest, SendPostRequest) { | 461 TEST_P(QuicHttpStreamTest, SendPostRequest) { |
| 444 SetRequest("POST", "/", DEFAULT_PRIORITY); | 462 SetRequest("POST", "/", DEFAULT_PRIORITY); |
| 445 AddWrite(ConstructRequestHeadersPacket(1, !kFin)); | 463 AddWrite(ConstructRequestHeadersPacket(1, !kFin)); |
| 446 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); | 464 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); |
| 447 AddWrite(ConstructAckPacket(3, 3, 1)); | 465 AddWrite(ConstructAckPacket(3, 3, 1)); |
| 448 | 466 |
| 449 Initialize(); | 467 Initialize(); |
| 450 | 468 |
| 451 ScopedVector<UploadElementReader> element_readers; | 469 ScopedVector<UploadElementReader> element_readers; |
| 452 element_readers.push_back( | 470 element_readers.push_back( |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 // Set Delegate to NULL and make sure EffectivePriority returns highest | 749 // Set Delegate to NULL and make sure EffectivePriority returns highest |
| 732 // priority. | 750 // priority. |
| 733 reliable_stream->SetDelegate(NULL); | 751 reliable_stream->SetDelegate(NULL); |
| 734 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 752 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
| 735 reliable_stream->EffectivePriority()); | 753 reliable_stream->EffectivePriority()); |
| 736 reliable_stream->SetDelegate(delegate); | 754 reliable_stream->SetDelegate(delegate); |
| 737 } | 755 } |
| 738 | 756 |
| 739 } // namespace test | 757 } // namespace test |
| 740 } // namespace net | 758 } // namespace net |
| OLD | NEW |