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

Side by Side Diff: net/base/net_util_icu_unittest.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/base/net_log_logger.cc ('k') | net/base/net_util_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 url_length, formatted_url); 404 url_length, formatted_url);
405 VerboseExpect(base::string16::npos, offsets[url_length + 1], url_string, 405 VerboseExpect(base::string16::npos, offsets[url_length + 1], url_string,
406 500000, formatted_url); 406 500000, formatted_url);
407 VerboseExpect(base::string16::npos, offsets[url_length + 2], url_string, 407 VerboseExpect(base::string16::npos, offsets[url_length + 2], url_string,
408 std::string::npos, formatted_url); 408 std::string::npos, formatted_url);
409 } 409 }
410 410
411 } // anonymous namespace 411 } // anonymous namespace
412 412
413 TEST(NetUtilTest, IDNToUnicodeFast) { 413 TEST(NetUtilTest, IDNToUnicodeFast) {
414 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) { 414 for (size_t i = 0; i < arraysize(idn_cases); i++) {
415 for (size_t j = 0; j < arraysize(kLanguages); j++) { 415 for (size_t j = 0; j < arraysize(kLanguages); j++) {
416 // ja || zh-TW,en || ko,ja -> IDNToUnicodeSlow 416 // ja || zh-TW,en || ko,ja -> IDNToUnicodeSlow
417 if (j == 3 || j == 17 || j == 18) 417 if (j == 3 || j == 17 || j == 18)
418 continue; 418 continue;
419 base::string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j])); 419 base::string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j]));
420 base::string16 expected(idn_cases[i].unicode_allowed[j] ? 420 base::string16 expected(idn_cases[i].unicode_allowed[j] ?
421 WideToUTF16(idn_cases[i].unicode_output) : 421 WideToUTF16(idn_cases[i].unicode_output) :
422 ASCIIToUTF16(idn_cases[i].input)); 422 ASCIIToUTF16(idn_cases[i].input));
423 AppendLanguagesToOutputs(kLanguages[j], &expected, &output); 423 AppendLanguagesToOutputs(kLanguages[j], &expected, &output);
424 EXPECT_EQ(expected, output); 424 EXPECT_EQ(expected, output);
425 } 425 }
426 } 426 }
427 } 427 }
428 428
429 TEST(NetUtilTest, IDNToUnicodeSlow) { 429 TEST(NetUtilTest, IDNToUnicodeSlow) {
430 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) { 430 for (size_t i = 0; i < arraysize(idn_cases); i++) {
431 for (size_t j = 0; j < arraysize(kLanguages); j++) { 431 for (size_t j = 0; j < arraysize(kLanguages); j++) {
432 // !(ja || zh-TW,en || ko,ja) -> IDNToUnicodeFast 432 // !(ja || zh-TW,en || ko,ja) -> IDNToUnicodeFast
433 if (!(j == 3 || j == 17 || j == 18)) 433 if (!(j == 3 || j == 17 || j == 18))
434 continue; 434 continue;
435 base::string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j])); 435 base::string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j]));
436 base::string16 expected(idn_cases[i].unicode_allowed[j] ? 436 base::string16 expected(idn_cases[i].unicode_allowed[j] ?
437 WideToUTF16(idn_cases[i].unicode_output) : 437 WideToUTF16(idn_cases[i].unicode_output) :
438 ASCIIToUTF16(idn_cases[i].input)); 438 ASCIIToUTF16(idn_cases[i].input));
439 AppendLanguagesToOutputs(kLanguages[j], &expected, &output); 439 AppendLanguagesToOutputs(kLanguages[j], &expected, &output);
440 EXPECT_EQ(expected, output); 440 EXPECT_EQ(expected, output);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 // a local or remote file in EUC-KR. 499 // a local or remote file in EUC-KR.
500 {L"\xD55C\xAE00.txt", 500 {L"\xD55C\xAE00.txt",
501 "\xC7\xD1\xB1\xDB.txt", 501 "\xC7\xD1\xB1\xDB.txt",
502 false, 502 false,
503 10000, 503 10000,
504 base::Time(), 504 base::Time(),
505 "<script>addRow(\"\xED\x95\x9C\xEA\xB8\x80.txt\",\"%C7%D1%B1%DB.txt\"" 505 "<script>addRow(\"\xED\x95\x9C\xEA\xB8\x80.txt\",\"%C7%D1%B1%DB.txt\""
506 ",0,\"9.8 kB\",\"\");</script>\n"}, 506 ",0,\"9.8 kB\",\"\");</script>\n"},
507 }; 507 };
508 508
509 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 509 for (size_t i = 0; i < arraysize(test_cases); ++i) {
510 const std::string results = GetDirectoryListingEntry( 510 const std::string results = GetDirectoryListingEntry(
511 WideToUTF16(test_cases[i].name), 511 WideToUTF16(test_cases[i].name),
512 test_cases[i].raw_bytes, 512 test_cases[i].raw_bytes,
513 test_cases[i].is_dir, 513 test_cases[i].is_dir,
514 test_cases[i].filesize, 514 test_cases[i].filesize,
515 test_cases[i].time); 515 test_cases[i].time);
516 EXPECT_EQ(test_cases[i].expected, results); 516 EXPECT_EQ(test_cases[i].expected, results);
517 } 517 }
518 } 518 }
519 519
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 const size_t omit_all_offsets[] = { 1063 const size_t omit_all_offsets[] = {
1064 0, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, kNpos, kNpos, kNpos, kNpos, 1064 0, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, kNpos, kNpos, kNpos, kNpos,
1065 0, 1, 2, 3, 4, 5, 6, 7 1065 0, 1, 2, 3, 4, 5, 6, 7
1066 }; 1066 };
1067 CheckAdjustedOffsets("http://user@foo.com/", "en", kFormatUrlOmitAll, 1067 CheckAdjustedOffsets("http://user@foo.com/", "en", kFormatUrlOmitAll,
1068 UnescapeRule::NORMAL, omit_all_offsets); 1068 UnescapeRule::NORMAL, omit_all_offsets);
1069 } 1069 }
1070 1070
1071 } // namespace net 1071 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_log_logger.cc ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698