diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 21:28:30 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 21:28:30 +0000 |
commit | 0e4f68db63e565201a6eaa2f600441c37b150d1b (patch) | |
tree | b4cfc4f35e6d8ae7fa6266fd2c3faaed9e006adb /base/file_util_unittest.cc | |
parent | a86c97ccfe0038b1672d5a06d283561b7f294640 (diff) | |
download | chromium_src-0e4f68db63e565201a6eaa2f600441c37b150d1b.zip chromium_src-0e4f68db63e565201a6eaa2f600441c37b150d1b.tar.gz chromium_src-0e4f68db63e565201a6eaa2f600441c37b150d1b.tar.bz2 |
Move PathComponents from file_util to FilePath, add FilePath::IsParent()
r=erikkay,mark
Review URL: http://codereview.chromium.org/145026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19174 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_unittest.cc')
-rw-r--r-- | base/file_util_unittest.cc | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 738bac8..e510594 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")); |