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/tools/quic/test_tools/quic_test_client.h" | 5 #include "net/tools/quic/test_tools/quic_test_client.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/cert/cert_verify_result.h" | 10 #include "net/cert/cert_verify_result.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 size_t QuicTestClient::bytes_written() const { | 555 size_t QuicTestClient::bytes_written() const { |
556 return bytes_written_; | 556 return bytes_written_; |
557 } | 557 } |
558 | 558 |
559 void QuicTestClient::OnClose(QuicSpdyStream* stream) { | 559 void QuicTestClient::OnClose(QuicSpdyStream* stream) { |
560 if (stream != nullptr) { | 560 if (stream != nullptr) { |
561 // Always close the stream, regardless of whether it was the last stream | 561 // Always close the stream, regardless of whether it was the last stream |
562 // written. | 562 // written. |
563 client()->OnClose(stream); | 563 client()->OnClose(stream); |
| 564 ++num_responses_; |
564 } | 565 } |
565 if (stream_ != stream) { | 566 if (stream_ != stream) { |
566 return; | 567 return; |
567 } | 568 } |
568 if (buffer_body()) { | 569 if (buffer_body()) { |
569 // TODO(fnk): The stream still buffers the whole thing. Fix that. | 570 // TODO(fnk): The stream still buffers the whole thing. Fix that. |
570 response_ = stream_->data(); | 571 response_ = stream_->data(); |
571 } | 572 } |
572 response_complete_ = true; | 573 response_complete_ = true; |
573 response_headers_complete_ = stream_->headers_decompressed(); | 574 response_headers_complete_ = stream_->headers_decompressed(); |
574 SpdyBalsaUtils::SpdyHeadersToResponseHeaders(stream_->response_headers(), | 575 SpdyBalsaUtils::SpdyHeadersToResponseHeaders(stream_->response_headers(), |
575 &response_headers_); | 576 &response_headers_); |
576 response_trailers_ = stream_->received_trailers(); | 577 response_trailers_ = stream_->received_trailers(); |
577 stream_error_ = stream_->stream_error(); | 578 stream_error_ = stream_->stream_error(); |
578 bytes_read_ = stream_->stream_bytes_read() + stream_->header_bytes_read(); | 579 bytes_read_ = stream_->stream_bytes_read() + stream_->header_bytes_read(); |
579 bytes_written_ = | 580 bytes_written_ = |
580 stream_->stream_bytes_written() + stream_->header_bytes_written(); | 581 stream_->stream_bytes_written() + stream_->header_bytes_written(); |
581 response_header_size_ = response_headers_.GetSizeForWriteBuffer(); | 582 response_header_size_ = response_headers_.GetSizeForWriteBuffer(); |
582 response_body_size_ = stream_->data().size(); | 583 response_body_size_ = stream_->data().size(); |
583 stream_ = nullptr; | 584 stream_ = nullptr; |
584 ++num_responses_; | |
585 } | 585 } |
586 | 586 |
587 bool QuicTestClient::CheckVary(const SpdyHeaderBlock& client_request, | 587 bool QuicTestClient::CheckVary(const SpdyHeaderBlock& client_request, |
588 const SpdyHeaderBlock& promise_request, | 588 const SpdyHeaderBlock& promise_request, |
589 const SpdyHeaderBlock& promise_response) { | 589 const SpdyHeaderBlock& promise_response) { |
590 return true; | 590 return true; |
591 } | 591 } |
592 | 592 |
593 void QuicTestClient::OnRendezvousResult(QuicSpdyStream* stream) { | 593 void QuicTestClient::OnRendezvousResult(QuicSpdyStream* stream) { |
594 std::unique_ptr<TestClientDataToResend> data_to_resend = | 594 std::unique_ptr<TestClientDataToResend> data_to_resend = |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 CHECK(message); | 667 CHECK(message); |
668 message->headers()->SetRequestVersion( | 668 message->headers()->SetRequestVersion( |
669 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 669 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
670 message->headers()->SetRequestMethod( | 670 message->headers()->SetRequestMethod( |
671 HTTPMessage::MethodToString(HttpConstants::GET)); | 671 HTTPMessage::MethodToString(HttpConstants::GET)); |
672 message->headers()->SetRequestUri(uri); | 672 message->headers()->SetRequestUri(uri); |
673 } | 673 } |
674 | 674 |
675 } // namespace test | 675 } // namespace test |
676 } // namespace net | 676 } // namespace net |
OLD | NEW |