diff options
-rw-r--r-- | app/l10n_util_unittest.cc | 4 | ||||
-rw-r--r-- | base/file_util_unittest.cc | 30 | ||||
-rw-r--r-- | chrome/browser/privacy_blacklist/blacklist_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/test/selenium/selenium_test.cc | 20 | ||||
-rw-r--r-- | chrome/test/unit/chrome_test_suite.h | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 6 |
6 files changed, 33 insertions, 37 deletions
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc index d763484..db7d342 100644 --- a/app/l10n_util_unittest.cc +++ b/app/l10n_util_unittest.cc @@ -106,7 +106,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { EXPECT_TRUE(file_util::CreateNewTempDirectory( FILE_PATH_LITERAL("l10n_util_test"), &new_locale_dir)); - PathService::Override(app::DIR_LOCALES, new_locale_dir.ToWStringHack()); + PathService::Override(app::DIR_LOCALES, new_locale_dir); // Make fake locale files. std::string filenames[] = { "en-US", @@ -210,7 +210,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { #endif // defined(OS_WIN) // Clean up. - PathService::Override(app::DIR_LOCALES, orig_locale_dir.ToWStringHack()); + PathService::Override(app::DIR_LOCALES, orig_locale_dir); file_util::Delete(new_locale_dir, true); UErrorCode error_code = U_ZERO_ERROR; icu::Locale::setDefault(locale, error_code); 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)); } diff --git a/chrome/browser/privacy_blacklist/blacklist_unittest.cc b/chrome/browser/privacy_blacklist/blacklist_unittest.cc index f7648b5..f979aaf 100644 --- a/chrome/browser/privacy_blacklist/blacklist_unittest.cc +++ b/chrome/browser/privacy_blacklist/blacklist_unittest.cc @@ -13,12 +13,11 @@ TEST(BlacklistTest, Generic) { // Get path relative to test data dir. - std::wstring input; + FilePath input; PathService::Get(chrome::DIR_TEST_DATA, &input); - file_util::AppendToPath(&input, L"blacklist_small.pbr"); + input = input.AppendASCII("blacklist_small.pbr"); - FilePath path = FilePath::FromWStringHack(input); - Blacklist blacklist(path); + Blacklist blacklist(input); // This test is a friend, so inspect the internal structures. EXPECT_EQ(5U, blacklist.blacklist_.size()); diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc index f2ef32d..f5710f7 100644 --- a/chrome/test/selenium/selenium_test.cc +++ b/chrome/test/selenium/selenium_test.cc @@ -92,17 +92,17 @@ class SeleniumTest : public UITest { }; *failed = kBogusFailures[base::RandInt(0, 2)]; #else - std::wstring test_path; + FilePath test_path; PathService::Get(chrome::DIR_TEST_DATA, &test_path); - file_util::UpOneDirectory(&test_path); - file_util::UpOneDirectory(&test_path); - file_util::UpOneDirectory(&test_path); - file_util::AppendToPath(&test_path, L"data"); - file_util::AppendToPath(&test_path, L"selenium_core"); - file_util::AppendToPath(&test_path, L"core"); - file_util::AppendToPath(&test_path, L"TestRunner.html"); - - GURL test_url(net::FilePathToFileURL(FilePath::FromWStringHack(test_path))); + test_path = test_path.DirName(); + test_path = test_path.DirName(); + test_path = test_path.DirName(); + test_path = test_path.AppendASCII("data"); + test_path = test_path.AppendASCII("selenium_core"); + test_path = test_path.AppendASCII("core"); + test_path = test_path.AppendASCII("TestRunner.html"); + + GURL test_url(net::FilePathToFileURL(test_path)); scoped_refptr<TabProxy> tab(GetActiveTab()); tab->NavigateToURL(test_url); diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index 7f8733b..536ff37 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -93,8 +93,7 @@ class ChromeTestSuite : public TestSuite { user_data_dir = user_data_dir.AppendASCII("test_user_data"); } if (!user_data_dir.empty()) - PathService::Override(chrome::DIR_USER_DATA, - user_data_dir.ToWStringHack()); + PathService::Override(chrome::DIR_USER_DATA, user_data_dir); #if defined(OS_MACOSX) FilePath path; diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index 8a463a1..611405a 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -705,8 +705,7 @@ StringPiece GetDataResource(int resource_id) { if (broken_image_data.empty()) { FilePath path = GetResourcesFilePath(); path = path.AppendASCII("missingImage.gif"); - bool success = file_util::ReadFileToString(path.ToWStringHack(), - &broken_image_data); + bool success = file_util::ReadFileToString(path, &broken_image_data); if (!success) { LOG(FATAL) << "Failed reading: " << path.value(); } @@ -725,8 +724,7 @@ StringPiece GetDataResource(int resource_id) { if (resize_corner_data.empty()) { FilePath path = GetResourcesFilePath(); path = path.AppendASCII("textAreaResizeCorner.png"); - bool success = file_util::ReadFileToString(path.ToWStringHack(), - &resize_corner_data); + bool success = file_util::ReadFileToString(path, &resize_corner_data); if (!success) { LOG(FATAL) << "Failed reading: " << path.value(); } |