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

Unified Diff: base/file_path_unittest.cc

Issue 147017: Allow extension extensions to be case-insensitive. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_path.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_path_unittest.cc
===================================================================
--- base/file_path_unittest.cc (revision 19502)
+++ base/file_path_unittest.cc (working copy)
@@ -634,3 +634,34 @@
", path: " << path.value() << ", replace: " << cases[i].inputs[1];
}
}
+
+TEST_F(FilePathTest, MatchesExtension) {
+ const struct BinaryBooleanTestData cases[] = {
+ { { FPL("foo"), FPL("") }, true},
+ { { FPL("foo"), FPL(".") }, false},
+ { { FPL("foo."), FPL("") }, false},
+ { { FPL("foo."), FPL(".") }, true},
+ { { FPL("foo.txt"), FPL(".dll") }, false},
+ { { FPL("foo.txt"), FPL(".txt") }, true},
+ { { FPL("foo.txt.dll"), FPL(".txt") }, false},
+ { { FPL("foo.txt.dll"), FPL(".dll") }, true},
+#if defined(FILE_PATH_USES_DRIVE_LETTERS)
+ { { FPL("c:/foo.txt.dll"), FPL(".txt") }, false},
+ { { FPL("c:/foo.txt"), FPL(".txt") }, true},
+#endif // FILE_PATH_USES_DRIVE_LETTERS
+#if defined(FILE_PATH_USES_WIN_SEPARATORS)
+ { { FPL("c:\\bar\\foo.txt.dll"), FPL(".txt") }, false},
+ { { FPL("c:\\bar\\foo.txt"), FPL(".txt") }, true},
+#endif // FILE_PATH_USES_DRIVE_LETTERS
+ { { FPL("/bar/foo.txt.dll"), FPL(".txt") }, false},
+ { { FPL("/bar/foo.txt"), FPL(".txt") }, true},
+ };
+
+ for (size_t i = 0; i < arraysize(cases); ++i) {
+ FilePath path(cases[i].inputs[0]);
+ FilePath::StringType ext(cases[i].inputs[1]);
+
+ EXPECT_EQ(cases[i].expected, path.MatchesExtension(ext)) <<
+ "i: " << i << ", path: " << path.value() << ", ext: " << ext;
+ }
+}
« no previous file with comments | « base/file_path.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698