Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(875)

Side by Side Diff: net/quic/quic_http_stream_test.cc

Issue 531903002: Merge f9f103cbc943019e6576a68c724a6360da26b687 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_http_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 EXPECT_TRUE(response_.headers->HasHeaderValue("Content-Type", "text/plain")); 420 EXPECT_TRUE(response_.headers->HasHeaderValue("Content-Type", "text/plain"));
421 421
422 // There is no body, so this should return immediately. 422 // There is no body, so this should return immediately.
423 EXPECT_EQ(0, stream_->ReadResponseBody(read_buffer_.get(), 423 EXPECT_EQ(0, stream_->ReadResponseBody(read_buffer_.get(),
424 read_buffer_->size(), 424 read_buffer_->size(),
425 callback_.callback())); 425 callback_.callback()));
426 EXPECT_TRUE(stream_->IsResponseBodyComplete()); 426 EXPECT_TRUE(stream_->IsResponseBodyComplete());
427 EXPECT_TRUE(AtEof()); 427 EXPECT_TRUE(AtEof());
428 } 428 }
429 429
430 // Regression test for http://crbug.com/409101
431 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) {
432 SetRequest("GET", "/", DEFAULT_PRIORITY);
433 Initialize();
434
435 request_.method = "GET";
436 request_.url = GURL("http://www.google.com/");
437
438 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
439 net_log_, callback_.callback()));
440
441 session_->connection()->CloseConnection(QUIC_NO_ERROR, true);
442
443 EXPECT_EQ(ERR_CONNECTION_CLOSED,
444 stream_->SendRequest(headers_, &response_,
445 callback_.callback()));
446 }
447
430 TEST_P(QuicHttpStreamTest, SendPostRequest) { 448 TEST_P(QuicHttpStreamTest, SendPostRequest) {
431 SetRequest("POST", "/", DEFAULT_PRIORITY); 449 SetRequest("POST", "/", DEFAULT_PRIORITY);
432 AddWrite(ConstructRequestHeadersPacket(1, !kFin)); 450 AddWrite(ConstructRequestHeadersPacket(1, !kFin));
433 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); 451 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData));
434 AddWrite(ConstructAckPacket(3, 3, 1)); 452 AddWrite(ConstructAckPacket(3, 3, 1));
435 453
436 Initialize(); 454 Initialize();
437 455
438 ScopedVector<UploadElementReader> element_readers; 456 ScopedVector<UploadElementReader> element_readers;
439 element_readers.push_back( 457 element_readers.push_back(
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 // Set Delegate to NULL and make sure EffectivePriority returns highest 639 // Set Delegate to NULL and make sure EffectivePriority returns highest
622 // priority. 640 // priority.
623 reliable_stream->SetDelegate(NULL); 641 reliable_stream->SetDelegate(NULL);
624 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, 642 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
625 reliable_stream->EffectivePriority()); 643 reliable_stream->EffectivePriority());
626 reliable_stream->SetDelegate(delegate); 644 reliable_stream->SetDelegate(delegate);
627 } 645 }
628 646
629 } // namespace test 647 } // namespace test
630 } // namespace net 648 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698