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

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

Issue 662553002: Convert ARRAYSIZE_UNSAFE -> arraysize in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/proxy/proxy_server_unittest.cc ('k') | net/quic/iovector_test.cc » ('j') | 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/crypto/crypto_utils.h" 5 #include "net/quic/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 namespace net { 10 namespace net {
(...skipping 21 matching lines...) Expand all
32 const char *input, *expected; 32 const char *input, *expected;
33 } tests[] = { 33 } tests[] = {
34 { "www.google.com", "www.google.com", }, 34 { "www.google.com", "www.google.com", },
35 { "WWW.GOOGLE.COM", "www.google.com", }, 35 { "WWW.GOOGLE.COM", "www.google.com", },
36 { "www.google.com.", "www.google.com", }, 36 { "www.google.com.", "www.google.com", },
37 { "www.google.COM.", "www.google.com", }, 37 { "www.google.COM.", "www.google.com", },
38 { "www.google.com..", "www.google.com", }, 38 { "www.google.com..", "www.google.com", },
39 { "www.google.com........", "www.google.com", }, 39 { "www.google.com........", "www.google.com", },
40 }; 40 };
41 41
42 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 42 for (size_t i = 0; i < arraysize(tests); ++i) {
43 EXPECT_EQ(std::string(tests[i].expected), 43 EXPECT_EQ(std::string(tests[i].expected),
44 CryptoUtils::NormalizeHostname(tests[i].input)); 44 CryptoUtils::NormalizeHostname(tests[i].input));
45 } 45 }
46 } 46 }
47 47
48 TEST(CryptoUtilsTest, TestExportKeyingMaterial) { 48 TEST(CryptoUtilsTest, TestExportKeyingMaterial) {
49 const struct TestVector { 49 const struct TestVector {
50 // Input (strings of hexadecimal digits): 50 // Input (strings of hexadecimal digits):
51 const char* subkey_secret; 51 const char* subkey_secret;
52 const char* label; 52 const char* label;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 }, 86 },
87 // Try weird lengths 87 // Try weird lengths
88 { "d0ec8a34f6cc9a8c96", 88 { "d0ec8a34f6cc9a8c96",
89 "49711798cc6251", 89 "49711798cc6251",
90 "933d4a2f30d22f089cfba842791116adc121e0", 90 "933d4a2f30d22f089cfba842791116adc121e0",
91 23, 91 23,
92 "c9a46ed0757bd1812f1f21b4d41e62125fec8364a21db7" 92 "c9a46ed0757bd1812f1f21b4d41e62125fec8364a21db7"
93 }, 93 },
94 }; 94 };
95 95
96 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_vector); i++) { 96 for (size_t i = 0; i < arraysize(test_vector); i++) {
97 // Decode the test vector. 97 // Decode the test vector.
98 string subkey_secret; 98 string subkey_secret;
99 string label; 99 string label;
100 string context; 100 string context;
101 ASSERT_TRUE(DecodeHexString(test_vector[i].subkey_secret, &subkey_secret)); 101 ASSERT_TRUE(DecodeHexString(test_vector[i].subkey_secret, &subkey_secret));
102 ASSERT_TRUE(DecodeHexString(test_vector[i].label, &label)); 102 ASSERT_TRUE(DecodeHexString(test_vector[i].label, &label));
103 ASSERT_TRUE(DecodeHexString(test_vector[i].context, &context)); 103 ASSERT_TRUE(DecodeHexString(test_vector[i].context, &context));
104 size_t result_len = test_vector[i].result_len; 104 size_t result_len = test_vector[i].result_len;
105 bool expect_ok = test_vector[i].expected != nullptr; 105 bool expect_ok = test_vector[i].expected != nullptr;
106 string expected; 106 string expected;
(...skipping 15 matching lines...) Expand all
122 result.length(), 122 result.length(),
123 expected.data(), 123 expected.data(),
124 expected.length()); 124 expected.length());
125 } 125 }
126 } 126 }
127 } 127 }
128 128
129 } // namespace 129 } // namespace
130 } // namespace test 130 } // namespace test
131 } // namespace net 131 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_server_unittest.cc ('k') | net/quic/iovector_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698