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

Side by Side Diff: net/quic/core/quic_data_writer_test.cc

Issue 2808273006: Landing Recent QUIC changes until Sun Apr 9 16:12:55 (Closed)
Patch Set: increment enabled_options in e2e test Created 3 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/quic/core/quic_data_writer.cc ('k') | net/quic/core/quic_error_codes.h » ('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/quic/core/quic_data_writer.h" 5 #include "net/quic/core/quic_data_writer.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 8
9 #include "net/quic/core/quic_data_reader.h" 9 #include "net/quic/core/quic_data_reader.h"
10 #include "net/quic/core/quic_flags.h" 10 #include "net/quic/core/quic_flags.h"
11 #include "net/quic/core/quic_utils.h"
11 #include "net/quic/test_tools/quic_test_utils.h" 12 #include "net/quic/test_tools/quic_test_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace net { 15 namespace net {
15 namespace test { 16 namespace test {
16 namespace { 17 namespace {
17 18
18 class QuicDataWriterTest : public ::testing::TestWithParam<Perspective> {}; 19 class QuicDataWriterTest : public ::testing::TestWithParam<Perspective> {};
19 20
20 TEST_P(QuicDataWriterTest, SanityCheckUFloat16Consts) { 21 TEST_P(QuicDataWriterTest, SanityCheckUFloat16Consts) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 }; 209 };
209 char big_endian[] = { 210 char big_endian[] = {
210 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 211 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
211 }; 212 };
212 const int kBufferLength = sizeof(connection_id); 213 const int kBufferLength = sizeof(connection_id);
213 char buffer[kBufferLength]; 214 char buffer[kBufferLength];
214 QuicDataWriter writer(kBufferLength, buffer, GetParam()); 215 QuicDataWriter writer(kBufferLength, buffer, GetParam());
215 writer.WriteConnectionId(connection_id); 216 writer.WriteConnectionId(connection_id);
216 test::CompareCharArraysWithHexError( 217 test::CompareCharArraysWithHexError(
217 "connection_id", buffer, kBufferLength, 218 "connection_id", buffer, kBufferLength,
218 FLAGS_quic_restart_flag_quic_big_endian_connection_id ? big_endian 219 QuicUtils::IsConnectionIdWireFormatBigEndian(GetParam()) ? big_endian
219 : little_endian, 220 : little_endian,
220 kBufferLength); 221 kBufferLength);
221 222
222 uint64_t read_connection_id; 223 uint64_t read_connection_id;
223 QuicDataReader reader(buffer, kBufferLength, GetParam()); 224 QuicDataReader reader(buffer, kBufferLength, GetParam());
224 reader.ReadConnectionId(&read_connection_id); 225 reader.ReadConnectionId(&read_connection_id);
225 EXPECT_EQ(connection_id, read_connection_id); 226 EXPECT_EQ(connection_id, read_connection_id);
226 } 227 }
227 228
228 TEST_P(QuicDataWriterTest, WriteTag) { 229 TEST_P(QuicDataWriterTest, WriteTag) {
229 char CHLO[] = { 230 char CHLO[] = {
230 'C', 'H', 'L', 'O', 231 'C', 'H', 'L', 'O',
231 }; 232 };
232 const int kBufferLength = sizeof(QuicTag); 233 const int kBufferLength = sizeof(QuicTag);
233 char buffer[kBufferLength]; 234 char buffer[kBufferLength];
234 QuicDataWriter writer(kBufferLength, buffer, GetParam()); 235 QuicDataWriter writer(kBufferLength, buffer, GetParam());
235 writer.WriteTag(kCHLO); 236 writer.WriteTag(kCHLO);
236 test::CompareCharArraysWithHexError("CHLO", buffer, kBufferLength, CHLO, 237 test::CompareCharArraysWithHexError("CHLO", buffer, kBufferLength, CHLO,
237 kBufferLength); 238 kBufferLength);
238 239
239 QuicTag read_chlo; 240 QuicTag read_chlo;
240 QuicDataReader reader(buffer, kBufferLength, GetParam()); 241 QuicDataReader reader(buffer, kBufferLength, GetParam());
241 reader.ReadTag(&read_chlo); 242 reader.ReadTag(&read_chlo);
242 EXPECT_EQ(kCHLO, read_chlo); 243 EXPECT_EQ(kCHLO, read_chlo);
243 } 244 }
244 245
245 } // namespace 246 } // namespace
246 } // namespace test 247 } // namespace test
247 } // namespace net 248 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_data_writer.cc ('k') | net/quic/core/quic_error_codes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698