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

Side by Side Diff: net/quic/crypto/crypto_handshake_message_test.cc

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 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/crypto/crypto_handshake_message.cc ('k') | net/quic/crypto/crypto_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/crypto/crypto_handshake_message.h"
6
7 #include "net/quic/crypto/crypto_handshake.h"
8 #include "net/quic/crypto/crypto_protocol.h"
9 #include "net/test/gtest_util.h"
10
11 namespace net {
12 namespace test {
13 namespace {
14
15 TEST(CryptoHandshakeMessageTest, DebugString) {
16 const char* str = "SHLO<\n>";
17
18 CryptoHandshakeMessage message;
19 message.set_tag(kSHLO);
20 EXPECT_EQ(str, message.DebugString());
21
22 // Test copy
23 CryptoHandshakeMessage message2(message);
24 EXPECT_EQ(str, message2.DebugString());
25
26 // Test move
27 CryptoHandshakeMessage message3(std::move(message));
28 EXPECT_EQ(str, message3.DebugString());
29
30 // Test assign
31 CryptoHandshakeMessage message4 = message3;
32 EXPECT_EQ(str, message4.DebugString());
33
34 // Test move-assign
35 CryptoHandshakeMessage message5 = std::move(message3);
36 EXPECT_EQ(str, message5.DebugString());
37 }
38
39 TEST(CryptoHandshakeMessageTest, DebugStringWithUintVector) {
40 const char* str =
41 "REJ <\n RREJ: "
42 "SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE,"
43 "CLIENT_NONCE_NOT_UNIQUE_FAILURE\n>";
44
45 CryptoHandshakeMessage message;
46 message.set_tag(kREJ);
47 std::vector<uint32_t> reasons = {
48 SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE,
49 CLIENT_NONCE_NOT_UNIQUE_FAILURE};
50 message.SetVector(kRREJ, reasons);
51 EXPECT_EQ(str, message.DebugString());
52
53 // Test copy
54 CryptoHandshakeMessage message2(message);
55 EXPECT_EQ(str, message2.DebugString());
56
57 // Test move
58 CryptoHandshakeMessage message3(std::move(message));
59 EXPECT_EQ(str, message3.DebugString());
60
61 // Test assign
62 CryptoHandshakeMessage message4 = message3;
63 EXPECT_EQ(str, message4.DebugString());
64
65 // Test move-assign
66 CryptoHandshakeMessage message5 = std::move(message3);
67 EXPECT_EQ(str, message5.DebugString());
68 }
69
70 TEST(CryptoHandshakeMessageTest, DebugStringWithTagVector) {
71 const char* str = "CHLO<\n COPT: 'TBBR','PAD ','BYTE'\n>";
72
73 CryptoHandshakeMessage message;
74 message.set_tag(kCHLO);
75 message.SetVector(kCOPT, QuicTagVector{kTBBR, kPAD, kBYTE});
76 EXPECT_EQ(str, message.DebugString());
77
78 // Test copy
79 CryptoHandshakeMessage message2(message);
80 EXPECT_EQ(str, message2.DebugString());
81
82 // Test move
83 CryptoHandshakeMessage message3(std::move(message));
84 EXPECT_EQ(str, message3.DebugString());
85
86 // Test assign
87 CryptoHandshakeMessage message4 = message3;
88 EXPECT_EQ(str, message4.DebugString());
89
90 // Test move-assign
91 CryptoHandshakeMessage message5 = std::move(message3);
92 EXPECT_EQ(str, message5.DebugString());
93 }
94
95 TEST(CryptoHandshakeMessageTest, ServerDesignatedConnectionId) {
96 const char* str = "SREJ<\n RCID: 18364758544493064720\n>";
97
98 CryptoHandshakeMessage message;
99 message.set_tag(kSREJ);
100 message.SetValue(kRCID, UINT64_C(18364758544493064720));
101 EXPECT_EQ(str, message.DebugString());
102
103 // Test copy
104 CryptoHandshakeMessage message2(message);
105 EXPECT_EQ(str, message2.DebugString());
106
107 // Test move
108 CryptoHandshakeMessage message3(std::move(message));
109 EXPECT_EQ(str, message3.DebugString());
110
111 // Test assign
112 CryptoHandshakeMessage message4 = message3;
113 EXPECT_EQ(str, message4.DebugString());
114
115 // Test move-assign
116 CryptoHandshakeMessage message5 = std::move(message3);
117 EXPECT_EQ(str, message5.DebugString());
118 }
119
120 } // namespace
121 } // namespace test
122 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/crypto_handshake_message.cc ('k') | net/quic/crypto/crypto_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698