| 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 "net/spdy/hpack_input_stream.h" | 5 #include "net/spdy/hpack_input_stream.h" |
| 6 | 6 |
| 7 #include <bitset> | 7 #include <bitset> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "net/spdy/hpack_constants.h" | 13 #include "net/spdy/hpack_constants.h" |
| 14 #include "net/spdy/spdy_test_utils.h" | 14 #include "net/spdy/spdy_test_utils.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 using base::StringPiece; | 21 using base::StringPiece; |
| 22 using std::string; | 22 using std::string; |
| 23 using test::a2b_hex; | 23 using test::a2b_hex; |
| 24 | 24 |
| 25 const size_t kLiteralBound = 1024; | 25 const size_t kLiteralBound = 1024; |
| 26 | 26 |
| 27 class HpackInputStreamTest : public ::testing::Test { | 27 class HpackInputStreamTest : public ::testing::Test { |
| 28 public: | 28 public: |
| 29 virtual void SetUp() { | 29 void SetUp() override { |
| 30 std::vector<HpackHuffmanSymbol> code = HpackHuffmanCode(); | 30 std::vector<HpackHuffmanSymbol> code = HpackHuffmanCode(); |
| 31 EXPECT_TRUE(huffman_table_.Initialize(&code[0], code.size())); | 31 EXPECT_TRUE(huffman_table_.Initialize(&code[0], code.size())); |
| 32 } | 32 } |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 HpackHuffmanTable huffman_table_; | 35 HpackHuffmanTable huffman_table_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // Hex representation of encoded length and Huffman string. | 38 // Hex representation of encoded length and Huffman string. |
| 39 const char kEncodedHuffmanFixture[] = "2d" // Length prefix. | 39 const char kEncodedHuffmanFixture[] = "2d" // Length prefix. |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 620 |
| 621 input_stream.ConsumeBits(6); | 621 input_stream.ConsumeBits(6); |
| 622 EXPECT_TRUE(input_stream.HasMoreData()); | 622 EXPECT_TRUE(input_stream.HasMoreData()); |
| 623 input_stream.ConsumeByteRemainder(); | 623 input_stream.ConsumeByteRemainder(); |
| 624 EXPECT_FALSE(input_stream.HasMoreData()); | 624 EXPECT_FALSE(input_stream.HasMoreData()); |
| 625 } | 625 } |
| 626 | 626 |
| 627 } // namespace | 627 } // namespace |
| 628 | 628 |
| 629 } // namespace net | 629 } // namespace net |
| OLD | NEW |