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

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

Issue 14189003: [SPDY] Incorporate latest framing changes from HTTP2 into SPDY 4 as SPDY 4a2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_frame_builder.h" 5 #include "net/spdy/spdy_frame_builder.h"
6 6
7 #include "net/spdy/spdy_framer.h" 7 #include "net/spdy/spdy_framer.h"
8 #include "net/spdy/spdy_protocol.h" 8 #include "net/spdy/spdy_protocol.h"
9 #include "testing/platform_test.h" 9 #include "testing/platform_test.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ::testing::Values(SPDY2, SPDY3, SPDY4)); 46 ::testing::Values(SPDY2, SPDY3, SPDY4));
47 47
48 TEST_P(SpdyFrameBuilderTest, RewriteLength) { 48 TEST_P(SpdyFrameBuilderTest, RewriteLength) {
49 // Create an empty SETTINGS frame both via framer and manually via builder. 49 // Create an empty SETTINGS frame both via framer and manually via builder.
50 // The one created via builder is initially given the incorrect length, but 50 // The one created via builder is initially given the incorrect length, but
51 // then is corrected via RewriteLength(). 51 // then is corrected via RewriteLength().
52 SpdyFramer framer(spdy_version_); 52 SpdyFramer framer(spdy_version_);
53 SettingsMap settings; 53 SettingsMap settings;
54 scoped_ptr<SpdyFrame> expected(framer.CreateSettings(settings)); 54 scoped_ptr<SpdyFrame> expected(framer.CreateSettings(settings));
55 SpdyFrameBuilder builder(expected->size() + 1); 55 SpdyFrameBuilder builder(expected->size() + 1);
56 builder.WriteControlFrameHeader(framer, SETTINGS, 0); 56 if (spdy_version_ < 4) {
57 builder.WriteControlFrameHeader(framer, SETTINGS, 0);
58 } else {
59 builder.WriteFramePrefix(framer, SETTINGS, 0, 0);
60 }
57 builder.WriteUInt32(0); // Write the number of settings. 61 builder.WriteUInt32(0); // Write the number of settings.
58 EXPECT_TRUE(builder.GetWritableBuffer(1) != NULL); 62 EXPECT_TRUE(builder.GetWritableBuffer(1) != NULL);
59 builder.RewriteLength(framer); 63 builder.RewriteLength(framer);
60 scoped_ptr<SpdyFrame> built(builder.take()); 64 scoped_ptr<SpdyFrame> built(builder.take());
61 EXPECT_EQ(base::StringPiece(expected->data(), expected->size()), 65 EXPECT_EQ(base::StringPiece(expected->data(), expected->size()),
62 base::StringPiece(built->data(), expected->size())); 66 base::StringPiece(built->data(), expected->size()));
63 } 67 }
64 68
65 } // namespace net 69 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698