| 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/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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 first_input.push_back(0x7f); // Name length = 127 | 128 first_input.push_back(0x7f); // Name length = 127 |
| 129 ASSERT_EQ(2u, first_input.size()); | 129 ASSERT_EQ(2u, first_input.size()); |
| 130 EXPECT_TRUE(decoder_.HandleControlFrameHeadersData(first_input.data(), | 130 EXPECT_TRUE(decoder_.HandleControlFrameHeadersData(first_input.data(), |
| 131 first_input.size())); | 131 first_input.size())); |
| 132 // Further 38 bytes to make 40 total buffered bytes. | 132 // Further 38 bytes to make 40 total buffered bytes. |
| 133 string second_input = string(38, 'x'); | 133 string second_input = string(38, 'x'); |
| 134 EXPECT_TRUE(decoder_.HandleControlFrameHeadersData(second_input.data(), | 134 EXPECT_TRUE(decoder_.HandleControlFrameHeadersData(second_input.data(), |
| 135 second_input.size())); | 135 second_input.size())); |
| 136 // A string which would push the buffer over the threshold is refused. | 136 // A string which would push the buffer over the threshold is refused. |
| 137 const int kThirdInputSize = | 137 const int kThirdInputSize = |
| 138 (kMaxBufferSizeBytes - (first_input.size() + second_input.size())) + 1; | 138 kMaxBufferSizeBytes - (first_input.size() + second_input.size()) + 1; |
| 139 string third_input = string(kThirdInputSize, 'y'); | 139 string third_input = string(kThirdInputSize, 'y'); |
| 140 ASSERT_GT(first_input.size() + second_input.size() + third_input.size(), | 140 ASSERT_GT(first_input.size() + second_input.size() + third_input.size(), |
| 141 kMaxBufferSizeBytes); | 141 kMaxBufferSizeBytes); |
| 142 EXPECT_FALSE(decoder_.HandleControlFrameHeadersData(third_input.data(), | 142 EXPECT_FALSE(decoder_.HandleControlFrameHeadersData(third_input.data(), |
| 143 third_input.size())); | 143 third_input.size())); |
| 144 | 144 |
| 145 string expected(first_input); | 145 string expected(first_input); |
| 146 expected.append(second_input); | 146 expected.append(second_input); |
| 147 EXPECT_EQ(expected, decoder_peer_.headers_block_buffer()); | 147 EXPECT_EQ(expected, decoder_peer_.headers_block_buffer()); |
| 148 } | 148 } |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" | 847 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" |
| 848 " max-age=3600; version=1"); | 848 " max-age=3600; version=1"); |
| 849 expectEntry(63, 52, "content-encoding", "gzip"); | 849 expectEntry(63, 52, "content-encoding", "gzip"); |
| 850 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); | 850 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); |
| 851 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); | 851 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); |
| 852 } | 852 } |
| 853 | 853 |
| 854 } // namespace | 854 } // namespace |
| 855 } // namespace test | 855 } // namespace test |
| 856 } // namespace net | 856 } // namespace net |
| OLD | NEW |