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

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

Issue 710713002: Remove SPDY2 and SPDY/3.0 from tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 flags, 92 uint8 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 SPDY4: 96 case SPDY4:
98 case SPDY5: 97 case SPDY5:
99 frame->data()[4] = flags; 98 frame->data()[4] = flags;
100 break; 99 break;
101 default: 100 default:
102 LOG(FATAL) << "Unsupported SPDY version."; 101 LOG(FATAL) << "Unsupported SPDY version.";
103 } 102 }
104 } 103 }
105 104
106 void SetFrameLength(SpdyFrame* frame, 105 void SetFrameLength(SpdyFrame* frame,
107 size_t length, 106 size_t length,
108 SpdyMajorVersion spdy_version) { 107 SpdyMajorVersion spdy_version) {
109 switch (spdy_version) { 108 switch (spdy_version) {
110 case SPDY2:
111 case SPDY3: 109 case SPDY3:
112 CHECK_EQ(0u, length & ~kLengthMask); 110 CHECK_EQ(0u, length & ~kLengthMask);
113 { 111 {
114 int32 wire_length = base::HostToNet32(length); 112 int32 wire_length = base::HostToNet32(length);
115 // The length field in SPDY 2 and 3 is a 24-bit (3B) integer starting at 113 // The length field in SPDY 2 and 3 is a 24-bit (3B) integer starting at
116 // offset 5. 114 // offset 5.
117 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3); 115 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3);
118 } 116 }
119 break; 117 break;
120 case SPDY4: 118 case SPDY4:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Construct a fake SSLInfo that will pass AddHPKPHeader's checks. 164 // Construct a fake SSLInfo that will pass AddHPKPHeader's checks.
167 SSLInfo ssl_info; 165 SSLInfo ssl_info;
168 ssl_info.is_issued_by_known_root = true; 166 ssl_info.is_issued_by_known_root = true;
169 ssl_info.public_key_hashes.push_back(GetTestHashValue(primary_label)); 167 ssl_info.public_key_hashes.push_back(GetTestHashValue(primary_label));
170 EXPECT_TRUE(state->AddHPKPHeader(host, header, ssl_info)); 168 EXPECT_TRUE(state->AddHPKPHeader(host, header, ssl_info));
171 } 169 }
172 170
173 } // namespace test 171 } // namespace test
174 172
175 } // namespace net 173 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698