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_decoder.h" | 5 #include "net/spdy/hpack_decoder.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 // Incremental indexing. | 336 // Incremental indexing. |
337 | 337 |
338 // One more than the number of static table entries. | 338 // One more than the number of static table entries. |
339 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x3d", 1))); | 339 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x3d", 1))); |
340 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x00", 1))); | 340 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x00", 1))); |
341 } | 341 } |
342 | 342 |
343 // Round-tripping the header set from E.2.1 should work. | 343 // Round-tripping the header set from E.2.1 should work. |
344 TEST_F(HpackDecoderTest, BasicE21) { | 344 TEST_F(HpackDecoderTest, BasicE21) { |
345 HpackEncoder encoder; | 345 HpackEncoder encoder(ObtainHpackHuffmanTable()); |
346 | 346 |
347 std::map<string, string> expected_header_set; | 347 std::map<string, string> expected_header_set; |
348 expected_header_set[":method"] = "GET"; | 348 expected_header_set[":method"] = "GET"; |
349 expected_header_set[":scheme"] = "http"; | 349 expected_header_set[":scheme"] = "http"; |
350 expected_header_set[":path"] = "/"; | 350 expected_header_set[":path"] = "/"; |
351 expected_header_set[":authority"] = "www.example.com"; | 351 expected_header_set[":authority"] = "www.example.com"; |
352 | 352 |
353 string encoded_header_set; | 353 string encoded_header_set; |
354 EXPECT_TRUE(encoder.EncodeHeaderSet( | 354 EXPECT_TRUE(encoder.EncodeHeaderSet( |
355 expected_header_set, &encoded_header_set)); | 355 expected_header_set, &encoded_header_set)); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 Pair("content-encoding", "gzip"), | 599 Pair("content-encoding", "gzip"), |
600 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"), | 600 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"), |
601 Pair("location", "https://www.example.com"), | 601 Pair("location", "https://www.example.com"), |
602 Pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" | 602 Pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" |
603 " max-age=3600; version=1"))); | 603 " max-age=3600; version=1"))); |
604 } | 604 } |
605 | 605 |
606 } // namespace | 606 } // namespace |
607 | 607 |
608 } // namespace net | 608 } // namespace net |
OLD | NEW |