| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/quic_utils.h" | 5 #include "net/quic/quic_utils.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/crypto_protocol.h" | 7 #include "net/quic/crypto/crypto_protocol.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using base::StringPiece; | 10 using base::StringPiece; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 const string expected; | 46 const string expected; |
| 47 } tests[] = { | 47 } tests[] = { |
| 48 { "", "", }, | 48 { "", "", }, |
| 49 { "A", "0x0000: 41 A\n", }, | 49 { "A", "0x0000: 41 A\n", }, |
| 50 { "AB", "0x0000: 4142 AB\n", }, | 50 { "AB", "0x0000: 4142 AB\n", }, |
| 51 { "ABC", "0x0000: 4142 43 ABC\n", }, | 51 { "ABC", "0x0000: 4142 43 ABC\n", }, |
| 52 { "original", | 52 { "original", |
| 53 "0x0000: 6f72 6967 696e 616c original\n", }, | 53 "0x0000: 6f72 6967 696e 616c original\n", }, |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 56 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 57 EXPECT_EQ(tests[i].expected, | 57 EXPECT_EQ(tests[i].expected, |
| 58 QuicUtils::StringToHexASCIIDump(tests[i].input.c_str())); | 58 QuicUtils::StringToHexASCIIDump(tests[i].input.c_str())); |
| 59 EXPECT_EQ(tests[i].expected, | 59 EXPECT_EQ(tests[i].expected, |
| 60 QuicUtils::StringToHexASCIIDump(tests[i].input)); | 60 QuicUtils::StringToHexASCIIDump(tests[i].input)); |
| 61 EXPECT_EQ(tests[i].expected, | 61 EXPECT_EQ(tests[i].expected, |
| 62 QuicUtils::StringToHexASCIIDump(StringPiece(tests[i].input))); | 62 QuicUtils::StringToHexASCIIDump(StringPiece(tests[i].input))); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST(QuicUtilsTest, StringToHexASCIIDumpSuccess) { | 66 TEST(QuicUtilsTest, StringToHexASCIIDumpSuccess) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 80 QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', 'O'))); | 80 QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', 'O'))); |
| 81 // A tag that contains a non-printing character will be printed as a decimal | 81 // A tag that contains a non-printing character will be printed as a decimal |
| 82 // number. | 82 // number. |
| 83 EXPECT_EQ("525092931", | 83 EXPECT_EQ("525092931", |
| 84 QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', '\x1f'))); | 84 QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', '\x1f'))); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 } // namespace test | 88 } // namespace test |
| 89 } // namespace net | 89 } // namespace net |
| OLD | NEW |