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

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

Issue 2733005: Download filename encoding fix [try2]: (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: add test Created 10 years, 6 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_util.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 {"http://www.google.com/.test", 1053 {"http://www.google.com/.test",
1054 "", 1054 "",
1055 "", 1055 "",
1056 L"", 1056 L"",
1057 L"test"}, 1057 L"test"},
1058 {"http://www.google.com/..test", 1058 {"http://www.google.com/..test",
1059 "", 1059 "",
1060 "", 1060 "",
1061 L"", 1061 L"",
1062 L"test"}, 1062 L"test"},
1063 // The filename encoding is specified by the referrer charset.
1064 {"http://example.com/V%FDvojov%E1%20psychologie.doc",
1065 "",
1066 "iso-8859-1",
1067 L"",
1068 L"V\u00fdvojov\u00e1 psychologie.doc"},
1069 // The filename encoding doesn't match the referrer charset, the
1070 // system charset, or UTF-8.
1071 // TODO(jshin): we need to handle this case.
1072 #if 0
1073 {"http://example.com/V%FDvojov%E1%20psychologie.doc",
1074 "",
1075 "utf-8",
1076 L"",
1077 L"V\u00fdvojov\u00e1 psychologie.doc",
1078 },
1079 #endif
1063 }; 1080 };
1064 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 1081 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
1065 #if defined(OS_WIN) 1082 #if defined(OS_WIN)
1066 FilePath default_name(test_cases[i].default_filename); 1083 FilePath default_name(test_cases[i].default_filename);
1067 #else 1084 #else
1068 FilePath default_name( 1085 FilePath default_name(
1069 base::SysWideToNativeMB(test_cases[i].default_filename)); 1086 base::SysWideToNativeMB(test_cases[i].default_filename));
1070 #endif 1087 #endif
1071 FilePath filename = net::GetSuggestedFilename( 1088 FilePath filename = net::GetSuggestedFilename(
1072 GURL(test_cases[i].url), test_cases[i].content_disp_header, 1089 GURL(test_cases[i].url), test_cases[i].content_disp_header,
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 EXPECT_TRUE(net::ParseCIDRBlock(tests[i].cidr_literal, 1969 EXPECT_TRUE(net::ParseCIDRBlock(tests[i].cidr_literal,
1953 &ip_prefix, 1970 &ip_prefix,
1954 &prefix_length_in_bits)); 1971 &prefix_length_in_bits));
1955 1972
1956 EXPECT_EQ(tests[i].expected_to_match, 1973 EXPECT_EQ(tests[i].expected_to_match,
1957 net::IPNumberMatchesPrefix(ip_number, 1974 net::IPNumberMatchesPrefix(ip_number,
1958 ip_prefix, 1975 ip_prefix,
1959 prefix_length_in_bits)); 1976 prefix_length_in_bits));
1960 } 1977 }
1961 } 1978 }
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698