| 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_encoder.h" | 5 #include "net/spdy/hpack_encoder.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 CompareWithExpectedEncoding(headers); | 313 CompareWithExpectedEncoding(headers); |
| 314 } | 314 } |
| 315 | 315 |
| 316 TEST_F(HpackEncoderTest, StringsDynamicallySelectHuffmanCoding) { | 316 TEST_F(HpackEncoderTest, StringsDynamicallySelectHuffmanCoding) { |
| 317 peer_.set_allow_huffman_compression(true); | 317 peer_.set_allow_huffman_compression(true); |
| 318 | 318 |
| 319 // Compactable string. Uses Huffman coding. | 319 // Compactable string. Uses Huffman coding. |
| 320 peer_.EmitString("feedbeef"); | 320 peer_.EmitString("feedbeef"); |
| 321 expected_.AppendPrefix(kStringLiteralHuffmanEncoded); | 321 expected_.AppendPrefix(kStringLiteralHuffmanEncoded); |
| 322 expected_.AppendUint32(6); | 322 expected_.AppendUint32(6); |
| 323 expected_.AppendBytes("\xE0\xB5\xD3\xBDk\xE1"); | 323 expected_.AppendBytes("\x94\xA5\x92""2\x96_"); |
| 324 | 324 |
| 325 // Non-compactable. Uses identity coding. | 325 // Non-compactable. Uses identity coding. |
| 326 peer_.EmitString("@@@@@@"); | 326 peer_.EmitString("@@@@@@"); |
| 327 expected_.AppendPrefix(kStringLiteralIdentityEncoded); | 327 expected_.AppendPrefix(kStringLiteralIdentityEncoded); |
| 328 expected_.AppendUint32(6); | 328 expected_.AppendUint32(6); |
| 329 expected_.AppendBytes("@@@@@@"); | 329 expected_.AppendBytes("@@@@@@"); |
| 330 | 330 |
| 331 string expected_out, actual_out; | 331 string expected_out, actual_out; |
| 332 expected_.TakeString(&expected_out); | 332 expected_.TakeString(&expected_out); |
| 333 peer_.TakeString(&actual_out); | 333 peer_.TakeString(&actual_out); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 expect[static_cast<uint8>('\xff')] = 1; | 444 expect[static_cast<uint8>('\xff')] = 1; |
| 445 expect[static_cast<uint8>('b')] = 1; | 445 expect[static_cast<uint8>('b')] = 1; |
| 446 | 446 |
| 447 EXPECT_EQ(expect, counts); | 447 EXPECT_EQ(expect, counts); |
| 448 EXPECT_EQ(9u, total_counts); | 448 EXPECT_EQ(9u, total_counts); |
| 449 } | 449 } |
| 450 | 450 |
| 451 } // namespace | 451 } // namespace |
| 452 | 452 |
| 453 } // namespace net | 453 } // namespace net |
| OLD | NEW |