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

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

Issue 536005: Add dotfile tests to NetUtil.GetSuggestedFilename (Closed)
Patch Set: Created 10 years, 11 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 | « no previous file | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 {"data:,looks/like/a.path", 1014 {"data:,looks/like/a.path",
1015 "", 1015 "",
1016 "", 1016 "",
1017 L"default_filename_is_given", 1017 L"default_filename_is_given",
1018 L"default_filename_is_given"}, 1018 L"default_filename_is_given"},
1019 {"data:,looks/like/a.path", 1019 {"data:,looks/like/a.path",
1020 "", 1020 "",
1021 "", 1021 "",
1022 L"\u65e5\u672c\u8a9e", // Japanese Kanji. 1022 L"\u65e5\u672c\u8a9e", // Japanese Kanji.
1023 L"\u65e5\u672c\u8a9e"}, 1023 L"\u65e5\u672c\u8a9e"},
1024 // Dotfiles. Ensures preceeding period(s) stripped.
1025 {"http://www.google.com/.test.html",
1026 "",
1027 "",
1028 L"",
1029 L"test.html"},
1030 {"http://www.google.com/.test",
1031 "",
1032 "",
1033 L"",
1034 L"test"},
1035 {"http://www.google.com/..test",
1036 "",
1037 "",
1038 L"",
1039 L"test"},
1024 }; 1040 };
1025 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 1041 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
1026 #if defined(OS_WIN) 1042 #if defined(OS_WIN)
1027 FilePath default_name(test_cases[i].default_filename); 1043 FilePath default_name(test_cases[i].default_filename);
1028 #else 1044 #else
1029 FilePath default_name( 1045 FilePath default_name(
1030 base::SysWideToNativeMB(test_cases[i].default_filename)); 1046 base::SysWideToNativeMB(test_cases[i].default_filename));
1031 #endif 1047 #endif
1032 FilePath filename = net::GetSuggestedFilename( 1048 FilePath filename = net::GetSuggestedFilename(
1033 GURL(test_cases[i].url), test_cases[i].content_disp_header, 1049 GURL(test_cases[i].url), test_cases[i].content_disp_header,
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalid); ++i) { 1612 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalid); ++i) {
1597 net::SetExplicitlyAllowedPorts(invalid[i]); 1613 net::SetExplicitlyAllowedPorts(invalid[i]);
1598 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size())); 1614 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size()));
1599 } 1615 }
1600 1616
1601 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) { 1617 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) {
1602 net::SetExplicitlyAllowedPorts(valid[i]); 1618 net::SetExplicitlyAllowedPorts(valid[i]);
1603 EXPECT_EQ(i, net::explicitly_allowed_ports.size()); 1619 EXPECT_EQ(i, net::explicitly_allowed_ports.size());
1604 } 1620 }
1605 } 1621 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698