| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 "Content-Disposition: attachment; name=\xcf\xc2\xd4\xd8.zip", | 965 "Content-Disposition: attachment; name=\xcf\xc2\xd4\xd8.zip", |
| 966 "GBK", | 966 "GBK", |
| 967 L"", | 967 L"", |
| 968 L"\u4e0b\u8f7d.zip"}, | 968 L"\u4e0b\u8f7d.zip"}, |
| 969 // Invalid C-D header. Extracts filename from url. | 969 // Invalid C-D header. Extracts filename from url. |
| 970 {"http://www.google.com/test.html", | 970 {"http://www.google.com/test.html", |
| 971 "Content-Disposition: attachment; filename==?iiso88591?Q?caf=EG?=", | 971 "Content-Disposition: attachment; filename==?iiso88591?Q?caf=EG?=", |
| 972 "", | 972 "", |
| 973 L"", | 973 L"", |
| 974 L"test.html"}, | 974 L"test.html"}, |
| 975 // about: and data: URLs |
| 976 {"about:chrome", |
| 977 "", |
| 978 "", |
| 979 L"", |
| 980 L"download"}, |
| 981 {"data:,looks/like/a.path", |
| 982 "", |
| 983 "", |
| 984 L"", |
| 985 L"download"}, |
| 986 {"data:text/plain;base64,VG8gYmUgb3Igbm90IHRvIGJlLg=", |
| 987 "", |
| 988 "", |
| 989 L"", |
| 990 L"download"}, |
| 975 }; | 991 }; |
| 976 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 992 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
| 977 std::wstring filename = net::GetSuggestedFilename( | 993 std::wstring filename = net::GetSuggestedFilename( |
| 978 GURL(test_cases[i].url), test_cases[i].content_disp_header, | 994 GURL(test_cases[i].url), test_cases[i].content_disp_header, |
| 979 test_cases[i].referrer_charset, test_cases[i].default_filename); | 995 test_cases[i].referrer_charset, test_cases[i].default_filename); |
| 980 EXPECT_EQ(std::wstring(test_cases[i].expected_filename), filename); | 996 EXPECT_EQ(std::wstring(test_cases[i].expected_filename), filename); |
| 981 } | 997 } |
| 982 } | 998 } |
| 983 | 999 |
| 984 // This is currently a windows specific function. | 1000 // This is currently a windows specific function. |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 net::SetExplicitlyAllowedPorts(invalid[i]); | 1434 net::SetExplicitlyAllowedPorts(invalid[i]); |
| 1419 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size())); | 1435 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size())); |
| 1420 } | 1436 } |
| 1421 | 1437 |
| 1422 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) { | 1438 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) { |
| 1423 net::SetExplicitlyAllowedPorts(valid[i]); | 1439 net::SetExplicitlyAllowedPorts(valid[i]); |
| 1424 EXPECT_EQ(i, net::explicitly_allowed_ports.size()); | 1440 EXPECT_EQ(i, net::explicitly_allowed_ports.size()); |
| 1425 } | 1441 } |
| 1426 } | 1442 } |
| 1427 | 1443 |
| OLD | NEW |