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

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

Issue 1561203003: Remove SPDY/2 code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #3. Created 4 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
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/tools/flip_server/sm_connection.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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 << "\n\nExpected:\n" 85 << "\n\nExpected:\n"
86 << HexDumpWithMarks(expected, expected_len, marks.get(), max_len) 86 << HexDumpWithMarks(expected, expected_len, marks.get(), max_len)
87 << "\nActual:\n" 87 << "\nActual:\n"
88 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len); 88 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
89 } 89 }
90 90
91 void SetFrameFlags(SpdyFrame* frame, 91 void SetFrameFlags(SpdyFrame* frame,
92 uint8_t flags, 92 uint8_t flags,
93 SpdyMajorVersion spdy_version) { 93 SpdyMajorVersion spdy_version) {
94 switch (spdy_version) { 94 switch (spdy_version) {
95 case SPDY2:
96 case SPDY3: 95 case SPDY3:
97 case HTTP2: 96 case HTTP2:
98 frame->data()[4] = flags; 97 frame->data()[4] = flags;
99 break; 98 break;
100 default: 99 default:
101 LOG(FATAL) << "Unsupported SPDY version."; 100 LOG(FATAL) << "Unsupported SPDY version.";
102 } 101 }
103 } 102 }
104 103
105 void SetFrameLength(SpdyFrame* frame, 104 void SetFrameLength(SpdyFrame* frame,
106 size_t length, 105 size_t length,
107 SpdyMajorVersion spdy_version) { 106 SpdyMajorVersion spdy_version) {
108 switch (spdy_version) { 107 switch (spdy_version) {
109 case SPDY2:
110 case SPDY3: 108 case SPDY3:
111 CHECK_EQ(0u, length & ~kLengthMask); 109 CHECK_EQ(0u, length & ~kLengthMask);
112 { 110 {
113 int32_t wire_length = base::HostToNet32(length); 111 int32_t wire_length = base::HostToNet32(length);
114 // The length field in SPDY 2 and 3 is a 24-bit (3B) integer starting at 112 // The length field in SPDY 3 is a 24-bit (3B) integer starting at
115 // offset 5. 113 // offset 5.
116 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3); 114 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3);
117 } 115 }
118 break; 116 break;
119 case HTTP2: 117 case HTTP2:
120 CHECK_GT(1u<<14, length); 118 CHECK_GT(1u<<14, length);
121 { 119 {
122 int32_t wire_length = base::HostToNet32(length); 120 int32_t wire_length = base::HostToNet32(length);
123 memcpy(frame->data(), 121 memcpy(frame->data(),
124 reinterpret_cast<char*>(&wire_length) + 1, 122 reinterpret_cast<char*>(&wire_length) + 1,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 161
164 // Construct a fake SSLInfo that will pass AddHPKPHeader's checks. 162 // Construct a fake SSLInfo that will pass AddHPKPHeader's checks.
165 SSLInfo ssl_info; 163 SSLInfo ssl_info;
166 ssl_info.is_issued_by_known_root = true; 164 ssl_info.is_issued_by_known_root = true;
167 ssl_info.public_key_hashes.push_back(GetTestHashValue(primary_label)); 165 ssl_info.public_key_hashes.push_back(GetTestHashValue(primary_label));
168 EXPECT_TRUE(state->AddHPKPHeader(host, header, ssl_info)); 166 EXPECT_TRUE(state->AddHPKPHeader(host, header, ssl_info));
169 } 167 }
170 168
171 } // namespace test 169 } // namespace test
172 } // namespace net 170 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/tools/flip_server/sm_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698