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

Side by Side Diff: net/spdy/hpack_decoder_test.cc

Issue 247793002: HPACK: Refactor and simplify HpackOutputStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « no previous file | net/spdy/hpack_encoder.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/spdy/hpack_decoder.h" 5 #include "net/spdy/hpack_decoder.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 EXPECT_EQ(kDefaultHeaderTableSizeSetting, 245 EXPECT_EQ(kDefaultHeaderTableSizeSetting,
246 decoder_peer_.header_table().max_size()); 246 decoder_peer_.header_table().max_size());
247 { 247 {
248 // Maximum-size update with size 126. Succeeds. 248 // Maximum-size update with size 126. Succeeds.
249 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x80\x7e", 2))); 249 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x80\x7e", 2)));
250 EXPECT_EQ(126u, decoder_peer_.header_table().max_size()); 250 EXPECT_EQ(126u, decoder_peer_.header_table().max_size());
251 } 251 }
252 string input; 252 string input;
253 { 253 {
254 // Maximum-size update with kDefaultHeaderTableSizeSetting. Succeeds. 254 // Maximum-size update with kDefaultHeaderTableSizeSetting. Succeeds.
255 HpackOutputStream output_stream(kuint32max); 255 HpackOutputStream output_stream;
256 output_stream.AppendBits(0x80, 8); // Context update. 256 output_stream.AppendBits(0x80, 8); // Context update.
257 output_stream.AppendBits(0x00, 1); // Size update. 257 output_stream.AppendBits(0x00, 1); // Size update.
258 output_stream.AppendUint32ForTest(kDefaultHeaderTableSizeSetting); 258 output_stream.AppendUint32(kDefaultHeaderTableSizeSetting);
259 259
260 output_stream.TakeString(&input); 260 output_stream.TakeString(&input);
261 EXPECT_TRUE(DecodeHeaderBlock(StringPiece(input))); 261 EXPECT_TRUE(DecodeHeaderBlock(StringPiece(input)));
262 EXPECT_EQ(kDefaultHeaderTableSizeSetting, 262 EXPECT_EQ(kDefaultHeaderTableSizeSetting,
263 decoder_peer_.header_table().max_size()); 263 decoder_peer_.header_table().max_size());
264 } 264 }
265 { 265 {
266 // Maximum-size update with kDefaultHeaderTableSizeSetting + 1. Fails. 266 // Maximum-size update with kDefaultHeaderTableSizeSetting + 1. Fails.
267 HpackOutputStream output_stream(kuint32max); 267 HpackOutputStream output_stream;
268 output_stream.AppendBits(0x80, 8); // Context update. 268 output_stream.AppendBits(0x80, 8); // Context update.
269 output_stream.AppendBits(0x00, 1); // Size update. 269 output_stream.AppendBits(0x00, 1); // Size update.
270 output_stream.AppendUint32ForTest(kDefaultHeaderTableSizeSetting + 1); 270 output_stream.AppendUint32(kDefaultHeaderTableSizeSetting + 1);
271 271
272 output_stream.TakeString(&input); 272 output_stream.TakeString(&input);
273 EXPECT_FALSE(DecodeHeaderBlock(StringPiece(input))); 273 EXPECT_FALSE(DecodeHeaderBlock(StringPiece(input)));
274 EXPECT_EQ(kDefaultHeaderTableSizeSetting, 274 EXPECT_EQ(kDefaultHeaderTableSizeSetting,
275 decoder_peer_.header_table().max_size()); 275 decoder_peer_.header_table().max_size());
276 } 276 }
277 } 277 }
278 278
279 TEST_F(HpackDecoderTest, ContextUpdateClearReferenceSet) { 279 TEST_F(HpackDecoderTest, ContextUpdateClearReferenceSet) {
280 // Toggle on a couple of headers. 280 // Toggle on a couple of headers.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 Pair("content-encoding", "gzip"), 599 Pair("content-encoding", "gzip"),
600 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"), 600 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
601 Pair("location", "https://www.example.com"), 601 Pair("location", "https://www.example.com"),
602 Pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" 602 Pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
603 " max-age=3600; version=1"))); 603 " max-age=3600; version=1")));
604 } 604 }
605 605
606 } // namespace 606 } // namespace
607 607
608 } // namespace net 608 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/hpack_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698