summaryrefslogtreecommitdiffstats
path: root/base/file_util_unittest.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 20:00:14 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 20:00:14 +0000
commit53c5804ed27befcf9305e0963bf5318221209ca3 (patch)
tree7c8a558cb152e6d6f821cd927951f13f5451f531 /base/file_util_unittest.cc
parent6f6f21ab8e11c252affd2dc3d1b4c1975cb18b15 (diff)
downloadchromium_src-53c5804ed27befcf9305e0963bf5318221209ca3.zip
chromium_src-53c5804ed27befcf9305e0963bf5318221209ca3.tar.gz
chromium_src-53c5804ed27befcf9305e0963bf5318221209ca3.tar.bz2
Avoids the use of ToWStringHack in a few places.
BUG=None TEST=run app_unittests.exe, browser_tests.exe and selenium_tests.exe Review URL: http://codereview.chromium.org/173418 Patch from Thiago Farina <thiago.farina@gmail.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_unittest.cc')
-rw-r--r--base/file_util_unittest.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index cf9dda1..57190c5 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -64,7 +64,7 @@ class FileUtilTest : public PlatformTest {
// interface to query whether a given file is present.
class FindResultCollector {
public:
- FindResultCollector(file_util::FileEnumerator& enumerator) {
+ explicit FindResultCollector(file_util::FileEnumerator& enumerator) {
FilePath cur_file;
while (!(cur_file = enumerator.Next()).value().empty()) {
FilePath::StringType path = cur_file.value();
@@ -306,7 +306,7 @@ static const struct dir_case {
{L"/foo/bar./", L"/foo/bar."},
{L"/", L"/"},
{L".", L"."},
- {L"..", L"."}, // yes, ".." technically lives in "."
+ {L"..", L"."}, // yes, ".." technically lives in "."
#endif
};
@@ -524,23 +524,22 @@ TEST_F(FileUtilTest, CopyFile) {
ASSERT_TRUE(file_util::CopyFile(file_name_from, dest_file));
// Copy the file to another location using '..' in the path.
- std::wstring dest_file2(dir_name_from.ToWStringHack());
- file_util::AppendToPath(&dest_file2, L"..");
- file_util::AppendToPath(&dest_file2, L"DestFile.txt");
- ASSERT_TRUE(file_util::CopyFile(file_name_from,
- FilePath::FromWStringHack(dest_file2)));
- std::wstring dest_file2_test(dir_name_from.ToWStringHack());
- file_util::UpOneDirectory(&dest_file2_test);
- file_util::AppendToPath(&dest_file2_test, L"DestFile.txt");
+ FilePath dest_file2(dir_name_from);
+ dest_file2 = dest_file2.AppendASCII("..");
+ dest_file2 = dest_file2.AppendASCII("DestFile.txt");
+ ASSERT_TRUE(file_util::CopyFile(file_name_from, dest_file2));
+
+ FilePath dest_file2_test(dir_name_from);
+ dest_file2_test = dest_file2_test.DirName();
+ dest_file2_test = dest_file2_test.AppendASCII("DestFile.txt");
// Check everything has been copied.
EXPECT_TRUE(file_util::PathExists(file_name_from));
EXPECT_TRUE(file_util::PathExists(dest_file));
const std::wstring read_contents = ReadTextFile(dest_file);
EXPECT_EQ(file_contents, read_contents);
- EXPECT_TRUE(file_util::PathExists(
- FilePath::FromWStringHack(dest_file2_test)));
- EXPECT_TRUE(file_util::PathExists(FilePath::FromWStringHack(dest_file2)));
+ EXPECT_TRUE(file_util::PathExists(dest_file2_test));
+ EXPECT_TRUE(file_util::PathExists(dest_file2));
}
// TODO(erikkay): implement
@@ -814,8 +813,9 @@ TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) {
}
TEST_F(FileUtilTest, CreateNewTempDirectoryTest) {
- std::wstring temp_dir;
- ASSERT_TRUE(file_util::CreateNewTempDirectory(std::wstring(), &temp_dir));
+ FilePath temp_dir;
+ ASSERT_TRUE(file_util::CreateNewTempDirectory(FilePath::StringType(),
+ &temp_dir));
EXPECT_TRUE(file_util::PathExists(temp_dir));
EXPECT_TRUE(file_util::Delete(temp_dir, false));
}