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

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

Issue 202063002: Added OverwriteFlags method to SpdyFrameBuilder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/spdy_frame_builder.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) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } else { 52 } else {
53 builder.WriteFramePrefix(framer, SETTINGS, 0, 0); 53 builder.WriteFramePrefix(framer, SETTINGS, 0, 0);
54 } 54 }
55 EXPECT_TRUE(builder.GetWritableBuffer(1) != NULL); 55 EXPECT_TRUE(builder.GetWritableBuffer(1) != NULL);
56 builder.RewriteLength(framer); 56 builder.RewriteLength(framer);
57 scoped_ptr<SpdyFrame> built(builder.take()); 57 scoped_ptr<SpdyFrame> built(builder.take());
58 EXPECT_EQ(base::StringPiece(expected->data(), expected->size()), 58 EXPECT_EQ(base::StringPiece(expected->data(), expected->size()),
59 base::StringPiece(built->data(), expected->size())); 59 base::StringPiece(built->data(), expected->size()));
60 } 60 }
61 61
62 TEST_P(SpdyFrameBuilderTest, OverwriteFlags) {
63 // Create a HEADERS frame both via framer and manually via builder with
64 // different flags set, then make them match using OverwriteFlags().
65 SpdyFramer framer(spdy_version_);
66 if (spdy_version_ < SPDY4) {
67 return;
68 }
69 SpdyHeadersIR headers_ir(1);
70 headers_ir.set_end_headers(false);
71 scoped_ptr<SpdyFrame> expected(framer.SerializeHeaders(headers_ir));
72 SpdyFrameBuilder builder(expected->size());
73 builder.WriteFramePrefix(framer, HEADERS, HEADERS_FLAG_END_HEADERS, 1);
74 builder.OverwriteFlags(framer, 0);
75 scoped_ptr<SpdyFrame> built(builder.take());
76 EXPECT_EQ(base::StringPiece(expected->data(), expected->size()),
77 base::StringPiece(built->data(), built->size()));
78 }
79
62 } // namespace net 80 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_frame_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698