| Index: net/tools/quic/end_to_end_test.cc
|
| diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
|
| index 441a5d9beac9e697c29560c1dd2d49d996f2b028..f761c907c8d78cd5f7bc8a656da09d291bfb9266 100644
|
| --- a/net/tools/quic/end_to_end_test.cc
|
| +++ b/net/tools/quic/end_to_end_test.cc
|
| @@ -1948,10 +1948,13 @@ class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream {
|
| SpdyHeaderBlock headers;
|
| headers[":status"] = "500";
|
| headers["content-length"] = base::UintToString(response_body_.size());
|
| + response_.set_headers(headers);
|
| + response_.set_body(response_body_);
|
| // This method must call CloseReadSide to cause the test case, StopReading
|
| // is not sufficient.
|
| ReliableQuicStreamPeer::CloseReadSide(this);
|
| - SendHeadersAndBody(headers, response_body_);
|
| + next_state_ = SEND_HEADERS;
|
| + DoLoop();
|
| }
|
|
|
| string response_body_;
|
| @@ -2120,6 +2123,44 @@ TEST_P(EndToEndTest, Trailers) {
|
| EXPECT_EQ(trailers, client_->response_trailers());
|
| }
|
|
|
| +TEST_P(EndToEndTest, MultipartResponse) {
|
| + // Test QuicInMemoryCache::AddBidirectionalResponse with multipart response
|
| + // body works. However, this does not have full coverage since the client only
|
| + // supports request/response and not bidirectional streaming.
|
| + ASSERT_TRUE(Initialize());
|
| + client_->client()->WaitForCryptoHandshakeConfirmed();
|
| +
|
| + // Set reordering to ensure that Trailers arriving before body is ok.
|
| + SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(2));
|
| + SetReorderPercentage(30);
|
| +
|
| + // Add a response with headers, body, and trailers.
|
| + const string kBody = "body content";
|
| +
|
| + SpdyHeaderBlock headers;
|
| + headers[":status"] = "200";
|
| + headers[":version"] = "HTTP/1.1";
|
| + headers["content-length"] = IntToString(kBody.size());
|
| +
|
| + SpdyHeaderBlock trailers;
|
| + trailers["some-trailing-header"] = "trailing-header-value";
|
| + std::vector<std::string> multipart_body;
|
| + multipart_body.push_back("hellooo!");
|
| + multipart_body.push_back("here's my second part.");
|
| + multipart_body.push_back("here's my third part.");
|
| +
|
| + QuicInMemoryCache::GetInstance()->AddBidirectionalResponse(
|
| + "www.google.com", "/trailer_url", 200, multipart_body, trailers);
|
| +
|
| + std::string expected;
|
| + for (auto s : multipart_body) {
|
| + expected.append(s);
|
| + }
|
| + EXPECT_EQ(expected, client_->SendSynchronousRequest("/trailer_url"));
|
| + EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
|
| + EXPECT_EQ(trailers, client_->response_trailers());
|
| +}
|
| +
|
| class EndToEndTestServerPush : public EndToEndTest {
|
| protected:
|
| const size_t kNumMaxStreams = 10;
|
|
|