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

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

Issue 14651009: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integer constant is too large for 'unsigned long' type Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 headers[":scheme"] = "http"; 198 headers[":scheme"] = "http";
199 headers[":version"] = "HTTP/1.1"; 199 headers[":version"] = "HTTP/1.1";
200 request_data_ = SerializeHeaderBlock(headers); 200 request_data_ = SerializeHeaderBlock(headers);
201 } 201 }
202 202
203 void SetResponseString(const std::string& status, const std::string& body) { 203 void SetResponseString(const std::string& status, const std::string& body) {
204 SpdyHeaderBlock headers; 204 SpdyHeaderBlock headers;
205 headers[":status"] = status; 205 headers[":status"] = status;
206 headers[":version"] = "HTTP/1.1"; 206 headers[":version"] = "HTTP/1.1";
207 headers["content-type"] = "text/plain"; 207 headers["content-type"] = "text/plain";
208 response_data_ = SerializeHeaderBlock(headers) + body; 208 response_data_ = session_->compressor()->CompressHeaders(headers) + body;
209 } 209 }
210 210
211 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers) { 211 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers) {
212 size_t len = SpdyFramer::GetSerializedLength(3, &headers); 212 size_t len = SpdyFramer::GetSerializedLength(3, &headers);
213 SpdyFrameBuilder builder(len); 213 SpdyFrameBuilder builder(len);
214 SpdyFramer::WriteHeaderBlock(&builder, 3, &headers); 214 SpdyFramer::WriteHeaderBlock(&builder, 3, &headers);
215 scoped_ptr<SpdyFrame> frame(builder.take()); 215 scoped_ptr<SpdyFrame> frame(builder.take());
216 return std::string(frame->data(), len); 216 return std::string(frame->data(), len);
217 } 217 }
218 218
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 callback_.callback())); 547 callback_.callback()));
548 EXPECT_EQ(&response_, stream_->GetResponseInfo()); 548 EXPECT_EQ(&response_, stream_->GetResponseInfo());
549 549
550 // Ack the request. 550 // Ack the request.
551 scoped_ptr<QuicEncryptedPacket> ack(ConstructAckPacket(1, 0, 0)); 551 scoped_ptr<QuicEncryptedPacket> ack(ConstructAckPacket(1, 0, 0));
552 ProcessPacket(*ack); 552 ProcessPacket(*ack);
553 EXPECT_EQ(ERR_IO_PENDING, 553 EXPECT_EQ(ERR_IO_PENDING,
554 stream_->ReadResponseHeaders(callback_.callback())); 554 stream_->ReadResponseHeaders(callback_.callback()));
555 555
556 // Send the response with a body. 556 // Send the response with a body.
557 const char kResponseHeaders[] = "HTTP/1.1 404 OK\r\n" 557 SetResponseString("404 OK", "hello world!");
558 "Content-Type: text/plain\r\n\r\nhello world!";
559 scoped_ptr<QuicEncryptedPacket> resp( 558 scoped_ptr<QuicEncryptedPacket> resp(
560 ConstructDataPacket(2, false, kFin, 0, kResponseHeaders)); 559 ConstructDataPacket(2, false, kFin, 0, response_data_));
561 560
562 // In the course of processing this packet, the QuicHttpStream close itself. 561 // In the course of processing this packet, the QuicHttpStream close itself.
563 ProcessPacket(*resp); 562 ProcessPacket(*resp);
564 563
565 EXPECT_TRUE(AtEof()); 564 EXPECT_TRUE(AtEof());
566 } 565 }
567 566
568 } // namespace test 567 } // namespace test
569 568
570 } // namespace net 569 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698