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

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

Issue 2570513003: This change removes HpackEncoder::EncodeHeaderSetWithoutCompression() and the corresponding progres… (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/spdy_framer.h" 5 #include "net/spdy/spdy_framer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 HEADERS_FLAG_PRIORITY | HEADERS_FLAG_END_HEADERS, 3); 1168 HEADERS_FLAG_PRIORITY | HEADERS_FLAG_END_HEADERS, 3);
1169 frame.WriteUInt32(0); // Priority exclusivity and dependent stream. 1169 frame.WriteUInt32(0); // Priority exclusivity and dependent stream.
1170 frame.WriteUInt8(255); // Priority weight. 1170 frame.WriteUInt8(255); // Priority weight.
1171 1171
1172 string value("value1\0value2", 13); 1172 string value("value1\0value2", 13);
1173 // TODO(jgraettinger): If this pattern appears again, move to test class. 1173 // TODO(jgraettinger): If this pattern appears again, move to test class.
1174 SpdyHeaderBlock header_set; 1174 SpdyHeaderBlock header_set;
1175 header_set["name"] = value; 1175 header_set["name"] = value;
1176 string buffer; 1176 string buffer;
1177 HpackEncoder encoder(ObtainHpackHuffmanTable()); 1177 HpackEncoder encoder(ObtainHpackHuffmanTable());
1178 encoder.EncodeHeaderSetWithoutCompression(header_set, &buffer); 1178 encoder.DisableCompression();
1179 encoder.EncodeHeaderSet(header_set, &buffer);
1179 frame.WriteBytes(&buffer[0], buffer.size()); 1180 frame.WriteBytes(&buffer[0], buffer.size());
1180 // write the length 1181 // write the length
1181 frame.RewriteLength(framer); 1182 frame.RewriteLength(framer);
1182 1183
1183 SpdySerializedFrame control_frame(frame.take()); 1184 SpdySerializedFrame control_frame(frame.take());
1184 1185
1185 TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION); 1186 TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION);
1186 visitor.SimulateInFramer( 1187 visitor.SimulateInFramer(
1187 reinterpret_cast<unsigned char*>(control_frame.data()), 1188 reinterpret_cast<unsigned char*>(control_frame.data()),
1188 control_frame.size()); 1189 control_frame.size());
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 0x03, // Value Len: 3 2337 0x03, // Value Len: 3
2337 0x62, 0x61, 0x72, // bar 2338 0x62, 0x61, 0x72, // bar
2338 }; 2339 };
2339 // frame-format on 2340 // frame-format on
2340 2341
2341 SpdyHeaderBlock header_block; 2342 SpdyHeaderBlock header_block;
2342 header_block["bar"] = "foo"; 2343 header_block["bar"] = "foo";
2343 header_block["foo"] = "bar"; 2344 header_block["foo"] = "bar";
2344 auto buffer = base::MakeUnique<string>(); 2345 auto buffer = base::MakeUnique<string>();
2345 HpackEncoder encoder(ObtainHpackHuffmanTable()); 2346 HpackEncoder encoder(ObtainHpackHuffmanTable());
2346 encoder.EncodeHeaderSetWithoutCompression(header_block, buffer.get()); 2347 encoder.DisableCompression();
2348 encoder.EncodeHeaderSet(header_block, buffer.get());
2347 2349
2348 SpdyContinuationIR continuation(42); 2350 SpdyContinuationIR continuation(42);
2349 continuation.take_encoding(std::move(buffer)); 2351 continuation.take_encoding(std::move(buffer));
2350 continuation.set_end_headers(true); 2352 continuation.set_end_headers(true);
2351 2353
2352 SpdySerializedFrame frame(framer.SerializeContinuation(continuation)); 2354 SpdySerializedFrame frame(framer.SerializeContinuation(continuation));
2353 CompareFrame(kDescription, frame, kFrameData, arraysize(kFrameData)); 2355 CompareFrame(kDescription, frame, kFrameData, arraysize(kFrameData));
2354 } 2356 }
2355 2357
2356 // Test that if we send an unexpected CONTINUATION 2358 // Test that if we send an unexpected CONTINUATION
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 4337
4336 EXPECT_EQ(1, visitor->data_frame_count_); 4338 EXPECT_EQ(1, visitor->data_frame_count_);
4337 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); 4339 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_));
4338 EXPECT_EQ(0, visitor->headers_frame_count_); 4340 EXPECT_EQ(0, visitor->headers_frame_count_);
4339 } 4341 }
4340 } 4342 }
4341 4343
4342 } // namespace test 4344 } // namespace test
4343 4345
4344 } // namespace net 4346 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698