Chromium Code Reviews| Index: net/base/filename_util_unittest.cc |
| diff --git a/net/base/filename_util_unittest.cc b/net/base/filename_util_unittest.cc |
| index 5e3fb7e1c9f91fe59b5702ce274034d87c6ce5aa..b332ac1fb654cff281fb547a0192f952fe3e8720 100644 |
| --- a/net/base/filename_util_unittest.cc |
| +++ b/net/base/filename_util_unittest.cc |
| @@ -239,6 +239,9 @@ TEST(FilenameUtilTest, FileURLConversion) { |
| {L"\\\\foo\\bar.txt", "file:/foo/bar.txt"}, |
| {L"\\\\foo\\bar.txt", "file://foo\\bar.txt"}, |
| {L"C:\\foo\\bar.txt", "file:\\\\\\c:/foo/bar.txt"}, |
| + // %2f ('/') and %5c ('\\') are left alone by both GURL and |
| + // FileURLToFilePath. |
| + {L"C:\\foo%2f..%5cbar", "file:///C:\\foo%2f..%5cbar"}, |
| #elif defined(OS_POSIX) |
| {L"/c:/foo/bar.txt", "file:/c:/foo/bar.txt"}, |
| {L"/c:/foo/bar.txt", "file:///c:/foo/bar.txt"}, |
| @@ -253,6 +256,9 @@ TEST(FilenameUtilTest, FileURLConversion) { |
| {L"/foo/bar.txt", "file:////foo////bar.txt"}, |
| {L"/c:/foo/bar.txt", "file:\\\\\\c:/foo/bar.txt"}, |
| {L"/c:/foo/bar.txt", "file:c:/foo/bar.txt"}, |
| + // %2f ('/') and %5c ('\\') are left alone by both GURL and |
| + // FileURLToFilePath. |
| + {L"/foo%2f..%5cbar", "file:///foo%2f..%5cbar"}, |
| // We get these wrong because GURL turns back slashes into forward |
| // slashes. |
| // {L"/foo%5Cbar.txt", "file://foo\\bar.txt"}, |
| @@ -785,6 +791,16 @@ TEST(FilenameUtilTest, GenerateFileName) { |
| "image/jpeg", |
| L"download", |
| L"download" JPEG_EXT}, |
| + {// Escaped slash, backslash, and leading periods in file name. The periods |
| + // should be removed, both slashes replaced with dashes. |
| + __LINE__, |
| + "http://www.google.com/..%2f%5atest.html", |
| + "", |
| + "", |
| + "", |
| + "", |
| + L"", |
| + L"--test.html"}, |
|
mmenke
2016/02/17 22:59:59
This isn't exactly related to the fix. There's an
|
| }; |
| // Tests filename generation. Once the correct filename is |