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

Unified Diff: net/quic/core/quic_data_writer_test.cc

Issue 2759203003: Landing Recent QUIC changes until Thu Mar 16 17:24:53 2017 +0000 (Closed)
Patch Set: float Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_data_writer.cc ('k') | net/quic/core/quic_flags_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_data_writer_test.cc
diff --git a/net/quic/core/quic_data_writer_test.cc b/net/quic/core/quic_data_writer_test.cc
index fcd1a577e6e6e663f69469a01a3210107b3ad377..98ed83b9fc3910615c80c819f545d17e679f9b41 100644
--- a/net/quic/core/quic_data_writer_test.cc
+++ b/net/quic/core/quic_data_writer_test.cc
@@ -7,6 +7,8 @@
#include <cstdint>
#include "net/quic/core/quic_data_reader.h"
+#include "net/quic/core/quic_flags.h"
+#include "net/quic/test_tools/quic_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -196,6 +198,30 @@ TEST(QuicDataWriterTest, RoundTripUFloat16) {
}
}
+TEST(QuicDataWriterTest, WriteConnectionId) {
+ uint64_t connection_id = 0x0011223344556677;
+ char little_endian[] = {
+ 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00,
+ };
+ char big_endian[] = {
+ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+ };
+ const int kBufferLength = sizeof(connection_id);
+ char buffer[kBufferLength];
+ QuicDataWriter writer(kBufferLength, buffer);
+ writer.WriteConnectionId(connection_id);
+ test::CompareCharArraysWithHexError(
+ "connection_id", buffer, kBufferLength,
+ FLAGS_quic_restart_flag_quic_big_endian_connection_id ? big_endian
+ : little_endian,
+ kBufferLength);
+
+ uint64_t read_connection_id;
+ QuicDataReader reader(buffer, kBufferLength);
+ reader.ReadConnectionId(&read_connection_id);
+ EXPECT_EQ(connection_id, read_connection_id);
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/core/quic_data_writer.cc ('k') | net/quic/core/quic_flags_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698