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

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

Issue 138803002: SPDY4: Turn SYN_STREAM and SYN_REPLY into HEADERS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows bool-cast fix. Created 6 years, 11 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 | « no previous file | net/spdy/spdy_framer.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 (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/buffered_spdy_framer.h" 5 #include "net/spdy/buffered_spdy_framer.h"
6 6
7 #include "net/spdy/spdy_test_util_common.h" 7 #include "net/spdy/spdy_test_util_common.h"
8 #include "testing/platform_test.h" 8 #include "testing/platform_test.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 CONTROL_FLAG_NONE, 250 CONTROL_FLAG_NONE,
251 &headers)); 251 &headers));
252 EXPECT_TRUE(control_frame.get() != NULL); 252 EXPECT_TRUE(control_frame.get() != NULL);
253 253
254 TestBufferedSpdyVisitor visitor(spdy_version()); 254 TestBufferedSpdyVisitor visitor(spdy_version());
255 visitor.SimulateInFramer( 255 visitor.SimulateInFramer(
256 reinterpret_cast<unsigned char*>(control_frame.get()->data()), 256 reinterpret_cast<unsigned char*>(control_frame.get()->data()),
257 control_frame.get()->size()); 257 control_frame.get()->size());
258 EXPECT_EQ(0, visitor.error_count_); 258 EXPECT_EQ(0, visitor.error_count_);
259 EXPECT_EQ(0, visitor.syn_frame_count_); 259 EXPECT_EQ(0, visitor.syn_frame_count_);
260 EXPECT_EQ(1, visitor.syn_reply_frame_count_); 260 if(spdy_version() < SPDY4) {
261 EXPECT_EQ(0, visitor.headers_frame_count_); 261 EXPECT_EQ(1, visitor.syn_reply_frame_count_);
262 EXPECT_EQ(0, visitor.headers_frame_count_);
263 } else {
264 EXPECT_EQ(0, visitor.syn_reply_frame_count_);
265 EXPECT_EQ(1, visitor.headers_frame_count_);
266 }
262 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); 267 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_));
263 } 268 }
264 269
265 TEST_P(BufferedSpdyFramerTest, ReadHeadersHeaderBlock) { 270 TEST_P(BufferedSpdyFramerTest, ReadHeadersHeaderBlock) {
266 SpdyHeaderBlock headers; 271 SpdyHeaderBlock headers;
267 headers["alpha"] = "beta"; 272 headers["alpha"] = "beta";
268 headers["gamma"] = "delta"; 273 headers["gamma"] = "delta";
269 BufferedSpdyFramer framer(spdy_version(), true); 274 BufferedSpdyFramer framer(spdy_version(), true);
270 scoped_ptr<SpdyFrame> control_frame( 275 scoped_ptr<SpdyFrame> control_frame(
271 framer.CreateHeaders(1, // stream_id 276 framer.CreateHeaders(1, // stream_id
272 CONTROL_FLAG_NONE, 277 CONTROL_FLAG_NONE,
273 &headers)); 278 &headers));
274 EXPECT_TRUE(control_frame.get() != NULL); 279 EXPECT_TRUE(control_frame.get() != NULL);
275 280
276 TestBufferedSpdyVisitor visitor(spdy_version()); 281 TestBufferedSpdyVisitor visitor(spdy_version());
277 visitor.SimulateInFramer( 282 visitor.SimulateInFramer(
278 reinterpret_cast<unsigned char*>(control_frame.get()->data()), 283 reinterpret_cast<unsigned char*>(control_frame.get()->data()),
279 control_frame.get()->size()); 284 control_frame.get()->size());
280 EXPECT_EQ(0, visitor.error_count_); 285 EXPECT_EQ(0, visitor.error_count_);
281 EXPECT_EQ(0, visitor.syn_frame_count_); 286 EXPECT_EQ(0, visitor.syn_frame_count_);
282 EXPECT_EQ(0, visitor.syn_reply_frame_count_); 287 EXPECT_EQ(0, visitor.syn_reply_frame_count_);
283 EXPECT_EQ(1, visitor.headers_frame_count_); 288 EXPECT_EQ(1, visitor.headers_frame_count_);
284 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); 289 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_));
285 } 290 }
286 291
287 } // namespace net 292 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698