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

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

Issue 1568423002: Implement better HPACK Huffman code decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not use binary literals. Created 4 years, 11 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
« no previous file with comments | « net/spdy/hpack/hpack_decoder.cc ('k') | net/spdy/hpack/hpack_huffman_decoder.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/hpack_decoder.h" 5 #include "net/spdy/hpack/hpack_decoder.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 using std::string; 83 using std::string;
84 using test::a2b_hex; 84 using test::a2b_hex;
85 85
86 using testing::ElementsAre; 86 using testing::ElementsAre;
87 using testing::Pair; 87 using testing::Pair;
88 88
89 const size_t kLiteralBound = 1024; 89 const size_t kLiteralBound = 1024;
90 90
91 class HpackDecoderTest : public ::testing::TestWithParam<bool> { 91 class HpackDecoderTest : public ::testing::TestWithParam<bool> {
92 protected: 92 protected:
93 HpackDecoderTest() 93 HpackDecoderTest() : decoder_(), decoder_peer_(&decoder_) {}
94 : decoder_(ObtainHpackHuffmanTable()), decoder_peer_(&decoder_) {}
95 94
96 bool DecodeHeaderBlock(StringPiece str) { 95 bool DecodeHeaderBlock(StringPiece str) {
97 if (GetParam()) { 96 if (GetParam()) {
98 decoder_.HandleControlFrameHeadersStart(&handler_); 97 decoder_.HandleControlFrameHeadersStart(&handler_);
99 } 98 }
100 return decoder_.HandleControlFrameHeadersData(str.data(), str.size()) && 99 return decoder_.HandleControlFrameHeadersData(str.data(), str.size()) &&
101 decoder_.HandleControlFrameHeadersComplete(nullptr); 100 decoder_.HandleControlFrameHeadersComplete(nullptr);
102 } 101 }
103 102
104 const SpdyHeaderBlock& decoded_block() const { 103 const SpdyHeaderBlock& decoded_block() const {
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" 689 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
691 " max-age=3600; version=1"); 690 " max-age=3600; version=1");
692 expectEntry(63, 52, "content-encoding", "gzip"); 691 expectEntry(63, 52, "content-encoding", "gzip");
693 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); 692 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT");
694 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); 693 EXPECT_EQ(215u, decoder_peer_.header_table()->size());
695 } 694 }
696 695
697 } // namespace 696 } // namespace
698 } // namespace test 697 } // namespace test
699 } // namespace net 698 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_decoder.cc ('k') | net/spdy/hpack/hpack_huffman_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698