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

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

Issue 2397873002: Reject some previuosly-escaped chars in hostnames.
Patch Set: Some tests fixed Created 4 years, 1 month 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 | « content/common/database_identifier_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/filename_util.h" 5 #include "net/base/filename_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 << kUnsafePortableBasenames[i]; 175 << kUnsafePortableBasenames[i];
176 } 176 }
177 } 177 }
178 } 178 }
179 179
180 TEST(FilenameUtilTest, FileURLConversion) { 180 TEST(FilenameUtilTest, FileURLConversion) {
181 // a list of test file names and the corresponding URLs 181 // a list of test file names and the corresponding URLs
182 const FileCase round_trip_cases[] = { 182 const FileCase round_trip_cases[] = {
183 #if defined(OS_WIN) 183 #if defined(OS_WIN)
184 {L"C:\\foo\\bar.txt", "file:///C:/foo/bar.txt"}, 184 {L"C:\\foo\\bar.txt", "file:///C:/foo/bar.txt"},
185 {L"\\\\some computer\\foo\\bar.txt", 185 {L"\\\\some_computer\\foo\\bar.txt",
186 "file://some%20computer/foo/bar.txt"}, // UNC 186 "file://some_computer/foo/bar.txt"}, // UNC
187 {L"D:\\Name;with%some symbols*#", 187 {L"D:\\Name;with%some symbols*#",
188 "file:///D:/Name%3Bwith%25some%20symbols*%23"}, 188 "file:///D:/Name%3Bwith%25some%20symbols*%23"},
189 // issue 14153: To be tested with the OS default codepage other than 1252. 189 // issue 14153: To be tested with the OS default codepage other than 1252.
190 {L"D:\\latin1\\caf\x00E9\x00DD.txt", 190 {L"D:\\latin1\\caf\x00E9\x00DD.txt",
191 "file:///D:/latin1/caf%C3%A9%C3%9D.txt"}, 191 "file:///D:/latin1/caf%C3%A9%C3%9D.txt"},
192 {L"D:\\otherlatin\\caf\x0119.txt", "file:///D:/otherlatin/caf%C4%99.txt"}, 192 {L"D:\\otherlatin\\caf\x0119.txt", "file:///D:/otherlatin/caf%C4%99.txt"},
193 {L"D:\\greek\\\x03B1\x03B2\x03B3.txt", 193 {L"D:\\greek\\\x03B1\x03B2\x03B3.txt",
194 "file:///D:/greek/%CE%B1%CE%B2%CE%B3.txt"}, 194 "file:///D:/greek/%CE%B1%CE%B2%CE%B3.txt"},
195 {L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc", 195 {L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc",
196 "file:///D:/Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91" 196 "file:///D:/Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91"
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1076 }
1077 1077
1078 for (size_t i = 0; i < arraysize(kUnsafePortableBasenamesForWindows); ++i) { 1078 for (size_t i = 0; i < arraysize(kUnsafePortableBasenamesForWindows); ++i) {
1079 EXPECT_TRUE(IsReservedNameOnWindows( 1079 EXPECT_TRUE(IsReservedNameOnWindows(
1080 base::FilePath(kUnsafePortableBasenamesForWindows[i]).value())) 1080 base::FilePath(kUnsafePortableBasenamesForWindows[i]).value()))
1081 << kUnsafePortableBasenamesForWindows[i]; 1081 << kUnsafePortableBasenamesForWindows[i];
1082 } 1082 }
1083 } 1083 }
1084 1084
1085 } // namespace net 1085 } // namespace net
OLDNEW
« no previous file with comments | « content/common/database_identifier_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698