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_encoder.h" | 5 #include "net/spdy/hpack/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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void ExpectNonIndexedLiteral(StringPiece name, StringPiece value) { | 125 void ExpectNonIndexedLiteral(StringPiece name, StringPiece value) { |
126 expected_.AppendPrefix(kLiteralNoIndexOpcode); | 126 expected_.AppendPrefix(kLiteralNoIndexOpcode); |
127 expected_.AppendUint32(0); | 127 expected_.AppendUint32(0); |
128 expected_.AppendPrefix(kStringLiteralIdentityEncoded); | 128 expected_.AppendPrefix(kStringLiteralIdentityEncoded); |
129 expected_.AppendUint32(name.size()); | 129 expected_.AppendUint32(name.size()); |
130 expected_.AppendBytes(name); | 130 expected_.AppendBytes(name); |
131 expected_.AppendPrefix(kStringLiteralIdentityEncoded); | 131 expected_.AppendPrefix(kStringLiteralIdentityEncoded); |
132 expected_.AppendUint32(value.size()); | 132 expected_.AppendUint32(value.size()); |
133 expected_.AppendBytes(value); | 133 expected_.AppendBytes(value); |
134 } | 134 } |
135 void ExpectHeaderTableSizeUpdate(uint32 size) { | 135 void ExpectHeaderTableSizeUpdate(uint32_t size) { |
136 expected_.AppendPrefix(kHeaderTableSizeUpdateOpcode); | 136 expected_.AppendPrefix(kHeaderTableSizeUpdateOpcode); |
137 expected_.AppendUint32(size); | 137 expected_.AppendUint32(size); |
138 } | 138 } |
139 void CompareWithExpectedEncoding(const SpdyHeaderBlock& header_set) { | 139 void CompareWithExpectedEncoding(const SpdyHeaderBlock& header_set) { |
140 string expected_out, actual_out; | 140 string expected_out, actual_out; |
141 expected_.TakeString(&expected_out); | 141 expected_.TakeString(&expected_out); |
142 EXPECT_TRUE(encoder_.EncodeHeaderSet(header_set, &actual_out)); | 142 EXPECT_TRUE(encoder_.EncodeHeaderSet(header_set, &actual_out)); |
143 EXPECT_EQ(expected_out, actual_out); | 143 EXPECT_EQ(expected_out, actual_out); |
144 } | 144 } |
145 size_t IndexOf(const HpackEntry* entry) { | 145 size_t IndexOf(const HpackEntry* entry) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 CompareWithExpectedEncoding(headers); | 497 CompareWithExpectedEncoding(headers); |
498 | 498 |
499 HpackEntry* new_entry = &peer_.table_peer().dynamic_entries()->front(); | 499 HpackEntry* new_entry = &peer_.table_peer().dynamic_entries()->front(); |
500 EXPECT_EQ(new_entry->name(), "key3"); | 500 EXPECT_EQ(new_entry->name(), "key3"); |
501 EXPECT_EQ(new_entry->value(), "value3"); | 501 EXPECT_EQ(new_entry->value(), "value3"); |
502 } | 502 } |
503 | 503 |
504 } // namespace | 504 } // namespace |
505 | 505 |
506 } // namespace net | 506 } // namespace net |
OLD | NEW |