Add logging for headers sent and received in BidirectionalStreamQuicImpl
This CL refactors headers logging in QuicHttpStream and moves them to QuicChromiumClientStream so the logging can be shared with BidirectionalStreamQuicImpl. BUG=596680 Review URL: https://codereview.chromium.org/1824403002 Cr-Commit-Position: refs/heads/master@{#382972}
This commit is contained in:
@ -1803,18 +1803,6 @@ EVENT_TYPE(QUIC_SESSION_CLOSED)
|
||||
// QuicHttpStream
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// The stream is sending the request headers.
|
||||
// {
|
||||
// "headers": <The list of header:value pairs>
|
||||
// }
|
||||
EVENT_TYPE(QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS)
|
||||
|
||||
// The stream has read the response headers.
|
||||
// {
|
||||
// "headers": <The list of header:value pairs>
|
||||
// }
|
||||
EVENT_TYPE(QUIC_HTTP_STREAM_READ_RESPONSE_HEADERS)
|
||||
|
||||
// A stream request's url matches a received push promise. The
|
||||
// promised stream can be adopted for this request once vary header
|
||||
// validation is complete (as part of response header processing).
|
||||
@ -1839,6 +1827,28 @@ EVENT_TYPE(QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM)
|
||||
// }
|
||||
EVENT_TYPE(HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION)
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// QuicChromiumClientStream
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// The stream is sending the request headers.
|
||||
// {
|
||||
// "headers": <The list of header:value pairs>
|
||||
// }
|
||||
EVENT_TYPE(QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS)
|
||||
|
||||
// The stream has read the response headers.
|
||||
// {
|
||||
// "headers": <The list of header:value pairs>
|
||||
// }
|
||||
EVENT_TYPE(QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS)
|
||||
|
||||
// The stream has read the response trailers.
|
||||
// {
|
||||
// "headers": <The list of header:value pairs>
|
||||
// }
|
||||
EVENT_TYPE(QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS)
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// HttpStreamParser
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/http/bidirectional_stream_request_info.h"
|
||||
#include "net/http/transport_security_state.h"
|
||||
#include "net/log/test_net_log.h"
|
||||
#include "net/log/test_net_log_util.h"
|
||||
#include "net/quic/crypto/crypto_protocol.h"
|
||||
#include "net/quic/crypto/quic_decrypter.h"
|
||||
#include "net/quic/crypto/quic_encrypter.h"
|
||||
@ -272,8 +274,7 @@ class BidirectionalStreamQuicImplTest
|
||||
};
|
||||
|
||||
BidirectionalStreamQuicImplTest()
|
||||
: net_log_(BoundNetLog()),
|
||||
crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
|
||||
: crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
|
||||
read_buffer_(new IOBufferWithSize(4096)),
|
||||
connection_id_(2),
|
||||
stream_id_(kClientDataStreamId1),
|
||||
@ -322,8 +323,8 @@ class BidirectionalStreamQuicImplTest
|
||||
socket_data_.reset(new StaticSocketDataProvider(
|
||||
nullptr, 0, mock_writes_.get(), writes_.size()));
|
||||
|
||||
MockUDPClientSocket* socket =
|
||||
new MockUDPClientSocket(socket_data_.get(), net_log_.net_log());
|
||||
MockUDPClientSocket* socket = new MockUDPClientSocket(
|
||||
socket_data_.get(), net_log().bound().net_log());
|
||||
socket->Connect(peer_addr_);
|
||||
runner_ = new TestTaskRunner(&clock_);
|
||||
helper_.reset(new QuicChromiumConnectionHelper(runner_.get(), &clock_,
|
||||
@ -344,7 +345,7 @@ class BidirectionalStreamQuicImplTest
|
||||
/*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
|
||||
"CONNECTION_UNKNOWN", base::TimeTicks::Now(), &push_promise_index_,
|
||||
base::ThreadTaskRunnerHandle::Get().get(),
|
||||
/*socket_performance_watcher=*/nullptr, nullptr));
|
||||
/*socket_performance_watcher=*/nullptr, net_log().bound().net_log()));
|
||||
session_->Initialize();
|
||||
session_->GetCryptoStream()->CryptoConnect();
|
||||
EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
|
||||
@ -458,12 +459,12 @@ class BidirectionalStreamQuicImplTest
|
||||
!kIncludeCongestionFeedback);
|
||||
}
|
||||
|
||||
const BoundNetLog& net_log() const { return net_log_; }
|
||||
const BoundTestNetLog& net_log() const { return net_log_; }
|
||||
|
||||
QuicChromiumClientSession* session() const { return session_.get(); }
|
||||
|
||||
private:
|
||||
BoundNetLog net_log_;
|
||||
BoundTestNetLog net_log_;
|
||||
scoped_refptr<TestTaskRunner> runner_;
|
||||
scoped_ptr<MockWrite[]> mock_writes_;
|
||||
MockClock clock_;
|
||||
@ -510,7 +511,7 @@ TEST_P(BidirectionalStreamQuicImplTest, GetRequest) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -565,6 +566,21 @@ TEST_P(BidirectionalStreamQuicImplTest, GetRequest) {
|
||||
static_cast<int64_t>(spdy_response_headers_frame_length +
|
||||
strlen(kResponseBody) + spdy_trailers_frame_length),
|
||||
delegate->GetTotalReceivedBytes());
|
||||
// Check that NetLog was filled as expected.
|
||||
TestNetLogEntry::List entries;
|
||||
net_log().GetEntries(&entries);
|
||||
size_t pos = ExpectLogContainsSomewhere(
|
||||
entries, /*min_offset=*/0,
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
NetLog::PHASE_NONE);
|
||||
pos = ExpectLogContainsSomewhere(
|
||||
entries, /*min_offset=*/pos,
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
NetLog::PHASE_NONE);
|
||||
ExpectLogContainsSomewhere(
|
||||
entries, /*min_offset=*/pos,
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
NetLog::PHASE_NONE);
|
||||
}
|
||||
|
||||
TEST_P(BidirectionalStreamQuicImplTest, PostRequest) {
|
||||
@ -586,7 +602,7 @@ TEST_P(BidirectionalStreamQuicImplTest, PostRequest) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Send a DATA frame.
|
||||
@ -663,7 +679,7 @@ TEST_P(BidirectionalStreamQuicImplTest, InterleaveReadDataAndSendData) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -740,7 +756,7 @@ TEST_P(BidirectionalStreamQuicImplTest, ServerSendsRstAfterHeaders) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server sends a Rst.
|
||||
@ -779,7 +795,7 @@ TEST_P(BidirectionalStreamQuicImplTest, ServerSendsRstAfterReadData) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -836,7 +852,7 @@ TEST_P(BidirectionalStreamQuicImplTest, CancelStreamAfterSendData) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -886,7 +902,7 @@ TEST_P(BidirectionalStreamQuicImplTest, SessionClosedBeforeReadData) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -940,7 +956,7 @@ TEST_P(BidirectionalStreamQuicImplTest, CancelStreamAfterReadData) {
|
||||
scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
|
||||
scoped_ptr<TestDelegateBase> delegate(
|
||||
new TestDelegateBase(read_buffer.get(), kReadBufferSize));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -990,7 +1006,7 @@ TEST_P(BidirectionalStreamQuicImplTest, DeleteStreamDuringOnHeadersReceived) {
|
||||
scoped_ptr<DeleteStreamDelegate> delegate(new DeleteStreamDelegate(
|
||||
read_buffer.get(), kReadBufferSize,
|
||||
DeleteStreamDelegate::ON_HEADERS_RECEIVED, true));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -1033,7 +1049,7 @@ TEST_P(BidirectionalStreamQuicImplTest, DeleteStreamDuringOnDataRead) {
|
||||
scoped_ptr<DeleteStreamDelegate> delegate(
|
||||
new DeleteStreamDelegate(read_buffer.get(), kReadBufferSize,
|
||||
DeleteStreamDelegate::ON_DATA_READ, true));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
@ -1085,7 +1101,7 @@ TEST_P(BidirectionalStreamQuicImplTest, DeleteStreamDuringOnTrailersReceived) {
|
||||
scoped_ptr<DeleteStreamDelegate> delegate(new DeleteStreamDelegate(
|
||||
read_buffer.get(), kReadBufferSize,
|
||||
DeleteStreamDelegate::ON_TRAILERS_RECEIVED, true));
|
||||
delegate->Start(&request, net_log(), session()->GetWeakPtr());
|
||||
delegate->Start(&request, net_log().bound(), session()->GetWeakPtr());
|
||||
delegate->WaitUntilNextCallback(); // OnHeadersSent
|
||||
|
||||
// Server acks the request.
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/quic/quic_chromium_client_session.h"
|
||||
#include "net/quic/quic_http_utils.h"
|
||||
#include "net/quic/quic_spdy_session.h"
|
||||
#include "net/quic/quic_write_blocked_list.h"
|
||||
#include "net/quic/spdy_utils.h"
|
||||
@ -104,6 +105,17 @@ void QuicChromiumClientStream::OnCanWrite() {
|
||||
}
|
||||
}
|
||||
|
||||
size_t QuicChromiumClientStream::WriteHeaders(
|
||||
const SpdyHeaderBlock& header_block,
|
||||
bool fin,
|
||||
QuicAckListenerInterface* ack_notifier_delegate) {
|
||||
net_log_.AddEvent(
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
base::Bind(&QuicRequestNetLogCallback, id(), &header_block,
|
||||
QuicSpdyStream::priority()));
|
||||
return QuicSpdyStream::WriteHeaders(header_block, fin, ack_notifier_delegate);
|
||||
}
|
||||
|
||||
SpdyPriority QuicChromiumClientStream::priority() const {
|
||||
if (delegate_ && delegate_->HasSendHeadersComplete()) {
|
||||
return QuicSpdyStream::priority();
|
||||
@ -187,10 +199,18 @@ void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete(
|
||||
if (!delegate_)
|
||||
return;
|
||||
// Only mark trailers consumed when we are about to notify delegate.
|
||||
if (headers_delivered_)
|
||||
if (headers_delivered_) {
|
||||
MarkTrailersConsumed(decompressed_trailers().length());
|
||||
net_log_.AddEvent(
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
|
||||
base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
|
||||
} else {
|
||||
headers_delivered_ = true;
|
||||
net_log_.AddEvent(
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
|
||||
base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
|
||||
}
|
||||
|
||||
headers_delivered_ = true;
|
||||
delegate_->OnHeadersAvailable(headers, frame_len);
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,9 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream {
|
||||
void OnDataAvailable() override;
|
||||
void OnClose() override;
|
||||
void OnCanWrite() override;
|
||||
size_t WriteHeaders(const SpdyHeaderBlock& header_block,
|
||||
bool fin,
|
||||
QuicAckListenerInterface* ack_notifier_delegate) override;
|
||||
SpdyPriority priority() const override;
|
||||
|
||||
// While the server's set_priority shouldn't be called externally, the creator
|
||||
|
@ -637,12 +637,6 @@ int QuicHttpStream::DoSendHeaders() {
|
||||
NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
|
||||
base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
|
||||
priority_));
|
||||
// Also log to the QuicSession's net log.
|
||||
stream_->net_log().AddEvent(
|
||||
NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS,
|
||||
base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
|
||||
priority_));
|
||||
|
||||
bool has_upload_data = request_body_stream_ != nullptr;
|
||||
|
||||
next_state_ = STATE_SEND_HEADERS_COMPLETE;
|
||||
@ -733,12 +727,6 @@ int QuicHttpStream::DoSendBodyComplete(int rv) {
|
||||
}
|
||||
|
||||
int QuicHttpStream::ProcessResponseHeaders(const SpdyHeaderBlock& headers) {
|
||||
// The URLRequest logs these headers, so only log to the QuicSession's
|
||||
// net log.
|
||||
stream_->net_log().AddEvent(
|
||||
NetLog::TYPE_QUIC_HTTP_STREAM_READ_RESPONSE_HEADERS,
|
||||
base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
|
||||
|
||||
if (!SpdyHeadersToHttpResponse(headers, HTTP2, response_info_)) {
|
||||
DLOG(WARNING) << "Invalid headers";
|
||||
return ERR_QUIC_PROTOCOL_ERROR;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/http/transport_security_state.h"
|
||||
#include "net/log/test_net_log.h"
|
||||
#include "net/log/test_net_log_util.h"
|
||||
#include "net/quic/congestion_control/send_algorithm_interface.h"
|
||||
#include "net/quic/crypto/crypto_protocol.h"
|
||||
#include "net/quic/crypto/proof_verifier_chromium.h"
|
||||
@ -136,8 +138,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
|
||||
};
|
||||
|
||||
QuicHttpStreamTest()
|
||||
: net_log_(BoundNetLog()),
|
||||
use_closing_stream_(false),
|
||||
: use_closing_stream_(false),
|
||||
crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
|
||||
read_buffer_(new IOBufferWithSize(4096)),
|
||||
promise_id_(kServerDataStreamId1),
|
||||
@ -196,7 +197,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
|
||||
nullptr, 0, mock_writes_.get(), writes_.size()));
|
||||
|
||||
MockUDPClientSocket* socket =
|
||||
new MockUDPClientSocket(socket_data_.get(), net_log_.net_log());
|
||||
new MockUDPClientSocket(socket_data_.get(), net_log_.bound().net_log());
|
||||
socket->Connect(peer_addr_);
|
||||
runner_ = new TestTaskRunner(&clock_);
|
||||
send_algorithm_ = new MockSendAlgorithm();
|
||||
@ -243,7 +244,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
|
||||
/*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
|
||||
"CONNECTION_UNKNOWN", base::TimeTicks::Now(), &push_promise_index_,
|
||||
base::ThreadTaskRunnerHandle::Get().get(),
|
||||
/*socket_performance_watcher=*/nullptr, nullptr));
|
||||
/*socket_performance_watcher=*/nullptr, net_log_.bound().net_log()));
|
||||
session_->Initialize();
|
||||
session_->GetCryptoStream()->CryptoConnect();
|
||||
EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
|
||||
@ -417,7 +418,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
|
||||
stream->OnPromiseHeadersComplete(id, serialized_push_promise_.size());
|
||||
}
|
||||
|
||||
BoundNetLog net_log_;
|
||||
BoundTestNetLog net_log_;
|
||||
bool use_closing_stream_;
|
||||
MockSendAlgorithm* send_algorithm_;
|
||||
scoped_refptr<TestTaskRunner> runner_;
|
||||
@ -480,8 +481,9 @@ TEST_P(QuicHttpStreamTest, CanReuseConnection) {
|
||||
TEST_P(QuicHttpStreamTest, DisableConnectionMigrationForStream) {
|
||||
request_.load_flags |= LOAD_DISABLE_CONNECTION_MIGRATION;
|
||||
Initialize();
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
QuicChromiumClientStream* client_stream =
|
||||
QuicHttpStreamPeer::GetQuicChromiumClientStream(stream_.get());
|
||||
EXPECT_FALSE(client_stream->can_migrate());
|
||||
@ -497,8 +499,9 @@ TEST_P(QuicHttpStreamTest, GetRequest) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -549,8 +552,10 @@ TEST_P(QuicHttpStreamTest, GetRequestWithTrailers) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -608,6 +613,21 @@ TEST_P(QuicHttpStreamTest, GetRequestWithTrailers) {
|
||||
static_cast<int64_t>(spdy_response_header_frame_length +
|
||||
strlen(kResponseBody) + +spdy_trailers_frame_length),
|
||||
stream_->GetTotalReceivedBytes());
|
||||
// Check that NetLog was filled as expected.
|
||||
TestNetLogEntry::List entries;
|
||||
net_log_.GetEntries(&entries);
|
||||
size_t pos = ExpectLogContainsSomewhere(
|
||||
entries, /*min_offset=*/0,
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
NetLog::PHASE_NONE);
|
||||
pos = ExpectLogContainsSomewhere(
|
||||
entries, /*min_offset=*/pos,
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
NetLog::PHASE_NONE);
|
||||
ExpectLogContainsSomewhere(
|
||||
entries, /*min_offset=*/pos,
|
||||
NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
|
||||
NetLog::PHASE_NONE);
|
||||
}
|
||||
|
||||
// Regression test for http://crbug.com/288128
|
||||
@ -621,8 +641,9 @@ TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -671,8 +692,9 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
session_->connection()->CloseConnection(QUIC_NO_ERROR,
|
||||
ConnectionCloseSource::FROM_PEER);
|
||||
@ -692,8 +714,9 @@ TEST_P(QuicHttpStreamTest, GetSSLInfoAfterSessionClosed) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
SSLInfo ssl_info;
|
||||
EXPECT_FALSE(ssl_info.is_valid());
|
||||
@ -720,8 +743,9 @@ TEST_P(QuicHttpStreamTest, LogGranularQuicConnectionError) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -750,8 +774,9 @@ TEST_P(QuicHttpStreamTest, DoNotLogGranularQuicErrorIfHandshakeNotConfirmed) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -784,8 +809,9 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeReadResponseHeaders) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
@ -821,8 +847,9 @@ TEST_P(QuicHttpStreamTest, SendPostRequest) {
|
||||
request_.upload_data_stream = &upload_data_stream;
|
||||
ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback()));
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -884,8 +911,9 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequest) {
|
||||
ASSERT_EQ(OK, request_.upload_data_stream->Init(
|
||||
TestCompletionCallback().callback()));
|
||||
|
||||
ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
ASSERT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
ASSERT_EQ(ERR_IO_PENDING,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -951,8 +979,9 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithFinalEmptyDataPacket) {
|
||||
ASSERT_EQ(OK, request_.upload_data_stream->Init(
|
||||
TestCompletionCallback().callback()));
|
||||
|
||||
ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
ASSERT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
ASSERT_EQ(ERR_IO_PENDING,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -1013,8 +1042,9 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithOneEmptyDataPacket) {
|
||||
ASSERT_EQ(OK, request_.upload_data_stream->Init(
|
||||
TestCompletionCallback().callback()));
|
||||
|
||||
ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
ASSERT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
ASSERT_EQ(ERR_IO_PENDING,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -1070,8 +1100,9 @@ TEST_P(QuicHttpStreamTest, DestroyedEarly) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
|
||||
@ -1108,7 +1139,7 @@ TEST_P(QuicHttpStreamTest, Priority) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_,
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
// Check that priority is highest.
|
||||
@ -1157,7 +1188,7 @@ TEST_P(QuicHttpStreamTest, CheckPriorityWithNoDelegate) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_,
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
// Check that priority is highest.
|
||||
@ -1191,8 +1222,9 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendHeadersComplete) {
|
||||
ASSERT_EQ(OK, request_.upload_data_stream->Init(
|
||||
TestCompletionCallback().callback()));
|
||||
|
||||
ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
ASSERT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
}
|
||||
@ -1215,8 +1247,9 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBodyComplete) {
|
||||
ASSERT_EQ(OK, request_.upload_data_stream->Init(
|
||||
TestCompletionCallback().callback()));
|
||||
|
||||
ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
ASSERT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR,
|
||||
stream_->SendRequest(headers_, &response_, callback_.callback()));
|
||||
}
|
||||
@ -1229,8 +1262,9 @@ TEST_P(QuicHttpStreamTest, ServerPushGetRequest) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
// TODO(ckrasic) - could do this via constructing a PUSH_PROMISE
|
||||
// packet, but does it matter?
|
||||
@ -1241,9 +1275,9 @@ TEST_P(QuicHttpStreamTest, ServerPushGetRequest) {
|
||||
|
||||
// Make the second stream that will exercise the first step of the
|
||||
// server push rendezvous mechanism.
|
||||
EXPECT_EQ(OK,
|
||||
promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_, callback_.callback()));
|
||||
EXPECT_EQ(OK, promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
// Receive the promised response headers.
|
||||
response_headers_ = promised_response_;
|
||||
@ -1293,8 +1327,9 @@ TEST_P(QuicHttpStreamTest, ServerPushGetRequestSlowResponse) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
// TODO(ckrasic) - could do this via constructing a PUSH_PROMISE
|
||||
// packet, but does it matter?
|
||||
@ -1305,9 +1340,9 @@ TEST_P(QuicHttpStreamTest, ServerPushGetRequestSlowResponse) {
|
||||
|
||||
// Make the second stream that will exercise the first step of the
|
||||
// server push rendezvous mechanism.
|
||||
EXPECT_EQ(OK,
|
||||
promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_, callback_.callback()));
|
||||
EXPECT_EQ(OK, promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
// Now sending a matching request will rendezvous with the promised
|
||||
// stream, but pending secondary validation.
|
||||
@ -1364,8 +1399,9 @@ TEST_P(QuicHttpStreamTest, ServerPushCrossOriginOK) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
// TODO(ckrasic) - could do this via constructing a PUSH_PROMISE
|
||||
// packet, but does it matter?
|
||||
@ -1382,9 +1418,9 @@ TEST_P(QuicHttpStreamTest, ServerPushCrossOriginOK) {
|
||||
|
||||
// Make the second stream that will exercise the first step of the
|
||||
// server push rendezvous mechanism.
|
||||
EXPECT_EQ(OK,
|
||||
promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_, callback_.callback()));
|
||||
EXPECT_EQ(OK, promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
// Receive the promised response headers.
|
||||
response_headers_ = promised_response_;
|
||||
@ -1434,8 +1470,9 @@ TEST_P(QuicHttpStreamTest, ServerPushCrossOriginFail) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
// TODO(ckrasic) - could do this via constructing a PUSH_PROMISE
|
||||
// packet, but does it matter?
|
||||
@ -1458,8 +1495,9 @@ TEST_P(QuicHttpStreamTest, ServerPushVaryCheckOK) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
push_promise_["accept-encoding"] = "gzip";
|
||||
serialized_push_promise_ =
|
||||
@ -1474,9 +1512,9 @@ TEST_P(QuicHttpStreamTest, ServerPushVaryCheckOK) {
|
||||
|
||||
// Make the second stream that will exercise the first step of the
|
||||
// server push rendezvous mechanism.
|
||||
EXPECT_EQ(OK,
|
||||
promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_, callback_.callback()));
|
||||
EXPECT_EQ(OK, promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
headers_.SetHeader("accept-encoding", "gzip");
|
||||
|
||||
@ -1547,8 +1585,9 @@ TEST_P(QuicHttpStreamTest, ServerPushVaryCheckFail) {
|
||||
request_.method = "GET";
|
||||
request_.url = GURL("http://www.example.org/");
|
||||
|
||||
EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
|
||||
callback_.callback()));
|
||||
EXPECT_EQ(OK,
|
||||
stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(), callback_.callback()));
|
||||
|
||||
push_promise_["accept-encoding"] = "gzip";
|
||||
serialized_push_promise_ =
|
||||
@ -1563,9 +1602,9 @@ TEST_P(QuicHttpStreamTest, ServerPushVaryCheckFail) {
|
||||
|
||||
// Make the second stream that will exercise the first step of the
|
||||
// server push rendezvous mechanism.
|
||||
EXPECT_EQ(OK,
|
||||
promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_, callback_.callback()));
|
||||
EXPECT_EQ(OK, promised_stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
|
||||
net_log_.bound(),
|
||||
callback_.callback()));
|
||||
|
||||
headers_.SetHeader("accept-encoding", "sdch");
|
||||
|
||||
|
Reference in New Issue
Block a user