| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |