Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: net/spdy/hpack_decoder_test.cc

Issue 289843007: Moves HpackEntry index computation into the container class HpackHeaderTable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/hpack_decoder.cc ('k') | net/spdy/hpack_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 EXPECT_TRUE(DecodeHeaderBlock(str)); 89 EXPECT_TRUE(DecodeHeaderBlock(str));
90 return decoded_block(); 90 return decoded_block();
91 } 91 }
92 92
93 void expectEntry(size_t index, size_t size, const string& name, 93 void expectEntry(size_t index, size_t size, const string& name,
94 const string& value) { 94 const string& value) {
95 HpackEntry* entry = decoder_peer_.header_table()->GetByIndex(index); 95 HpackEntry* entry = decoder_peer_.header_table()->GetByIndex(index);
96 EXPECT_EQ(name, entry->name()) << "index " << index; 96 EXPECT_EQ(name, entry->name()) << "index " << index;
97 EXPECT_EQ(value, entry->value()); 97 EXPECT_EQ(value, entry->value());
98 EXPECT_EQ(size, entry->Size()); 98 EXPECT_EQ(size, entry->Size());
99 EXPECT_EQ(index, entry->Index()); 99 EXPECT_EQ(index, decoder_peer_.header_table()->IndexOf(entry));
100 } 100 }
101 101
102 void expectStaticEntry(size_t index) { 102 void expectStaticEntry(size_t index) {
103 HpackEntry* entry = decoder_peer_.header_table()->GetByIndex(index); 103 HpackEntry* entry = decoder_peer_.header_table()->GetByIndex(index);
104 EXPECT_TRUE(entry->IsStatic()) << "index " << index; 104 EXPECT_TRUE(entry->IsStatic()) << "index " << index;
105 } 105 }
106 106
107 HpackDecoder decoder_; 107 HpackDecoder decoder_;
108 test::HpackDecoderPeer decoder_peer_; 108 test::HpackDecoderPeer decoder_peer_;
109 }; 109 };
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 " max-age=3600; version=1"); 661 " max-age=3600; version=1");
662 expectEntry(2, 52, "content-encoding", "gzip"); 662 expectEntry(2, 52, "content-encoding", "gzip");
663 expectEntry(3, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); 663 expectEntry(3, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT");
664 expectStaticEntry(4); 664 expectStaticEntry(4);
665 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); 665 EXPECT_EQ(215u, decoder_peer_.header_table()->size());
666 } 666 }
667 667
668 } // namespace 668 } // namespace
669 669
670 } // namespace net 670 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack_decoder.cc ('k') | net/spdy/hpack_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698