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

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

Issue 1852423004: Implement SpdySerializedFrame move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « net/spdy/spdy_test_utils.h ('k') | net/spdy/spdy_write_queue_unittest.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/spdy_test_utils.h" 5 #include "net/spdy/spdy_test_utils.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (identical) return; 84 if (identical) return;
85 ADD_FAILURE() 85 ADD_FAILURE()
86 << "Description:\n" 86 << "Description:\n"
87 << description 87 << description
88 << "\n\nExpected:\n" 88 << "\n\nExpected:\n"
89 << HexDumpWithMarks(expected, expected_len, marks.get(), max_len) 89 << HexDumpWithMarks(expected, expected_len, marks.get(), max_len)
90 << "\nActual:\n" 90 << "\nActual:\n"
91 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len); 91 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
92 } 92 }
93 93
94 void SetFrameFlags(SpdyFrame* frame, 94 void SetFrameFlags(SpdySerializedFrame* frame,
95 uint8_t flags, 95 uint8_t flags,
96 SpdyMajorVersion spdy_version) { 96 SpdyMajorVersion spdy_version) {
97 switch (spdy_version) { 97 switch (spdy_version) {
98 case SPDY3: 98 case SPDY3:
99 case HTTP2: 99 case HTTP2:
100 frame->data()[4] = flags; 100 frame->data()[4] = flags;
101 break; 101 break;
102 default: 102 default:
103 LOG(FATAL) << "Unsupported SPDY version."; 103 LOG(FATAL) << "Unsupported SPDY version.";
104 } 104 }
105 } 105 }
106 106
107 void SetFrameLength(SpdyFrame* frame, 107 void SetFrameLength(SpdySerializedFrame* frame,
108 size_t length, 108 size_t length,
109 SpdyMajorVersion spdy_version) { 109 SpdyMajorVersion spdy_version) {
110 switch (spdy_version) { 110 switch (spdy_version) {
111 case SPDY3: 111 case SPDY3:
112 CHECK_EQ(0u, length & ~kLengthMask); 112 CHECK_EQ(0u, length & ~kLengthMask);
113 { 113 {
114 int32_t wire_length = base::HostToNet32(length); 114 int32_t wire_length = base::HostToNet32(length);
115 // The length field in SPDY 3 is a 24-bit (3B) integer starting at 115 // The length field in SPDY 3 is a 24-bit (3B) integer starting at
116 // offset 5. 116 // offset 5.
117 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3); 117 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 block_.ReplaceOrAppendHeader(name, new_value); 185 block_.ReplaceOrAppendHeader(name, new_value);
186 } 186 }
187 } 187 }
188 188
189 void TestHeadersHandler::OnHeaderBlockEnd(size_t header_bytes_parsed) { 189 void TestHeadersHandler::OnHeaderBlockEnd(size_t header_bytes_parsed) {
190 header_bytes_parsed_ = header_bytes_parsed; 190 header_bytes_parsed_ = header_bytes_parsed;
191 } 191 }
192 192
193 } // namespace test 193 } // namespace test
194 } // namespace net 194 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_utils.h ('k') | net/spdy/spdy_write_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698