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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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/crypto/crypto_utils.h" 5 #include "net/quic/crypto/crypto_utils.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace net { 9 namespace net {
10 namespace test { 10 namespace test {
(...skipping 10 matching lines...) Expand all
21 // An empty string must be invalid otherwise the QUIC client will try sending 21 // An empty string must be invalid otherwise the QUIC client will try sending
22 // it. 22 // it.
23 EXPECT_FALSE(CryptoUtils::IsValidSNI("")); 23 EXPECT_FALSE(CryptoUtils::IsValidSNI(""));
24 24
25 // Valid SNI 25 // Valid SNI
26 EXPECT_TRUE(CryptoUtils::IsValidSNI("test.google.com")); 26 EXPECT_TRUE(CryptoUtils::IsValidSNI("test.google.com"));
27 } 27 }
28 28
29 TEST(CryptoUtilsTest, NormalizeHostname) { 29 TEST(CryptoUtilsTest, NormalizeHostname) {
30 struct { 30 struct {
31 const char *input, *expected; 31 const char* input, *expected;
32 } tests[] = { 32 } tests[] = {
33 { "www.google.com", "www.google.com", }, 33 {
34 { "WWW.GOOGLE.COM", "www.google.com", }, 34 "www.google.com", "www.google.com",
35 { "www.google.com.", "www.google.com", }, 35 },
36 { "www.google.COM.", "www.google.com", }, 36 {
37 { "www.google.com..", "www.google.com", }, 37 "WWW.GOOGLE.COM", "www.google.com",
38 { "www.google.com........", "www.google.com", }, 38 },
39 }; 39 {
40 "www.google.com.", "www.google.com",
41 },
42 {
43 "www.google.COM.", "www.google.com",
44 },
45 {
46 "www.google.com..", "www.google.com",
47 },
48 {
49 "www.google.com........", "www.google.com",
50 },
51 };
40 52
41 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 53 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
42 EXPECT_EQ(std::string(tests[i].expected), 54 EXPECT_EQ(std::string(tests[i].expected),
43 CryptoUtils::NormalizeHostname(tests[i].input)); 55 CryptoUtils::NormalizeHostname(tests[i].input));
44 } 56 }
45 } 57 }
46 58
47 } // namespace 59 } // namespace
48 } // namespace test 60 } // namespace test
49 } // namespace net 61 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698