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

Side by Side Diff: net/quic/core/crypto/crypto_utils_test.cc

Issue 2097913002: Update QuicConnectionLogger to always log missing_packets, even for v34. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test for domain names containing '_', in order to be more accepting of non-standard SNI. Created 4 years, 3 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/crypto/crypto_utils.cc ('k') | no next file » | 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) 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/core/crypto/crypto_utils.h" 5 #include "net/quic/core/crypto/crypto_utils.h"
6 6
7 #include "net/quic/test_tools/quic_test_utils.h" 7 #include "net/quic/test_tools/quic_test_utils.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using std::string; 10 using std::string;
11 11
12 namespace net { 12 namespace net {
13 namespace test { 13 namespace test {
14 namespace { 14 namespace {
15 15
16 TEST(CryptoUtilsTest, IsValidSNI) { 16 TEST(CryptoUtilsTest, IsValidSNI) {
17 // IP as SNI. 17 // IP as SNI.
18 EXPECT_FALSE(CryptoUtils::IsValidSNI("192.168.0.1")); 18 EXPECT_FALSE(CryptoUtils::IsValidSNI("192.168.0.1"));
19 // SNI without any dot. 19 // SNI without any dot.
20 EXPECT_FALSE(CryptoUtils::IsValidSNI("somedomain")); 20 EXPECT_FALSE(CryptoUtils::IsValidSNI("somedomain"));
21 // Invalid RFC2396 hostname 21 // Invalid by RFC2396 but unfortunately domains of this form exist.
22 // TODO(rtenneti): Support RFC2396 hostname. 22 EXPECT_TRUE(CryptoUtils::IsValidSNI("some_domain.com"));
23 // EXPECT_FALSE(CryptoUtils::IsValidSNI("some_domain.com"));
24 // An empty string must be invalid otherwise the QUIC client will try sending 23 // An empty string must be invalid otherwise the QUIC client will try sending
25 // it. 24 // it.
26 EXPECT_FALSE(CryptoUtils::IsValidSNI("")); 25 EXPECT_FALSE(CryptoUtils::IsValidSNI(""));
27 26
28 // Valid SNI 27 // Valid SNI
29 EXPECT_TRUE(CryptoUtils::IsValidSNI("test.google.com")); 28 EXPECT_TRUE(CryptoUtils::IsValidSNI("test.google.com"));
30 } 29 }
31 30
32 TEST(CryptoUtilsTest, NormalizeHostname) { 31 TEST(CryptoUtilsTest, NormalizeHostname) {
33 struct { 32 struct {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 CryptoUtils::HandshakeFailureReasonToString(MAX_FAILURE_REASON)); 185 CryptoUtils::HandshakeFailureReasonToString(MAX_FAILURE_REASON));
187 EXPECT_STREQ( 186 EXPECT_STREQ(
188 "INVALID_HANDSHAKE_FAILURE_REASON", 187 "INVALID_HANDSHAKE_FAILURE_REASON",
189 CryptoUtils::HandshakeFailureReasonToString( 188 CryptoUtils::HandshakeFailureReasonToString(
190 static_cast<HandshakeFailureReason>(MAX_FAILURE_REASON + 1))); 189 static_cast<HandshakeFailureReason>(MAX_FAILURE_REASON + 1)));
191 } 190 }
192 191
193 } // namespace 192 } // namespace
194 } // namespace test 193 } // namespace test
195 } // namespace net 194 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/crypto_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698