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

Side by Side Diff: net/base/net_util_unittest.cc

Issue 6898026: Eliminate wstring from base/utf_offset_string_conversions.h, net/base/escape.h, and net/base/net_... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 13 matching lines...) Expand all
24 namespace { 24 namespace {
25 25
26 static const size_t kNpos = string16::npos; 26 static const size_t kNpos = string16::npos;
27 27
28 struct FileCase { 28 struct FileCase {
29 const wchar_t* file; 29 const wchar_t* file;
30 const char* url; 30 const char* url;
31 }; 31 };
32 32
33 struct HeaderCase { 33 struct HeaderCase {
34 const wchar_t* header_name; 34 const char* header_name;
35 const wchar_t* expected; 35 const char* expected;
36 }; 36 };
37 37
38 struct HeaderParamCase { 38 struct HeaderParamCase {
39 const wchar_t* header_name; 39 const char* header_name;
40 const wchar_t* param_name; 40 const char* param_name;
41 const wchar_t* expected; 41 const char* expected;
42 }; 42 };
43 43
44 struct FileNameCDCase { 44 struct FileNameCDCase {
45 const char* header_field; 45 const char* header_field;
46 const char* referrer_charset; 46 const char* referrer_charset;
47 const wchar_t* expected; 47 const wchar_t* expected;
48 }; 48 };
49 49
50 const wchar_t* kLanguages[] = { 50 const char* kLanguages[] = {
51 L"", L"en", L"zh-CN", L"ja", L"ko", 51 "", "en", "zh-CN", "ja", "ko",
52 L"he", L"ar", L"ru", L"el", L"fr", 52 "he", "ar", "ru", "el", "fr",
53 L"de", L"pt", L"sv", L"th", L"hi", 53 "de", "pt", "sv", "th", "hi",
54 L"de,en", L"el,en", L"zh-TW,en", L"ko,ja", L"he,ru,en", 54 "de,en", "el,en", "zh-TW,en", "ko,ja", "he,ru,en",
55 L"zh,ru,en" 55 "zh,ru,en"
56 }; 56 };
57 57
58 struct IDNTestCase { 58 struct IDNTestCase {
59 const char* input; 59 const char* input;
60 const wchar_t* unicode_output; 60 const wchar_t* unicode_output;
61 const bool unicode_allowed[arraysize(kLanguages)]; 61 const bool unicode_allowed[arraysize(kLanguages)];
62 }; 62 };
63 63
64 // TODO(jungshik) This is just a random sample of languages and is far 64 // TODO(jungshik) This is just a random sample of languages and is far
65 // from exhaustive. We may have to generate all the combinations 65 // from exhaustive. We may have to generate all the combinations
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 addr6->sin6_family = ai->ai_family; 444 addr6->sin6_family = ai->ai_family;
445 memcpy(&addr6->sin6_addr, bytes, 16); 445 memcpy(&addr6->sin6_addr, bytes, 16);
446 446
447 ai->ai_addr = (sockaddr*)addr6; 447 ai->ai_addr = (sockaddr*)addr6;
448 return ai; 448 return ai;
449 } 449 }
450 450
451 // A helper for IDN*{Fast,Slow}. 451 // A helper for IDN*{Fast,Slow}.
452 // Append "::<language list>" to |expected| and |actual| to make it 452 // Append "::<language list>" to |expected| and |actual| to make it
453 // easy to tell which sub-case fails without debugging. 453 // easy to tell which sub-case fails without debugging.
454 void AppendLanguagesToOutputs(const wchar_t* languages, 454 void AppendLanguagesToOutputs(const char* languages,
455 std::wstring* expected, 455 string16* expected,
456 std::wstring* actual) { 456 string16* actual) {
457 expected->append(L"::"); 457 string16 to_append = ASCIIToUTF16("::") + ASCIIToUTF16(languages);
458 expected->append(languages); 458 expected->append(to_append);
459 actual->append(L"::"); 459 actual->append(to_append);
460 actual->append(languages);
461 } 460 }
462 461
463 // Helper to strignize an IP number (used to define expectations). 462 // Helper to strignize an IP number (used to define expectations).
464 std::string DumpIPNumber(const IPAddressNumber& v) { 463 std::string DumpIPNumber(const IPAddressNumber& v) {
465 std::string out; 464 std::string out;
466 for (size_t i = 0; i < v.size(); ++i) { 465 for (size_t i = 0; i < v.size(); ++i) {
467 if (i != 0) 466 if (i != 0)
468 out.append(","); 467 out.append(",");
469 out.append(base::IntToString(static_cast<int>(v[i]))); 468 out.append(base::IntToString(static_cast<int>(v[i])));
470 } 469 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // Extract the unescaped identity. 642 // Extract the unescaped identity.
644 string16 username, password; 643 string16 username, password;
645 GetIdentityFromURL(url, &username, &password); 644 GetIdentityFromURL(url, &username, &password);
646 645
647 // Verify that it was decoded as UTF8. 646 // Verify that it was decoded as UTF8.
648 EXPECT_EQ(ASCIIToUTF16("foo"), username); 647 EXPECT_EQ(ASCIIToUTF16("foo"), username);
649 EXPECT_EQ(WideToUTF16(L"\x4f60\x597d"), password); 648 EXPECT_EQ(WideToUTF16(L"\x4f60\x597d"), password);
650 } 649 }
651 650
652 // Just a bunch of fake headers. 651 // Just a bunch of fake headers.
653 const wchar_t* google_headers = 652 const char* google_headers =
654 L"HTTP/1.1 200 OK\n" 653 "HTTP/1.1 200 OK\n"
655 L"Content-TYPE: text/html; charset=utf-8\n" 654 "Content-TYPE: text/html; charset=utf-8\n"
656 L"Content-disposition: attachment; filename=\"download.pdf\"\n" 655 "Content-disposition: attachment; filename=\"download.pdf\"\n"
657 L"Content-Length: 378557\n" 656 "Content-Length: 378557\n"
658 L"X-Google-Google1: 314159265\n" 657 "X-Google-Google1: 314159265\n"
659 L"X-Google-Google2: aaaa2:7783,bbb21:9441\n" 658 "X-Google-Google2: aaaa2:7783,bbb21:9441\n"
660 L"X-Google-Google4: home\n" 659 "X-Google-Google4: home\n"
661 L"Transfer-Encoding: chunked\n" 660 "Transfer-Encoding: chunked\n"
662 L"Set-Cookie: HEHE_AT=6666x66beef666x6-66xx6666x66; Path=/mail\n" 661 "Set-Cookie: HEHE_AT=6666x66beef666x6-66xx6666x66; Path=/mail\n"
663 L"Set-Cookie: HEHE_HELP=owned:0;Path=/\n" 662 "Set-Cookie: HEHE_HELP=owned:0;Path=/\n"
664 L"Set-Cookie: S=gmail=Xxx-beefbeefbeef_beefb:gmail_yj=beefbeef000beefbee" 663 "Set-Cookie: S=gmail=Xxx-beefbeefbeef_beefb:gmail_yj=beefbeef000beefbee"
665 L"fbee:gmproxy=bee-fbeefbe; Domain=.google.com; Path=/\n" 664 "fbee:gmproxy=bee-fbeefbe; Domain=.google.com; Path=/\n"
666 L"X-Google-Google2: /one/two/three/four/five/six/seven-height/nine:9411\n" 665 "X-Google-Google2: /one/two/three/four/five/six/seven-height/nine:9411\n"
667 L"Server: GFE/1.3\n" 666 "Server: GFE/1.3\n"
668 L"Transfer-Encoding: chunked\n" 667 "Transfer-Encoding: chunked\n"
669 L"Date: Mon, 13 Nov 2006 21:38:09 GMT\n" 668 "Date: Mon, 13 Nov 2006 21:38:09 GMT\n"
670 L"Expires: Tue, 14 Nov 2006 19:23:58 GMT\n" 669 "Expires: Tue, 14 Nov 2006 19:23:58 GMT\n"
671 L"X-Malformed: bla; arg=test\"\n" 670 "X-Malformed: bla; arg=test\"\n"
672 L"X-Malformed2: bla; arg=\n" 671 "X-Malformed2: bla; arg=\n"
673 L"X-Test: bla; arg1=val1; arg2=val2"; 672 "X-Test: bla; arg1=val1; arg2=val2";
674 673
675 TEST(NetUtilTest, GetSpecificHeader) { 674 TEST(NetUtilTest, GetSpecificHeader) {
676 const HeaderCase tests[] = { 675 const HeaderCase tests[] = {
677 {L"content-type", L"text/html; charset=utf-8"}, 676 {"content-type", "text/html; charset=utf-8"},
678 {L"CONTENT-LENGTH", L"378557"}, 677 {"CONTENT-LENGTH", "378557"},
679 {L"Date", L"Mon, 13 Nov 2006 21:38:09 GMT"}, 678 {"Date", "Mon, 13 Nov 2006 21:38:09 GMT"},
680 {L"Bad-Header", L""}, 679 {"Bad-Header", ""},
681 {L"", L""}, 680 {"", ""},
682 }; 681 };
683 682
684 // Test first with google_headers. 683 // Test first with google_headers.
685 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 684 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
686 std::wstring result = GetSpecificHeader(google_headers, 685 std::string result =
687 tests[i].header_name); 686 GetSpecificHeader(google_headers, tests[i].header_name);
688 EXPECT_EQ(result, tests[i].expected); 687 EXPECT_EQ(result, tests[i].expected);
689 } 688 }
690 689
691 // Test again with empty headers. 690 // Test again with empty headers.
692 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 691 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
693 std::wstring result = GetSpecificHeader(L"", tests[i].header_name); 692 std::string result = GetSpecificHeader(std::string(), tests[i].header_name);
694 EXPECT_EQ(result, std::wstring()); 693 EXPECT_EQ(result, std::string());
695 } 694 }
696 } 695 }
697 696
698 TEST(NetUtilTest, GetHeaderParamValue) { 697 TEST(NetUtilTest, GetHeaderParamValue) {
699 const HeaderParamCase tests[] = { 698 const HeaderParamCase tests[] = {
700 {L"Content-type", L"charset", L"utf-8"}, 699 {"Content-type", "charset", "utf-8"},
701 {L"content-disposition", L"filename", L"download.pdf"}, 700 {"content-disposition", "filename", "download.pdf"},
702 {L"Content-Type", L"badparam", L""}, 701 {"Content-Type", "badparam", ""},
703 {L"X-Malformed", L"arg", L"test\""}, 702 {"X-Malformed", "arg", "test\""},
704 {L"X-Malformed2", L"arg", L""}, 703 {"X-Malformed2", "arg", ""},
705 {L"X-Test", L"arg1", L"val1"}, 704 {"X-Test", "arg1", "val1"},
706 {L"X-Test", L"arg2", L"val2"}, 705 {"X-Test", "arg2", "val2"},
707 {L"Bad-Header", L"badparam", L""}, 706 {"Bad-Header", "badparam", ""},
708 {L"Bad-Header", L"", L""}, 707 {"Bad-Header", "", ""},
709 {L"", L"badparam", L""}, 708 {"", "badparam", ""},
710 {L"", L"", L""}, 709 {"", "", ""},
711 }; 710 };
712 // TODO(mpcomplete): add tests for other formats of headers. 711 // TODO(mpcomplete): add tests for other formats of headers.
713 712
714 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 713 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
715 std::wstring header_value = 714 std::string header_value =
716 GetSpecificHeader(google_headers, tests[i].header_name); 715 GetSpecificHeader(google_headers, tests[i].header_name);
717 std::wstring result = 716 std::string result =
718 GetHeaderParamValue(header_value, tests[i].param_name, 717 GetHeaderParamValue(header_value, tests[i].param_name,
719 QuoteRule::REMOVE_OUTER_QUOTES); 718 QuoteRule::REMOVE_OUTER_QUOTES);
720 EXPECT_EQ(result, tests[i].expected); 719 EXPECT_EQ(result, tests[i].expected);
721 } 720 }
722 721
723 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 722 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
724 std::wstring header_value = 723 std::string header_value =
725 GetSpecificHeader(L"", tests[i].header_name); 724 GetSpecificHeader(std::string(), tests[i].header_name);
726 std::wstring result = 725 std::string result =
727 GetHeaderParamValue(header_value, tests[i].param_name, 726 GetHeaderParamValue(header_value, tests[i].param_name,
728 QuoteRule::REMOVE_OUTER_QUOTES); 727 QuoteRule::REMOVE_OUTER_QUOTES);
729 EXPECT_EQ(result, std::wstring()); 728 EXPECT_EQ(result, std::string());
730 } 729 }
731 } 730 }
732 731
733 TEST(NetUtilTest, GetHeaderParamValueQuotes) { 732 TEST(NetUtilTest, GetHeaderParamValueQuotes) {
734 struct { 733 struct {
735 const char* header; 734 const char* header;
736 const char* expected_with_quotes; 735 const char* expected_with_quotes;
737 const char* expected_without_quotes; 736 const char* expected_without_quotes;
738 } tests[] = { 737 } tests[] = {
739 {"filename=foo", "foo", "foo"}, 738 {"filename=foo", "foo", "foo"},
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 << "Failed on input: " << tests[i].header_field; 933 << "Failed on input: " << tests[i].header_field;
935 } 934 }
936 } 935 }
937 936
938 TEST(NetUtilTest, IDNToUnicodeFast) { 937 TEST(NetUtilTest, IDNToUnicodeFast) {
939 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) { 938 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) {
940 for (size_t j = 0; j < arraysize(kLanguages); j++) { 939 for (size_t j = 0; j < arraysize(kLanguages); j++) {
941 // ja || zh-TW,en || ko,ja -> IDNToUnicodeSlow 940 // ja || zh-TW,en || ko,ja -> IDNToUnicodeSlow
942 if (j == 3 || j == 17 || j == 18) 941 if (j == 3 || j == 17 || j == 18)
943 continue; 942 continue;
944 std::wstring output(IDNToUnicode(idn_cases[i].input, 943 string16 output(IDNToUnicode(idn_cases[i].input,
945 strlen(idn_cases[i].input), kLanguages[j], NULL)); 944 strlen(idn_cases[i].input), kLanguages[j]));
946 std::wstring expected(idn_cases[i].unicode_allowed[j] ? 945 string16 expected(idn_cases[i].unicode_allowed[j] ?
947 idn_cases[i].unicode_output : ASCIIToWide(idn_cases[i].input)); 946 WideToUTF16(idn_cases[i].unicode_output) :
947 ASCIIToUTF16(idn_cases[i].input));
948 AppendLanguagesToOutputs(kLanguages[j], &expected, &output); 948 AppendLanguagesToOutputs(kLanguages[j], &expected, &output);
949 EXPECT_EQ(expected, output); 949 EXPECT_EQ(expected, output);
950 } 950 }
951 } 951 }
952 } 952 }
953 953
954 TEST(NetUtilTest, IDNToUnicodeSlow) { 954 TEST(NetUtilTest, IDNToUnicodeSlow) {
955 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) { 955 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) {
956 for (size_t j = 0; j < arraysize(kLanguages); j++) { 956 for (size_t j = 0; j < arraysize(kLanguages); j++) {
957 // !(ja || zh-TW,en || ko,ja) -> IDNToUnicodeFast 957 // !(ja || zh-TW,en || ko,ja) -> IDNToUnicodeFast
958 if (!(j == 3 || j == 17 || j == 18)) 958 if (!(j == 3 || j == 17 || j == 18))
959 continue; 959 continue;
960 std::wstring output(IDNToUnicode(idn_cases[i].input, 960 string16 output(IDNToUnicode(idn_cases[i].input,
961 strlen(idn_cases[i].input), kLanguages[j], NULL)); 961 strlen(idn_cases[i].input), kLanguages[j]));
962 std::wstring expected(idn_cases[i].unicode_allowed[j] ? 962 string16 expected(idn_cases[i].unicode_allowed[j] ?
963 idn_cases[i].unicode_output : ASCIIToWide(idn_cases[i].input)); 963 WideToUTF16(idn_cases[i].unicode_output) :
964 ASCIIToUTF16(idn_cases[i].input));
964 AppendLanguagesToOutputs(kLanguages[j], &expected, &output); 965 AppendLanguagesToOutputs(kLanguages[j], &expected, &output);
965 EXPECT_EQ(expected, output); 966 EXPECT_EQ(expected, output);
966 } 967 }
967 } 968 }
968 } 969 }
969 970
970 TEST(NetUtilTest, IDNToUnicodeAdjustOffset) {
971 const AdjustOffsetCase adjust_cases[] = {
972 {0, 0},
973 {2, 2},
974 {4, 4},
975 {5, 5},
976 {6, string16::npos},
977 {16, string16::npos},
978 {17, 7},
979 {18, 8},
980 {19, string16::npos},
981 {25, string16::npos},
982 {34, 12},
983 {35, 13},
984 {38, 16},
985 {39, string16::npos},
986 {string16::npos, string16::npos},
987 };
988 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(adjust_cases); ++i) {
989 size_t offset = adjust_cases[i].input_offset;
990 // "test.\x89c6\x9891.\x5317\x4eac\x5927\x5b78.test"
991 IDNToUnicode("test.xn--cy2a840a.xn--1lq90ic7f1rc.test", 39, L"zh-CN",
992 &offset);
993 EXPECT_EQ(adjust_cases[i].output_offset, offset);
994 }
995
996 std::vector<size_t> offsets;
997 for (size_t i = 0; i < 40; ++i)
998 offsets.push_back(i);
999 IDNToUnicodeWithOffsets("test.xn--cy2a840a.xn--1lq90ic7f1rc.test", 39,
1000 L"zh-CN", &offsets);
1001 size_t expected[] = {0, 1, 2, 3, 4, 5, kNpos, kNpos, kNpos, kNpos, kNpos,
1002 kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 7, 8, kNpos,
1003 kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos,
1004 kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 12, 13, 14, 15,
1005 16, kNpos};
1006 ASSERT_EQ(40U, arraysize(expected));
1007 for (size_t i = 0; i < 40; ++i)
1008 EXPECT_EQ(expected[i], offsets[i]);
1009 }
1010
1011 TEST(NetUtilTest, CompliantHost) { 971 TEST(NetUtilTest, CompliantHost) {
1012 const CompliantHostCase compliant_host_cases[] = { 972 const CompliantHostCase compliant_host_cases[] = {
1013 {"", "", false}, 973 {"", "", false},
1014 {"a", "", true}, 974 {"a", "", true},
1015 {"-", "", false}, 975 {"-", "", false},
1016 {".", "", false}, 976 {".", "", false},
1017 {"9", "", false}, 977 {"9", "", false},
1018 {"9", "a", true}, 978 {"9", "a", true},
1019 {"9a", "", false}, 979 {"9a", "", false},
1020 {"9a", "a", true}, 980 {"9a", "a", true},
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 std::wstring default_name = test_cases[i].default_filename; 1202 std::wstring default_name = test_cases[i].default_filename;
1243 string16 filename = GetSuggestedFilename( 1203 string16 filename = GetSuggestedFilename(
1244 GURL(test_cases[i].url), test_cases[i].content_disp_header, 1204 GURL(test_cases[i].url), test_cases[i].content_disp_header,
1245 test_cases[i].referrer_charset, WideToUTF16(default_name)); 1205 test_cases[i].referrer_charset, WideToUTF16(default_name));
1246 EXPECT_EQ(std::wstring(test_cases[i].expected_filename), 1206 EXPECT_EQ(std::wstring(test_cases[i].expected_filename),
1247 UTF16ToWide(filename)) 1207 UTF16ToWide(filename))
1248 << "Iteration " << i << ": " << test_cases[i].url; 1208 << "Iteration " << i << ": " << test_cases[i].url;
1249 } 1209 }
1250 } 1210 }
1251 1211
1212 TEST(NetUtilTest, AppendFormattedHostAdjustOffset) {
1213 const AdjustOffsetCase adjust_cases[] = {
1214 {7, 7},
1215 {9, 9},
1216 {11, 11},
1217 {12, 12},
1218 {13, string16::npos},
1219 {23, string16::npos},
1220 {24, 14},
1221 {25, 15},
1222 {26, string16::npos},
1223 {32, string16::npos},
1224 {41, 19},
1225 {42, 20},
1226 {45, 23},
1227 {46, string16::npos},
1228 {string16::npos, string16::npos},
1229 };
1230 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(adjust_cases); ++i) {
1231 size_t offset = adjust_cases[i].input_offset;
1232 // "test.\x89c6\x9891.\x5317\x4eac\x5927\x5b78.test"
1233 string16 output;
1234 AppendFormattedHost(GURL("http://test.xn--cy2a840a.xn--1lq90ic7f1rc.test/"),
1235 "zh-CN", &output, NULL, &offset);
1236 EXPECT_EQ(adjust_cases[i].output_offset, offset);
1237 }
1238
1239 std::vector<size_t> offsets;
1240 // 7 == "http://"
1241 for (size_t i = 7; i < 47; ++i)
1242 offsets.push_back(i);
1243 string16 output;
1244 AppendFormattedHostWithOffsets(
1245 GURL("http://test.xn--cy2a840a.xn--1lq90ic7f1rc.test/"), "zh-CN", &output,
1246 NULL, &offsets);
1247 size_t expected[] = {7, 8, 9, 10, 11, 12, kNpos, kNpos, kNpos, kNpos, kNpos,
1248 kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 14, 15, kNpos,
1249 kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos,
1250 kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 19, 20, 21, 22,
1251 23, kNpos};
1252 ASSERT_EQ(40U, arraysize(expected));
1253 for (size_t i = 0; i < 40; ++i)
1254 EXPECT_EQ(expected[i], offsets[i]);
1255 }
1256
1252 // This is currently a windows specific function. 1257 // This is currently a windows specific function.
1253 #if defined(OS_WIN) 1258 #if defined(OS_WIN)
1254 namespace { 1259 namespace {
1255 1260
1256 struct GetDirectoryListingEntryCase { 1261 struct GetDirectoryListingEntryCase {
1257 const wchar_t* name; 1262 const wchar_t* name;
1258 const char* raw_bytes; 1263 const char* raw_bytes;
1259 bool is_dir; 1264 bool is_dir;
1260 int64 filesize; 1265 int64 filesize;
1261 base::Time time; 1266 base::Time time;
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 std::back_inserter(new_offsets), 2382 std::back_inserter(new_offsets),
2378 ClampComponentOffset(5)); 2383 ClampComponentOffset(5));
2379 size_t expected_1[] = {kNpos, kNpos, kNpos, kNpos, kNpos, 5, 6, 7, 8, 9}; 2384 size_t expected_1[] = {kNpos, kNpos, kNpos, kNpos, kNpos, 5, 6, 7, 8, 9};
2380 EXPECT_EQ(new_offsets.size(), arraysize(expected_1)); 2385 EXPECT_EQ(new_offsets.size(), arraysize(expected_1));
2381 EXPECT_EQ(new_offsets.size(), old_offsets.size()); 2386 EXPECT_EQ(new_offsets.size(), old_offsets.size());
2382 for (size_t i = 0; i < arraysize(expected_1); ++i) 2387 for (size_t i = 0; i < arraysize(expected_1); ++i)
2383 EXPECT_EQ(expected_1[i], new_offsets[i]); 2388 EXPECT_EQ(expected_1[i], new_offsets[i]);
2384 } 2389 }
2385 2390
2386 } // namespace net 2391 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698