| OLD | NEW |
| 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_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 #if 0 | 1207 #if 0 |
| 1208 {"http://example.com/V%FDvojov%E1%20psychologie.doc", | 1208 {"http://example.com/V%FDvojov%E1%20psychologie.doc", |
| 1209 "", | 1209 "", |
| 1210 "utf-8", | 1210 "utf-8", |
| 1211 L"", | 1211 L"", |
| 1212 L"V\u00fdvojov\u00e1 psychologie.doc", | 1212 L"V\u00fdvojov\u00e1 psychologie.doc", |
| 1213 }, | 1213 }, |
| 1214 #endif | 1214 #endif |
| 1215 }; | 1215 }; |
| 1216 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 1216 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
| 1217 #if defined(OS_WIN) | 1217 std::wstring default_name = test_cases[i].default_filename; |
| 1218 FilePath default_name(test_cases[i].default_filename); | 1218 string16 filename = net::GetSuggestedFilename( |
| 1219 #else | |
| 1220 FilePath default_name( | |
| 1221 base::SysWideToNativeMB(test_cases[i].default_filename)); | |
| 1222 #endif | |
| 1223 FilePath filename = net::GetSuggestedFilename( | |
| 1224 GURL(test_cases[i].url), test_cases[i].content_disp_header, | 1219 GURL(test_cases[i].url), test_cases[i].content_disp_header, |
| 1225 test_cases[i].referrer_charset, default_name); | 1220 test_cases[i].referrer_charset, WideToUTF16(default_name)); |
| 1226 #if defined(OS_WIN) | 1221 EXPECT_EQ(std::wstring(test_cases[i].expected_filename), |
| 1227 EXPECT_EQ(std::wstring(test_cases[i].expected_filename), filename.value()) | 1222 UTF16ToWide(filename)) |
| 1228 #else | |
| 1229 EXPECT_EQ(base::SysWideToNativeMB(test_cases[i].expected_filename), | |
| 1230 filename.value()) | |
| 1231 #endif | |
| 1232 << "Iteration " << i << ": " << test_cases[i].url; | 1223 << "Iteration " << i << ": " << test_cases[i].url; |
| 1233 } | 1224 } |
| 1234 } | 1225 } |
| 1235 | 1226 |
| 1236 // This is currently a windows specific function. | 1227 // This is currently a windows specific function. |
| 1237 #if defined(OS_WIN) | 1228 #if defined(OS_WIN) |
| 1238 namespace { | 1229 namespace { |
| 1239 | 1230 |
| 1240 struct GetDirectoryListingEntryCase { | 1231 struct GetDirectoryListingEntryCase { |
| 1241 const wchar_t* name; | 1232 const wchar_t* name; |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 EXPECT_TRUE(net::ParseCIDRBlock(tests[i].cidr_literal, | 2153 EXPECT_TRUE(net::ParseCIDRBlock(tests[i].cidr_literal, |
| 2163 &ip_prefix, | 2154 &ip_prefix, |
| 2164 &prefix_length_in_bits)); | 2155 &prefix_length_in_bits)); |
| 2165 | 2156 |
| 2166 EXPECT_EQ(tests[i].expected_to_match, | 2157 EXPECT_EQ(tests[i].expected_to_match, |
| 2167 net::IPNumberMatchesPrefix(ip_number, | 2158 net::IPNumberMatchesPrefix(ip_number, |
| 2168 ip_prefix, | 2159 ip_prefix, |
| 2169 prefix_length_in_bits)); | 2160 prefix_length_in_bits)); |
| 2170 } | 2161 } |
| 2171 } | 2162 } |
| OLD | NEW |