| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |