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

Unified Diff: base/file_util_unittest.cc

Issue 145026: Move PathComponents from file_util to FilePath, add FilePath::IsParent() (Closed)
Patch Set: noop 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_util.cc ('k') | chrome/browser/importer/ie_importer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_unittest.cc
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 738bac8d33139a068a84dd15bfbb846b728717fc..e510594d63207b3f5641765732a9948d7b26df2c 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1072,57 +1072,6 @@ TEST_F(FileUtilTest, FileEnumeratorOrderTest) {
EXPECT_EQ(FILE_PATH_LITERAL(""), cur_file.value());
}
-void PathComponents(const std::wstring& path,
- std::vector<std::wstring>* components) {
- DCHECK(components != NULL);
- if (components == NULL)
- return;
- std::wstring::size_type start = 0;
- std::wstring::size_type end = path.find('/', start);
-
- // Special case the "/" or "\" directory. On Windows with a drive letter,
- // this code path won't hit, but the right thing should still happen.
- // "E:\foo" will turn into "E:","foo".
- if (end == start) {
- components->push_back(std::wstring(path, 0, 1));
- start = end + 1;
- end = path.find('/', start);
- }
- while (end != std::wstring::npos) {
- std::wstring component = std::wstring(path, start, end - start);
- components->push_back(component);
- start = end + 1;
- end = path.find('/', start);
- }
- std::wstring component = std::wstring(path, start);
- components->push_back(component);
-}
-
-static const struct PathComponentsCase {
- const FilePath::CharType* path;
- const FilePath::CharType* result;
-} kPathComponents[] = {
- {FILE_PATH_LITERAL("/foo/bar/baz/"), FILE_PATH_LITERAL("/|foo|bar|baz|")},
- {FILE_PATH_LITERAL("/foo/bar/baz"), FILE_PATH_LITERAL("/|foo|bar|baz")},
- {FILE_PATH_LITERAL("e:/foo"), FILE_PATH_LITERAL("e:|foo")},
-};
-
-TEST_F(FileUtilTest, PathComponentsTest) {
- for (size_t i = 0; i < arraysize(kPathComponents); ++i) {
- FilePath path(kPathComponents[i].path);
- std::vector<FilePath::StringType> comps;
- file_util::PathComponents(path, &comps);
-
- FilePath::StringType result;
- for (size_t j = 0; j < comps.size(); ++j) {
- result.append(comps[j]);
- if (j < comps.size() - 1)
- result.append(FILE_PATH_LITERAL("|"), 1);
- }
- EXPECT_EQ(kPathComponents[i].result, result);
- }
-}
-
TEST_F(FileUtilTest, Contains) {
FilePath data_dir = test_dir_.Append(FILE_PATH_LITERAL("FilePathTest"));
« no previous file with comments | « base/file_util.cc ('k') | chrome/browser/importer/ie_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698