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

Side by Side Diff: net/spdy/hpack/hpack_round_trip_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_input_stream_test.cc ('k') | net/spdy/spdy_framer.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 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 <cmath> 5 #include <cmath>
6 #include <ctime> 6 #include <ctime>
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "net/spdy/hpack/hpack_constants.h" 12 #include "net/spdy/hpack/hpack_constants.h"
13 #include "net/spdy/hpack/hpack_decoder.h" 13 #include "net/spdy/hpack/hpack_decoder.h"
14 #include "net/spdy/hpack/hpack_encoder.h" 14 #include "net/spdy/hpack/hpack_encoder.h"
15 #include "net/spdy/spdy_test_utils.h" 15 #include "net/spdy/spdy_test_utils.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace net { 18 namespace net {
19 namespace test { 19 namespace test {
20 20
21 using std::map; 21 using std::map;
22 using std::string; 22 using std::string;
23 using std::vector; 23 using std::vector;
24 24
25 namespace { 25 namespace {
26 26
27 class HpackRoundTripTest : public ::testing::Test { 27 class HpackRoundTripTest : public ::testing::Test {
28 protected: 28 protected:
29 HpackRoundTripTest() 29 HpackRoundTripTest() : encoder_(ObtainHpackHuffmanTable()), decoder_() {}
30 : encoder_(ObtainHpackHuffmanTable()),
31 decoder_(ObtainHpackHuffmanTable()) {}
32 30
33 void SetUp() override { 31 void SetUp() override {
34 // Use a small table size to tickle eviction handling. 32 // Use a small table size to tickle eviction handling.
35 encoder_.ApplyHeaderTableSizeSetting(256); 33 encoder_.ApplyHeaderTableSizeSetting(256);
36 decoder_.ApplyHeaderTableSizeSetting(256); 34 decoder_.ApplyHeaderTableSizeSetting(256);
37 } 35 }
38 36
39 bool RoundTrip(const SpdyHeaderBlock& header_set) { 37 bool RoundTrip(const SpdyHeaderBlock& header_set) {
40 string encoded; 38 string encoded;
41 encoder_.EncodeHeaderSet(header_set, &encoded); 39 encoder_.EncodeHeaderSet(header_set, &encoded);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 headers[name] = value; 193 headers[name] = value;
196 } 194 }
197 EXPECT_TRUE(RoundTrip(headers)); 195 EXPECT_TRUE(RoundTrip(headers));
198 } 196 }
199 } 197 }
200 198
201 } // namespace 199 } // namespace
202 200
203 } // namespace test 201 } // namespace test
204 } // namespace net 202 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_input_stream_test.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698