Index: net/quic/quic_utils_test.cc |
diff --git a/net/quic/quic_utils_test.cc b/net/quic/quic_utils_test.cc |
index 7412a24052d71c43f7a7e87914fa1034b0aaa0eb..e8e864b15ab3be1242372d1341f6ce3266ddaf6c 100644 |
--- a/net/quic/quic_utils_test.cc |
+++ b/net/quic/quic_utils_test.cc |
@@ -185,6 +185,27 @@ TEST(QuicUtilsHashTest, ReferenceTest) { |
reinterpret_cast<const char*>(data.data()), data.size())); |
} |
+TEST(QuicUtilsTest, HexDump) { |
+ // Verify output of the HexDump method is as expected. |
+ char packet[] = { |
+ 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x51, 0x55, 0x49, 0x43, 0x21, |
+ 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, |
+ 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x6c, |
+ 0x6f, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x20, 0x74, |
+ 0x6f, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, |
+ 0x70, 0x6c, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x6f, 0x66, |
+ 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x01, 0x02, 0x03, 0x00, |
+ }; |
+ EXPECT_EQ( |
+ QuicUtils::HexDump(packet), |
+ "48 65 6C 6C 6F 2C 20 51 55 49 43 21 20 54 68 69 |Hello, QUIC! Thi|\n" |
+ "73 20 73 74 72 69 6E 67 20 73 68 6F 75 6C 64 20 |s string should |\n" |
+ "62 65 20 6C 6F 6E 67 20 65 6E 6F 75 67 68 20 74 |be long enough t|\n" |
+ "6F 20 73 70 61 6E 20 6D 75 6C 74 69 70 6C 65 20 |o span multiple |\n" |
+ "6C 69 6E 65 73 20 6F 66 20 6F 75 74 70 75 74 2E |lines of output.|\n" |
+ "01 02 03 |... |\n"); |
+} |
+ |
} // namespace |
} // namespace test |
} // namespace net |