diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-02 00:56:57 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-02 00:56:57 +0000 |
commit | 4b68e0d50c4a69b91a384b698a96f6a51ca7241f (patch) | |
tree | a11dc1b6baf8d2e1d1c3d8b7930fb9ca0cec46eb /chrome/common | |
parent | 82d10b14f9b4150ce1e154629dec9dcddadcf272 (diff) | |
download | chromium_src-4b68e0d50c4a69b91a384b698a96f6a51ca7241f.zip chromium_src-4b68e0d50c4a69b91a384b698a96f6a51ca7241f.tar.gz chromium_src-4b68e0d50c4a69b91a384b698a96f6a51ca7241f.tar.bz2 |
Yet more deprecation of the wstring version of PathService::Get() for UI tests.
Review URL: http://codereview.chromium.org/99298
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/l10n_util.cc | 16 | ||||
-rw-r--r-- | chrome/common/l10n_util_unittest.cc | 46 | ||||
-rw-r--r-- | chrome/common/pref_service_uitest.cc | 3 |
3 files changed, 33 insertions, 32 deletions
diff --git a/chrome/common/l10n_util.cc b/chrome/common/l10n_util.cc index 2b47e5f..1039a1d 100644 --- a/chrome/common/l10n_util.cc +++ b/chrome/common/l10n_util.cc @@ -7,7 +7,6 @@ #include "chrome/common/l10n_util.h" #include "base/command_line.h" -#include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/scoped_ptr.h" @@ -229,7 +228,7 @@ std::wstring GetApplicationLocale(const std::wstring& pref_locale) { // TODO(pinkerton): break this out into a .mm and ask Cocoa. return L"en"; #else - std::wstring locale_path; + FilePath locale_path; PathService::Get(chrome::DIR_LOCALES, &locale_path); std::wstring resolved_locale; @@ -238,24 +237,27 @@ std::wstring GetApplicationLocale(const std::wstring& pref_locale) { const std::wstring& lang_arg = parsed_command_line.GetSwitchValue(switches::kLang); if (!lang_arg.empty()) { - if (CheckAndResolveLocale(lang_arg, locale_path, &resolved_locale)) + if (CheckAndResolveLocale(lang_arg, locale_path.ToWStringHack(), + &resolved_locale)) return resolved_locale; } // Second, try user prefs. if (!pref_locale.empty()) { - if (CheckAndResolveLocale(pref_locale, locale_path, &resolved_locale)) + if (CheckAndResolveLocale(pref_locale, locale_path.ToWStringHack(), + &resolved_locale)) return resolved_locale; } // Next, try the system locale. const std::wstring system_locale = GetSystemLocale(); - if (CheckAndResolveLocale(system_locale, locale_path, &resolved_locale)) + if (CheckAndResolveLocale(system_locale, locale_path.ToWStringHack(), + &resolved_locale)) return resolved_locale; // Fallback on en-US. const std::wstring fallback_locale(L"en-US"); - if (IsLocaleAvailable(fallback_locale, locale_path)) + if (IsLocaleAvailable(fallback_locale, locale_path.ToWStringHack())) return fallback_locale; // No locale data file was found; we shouldn't get here. @@ -479,7 +481,7 @@ TextDirection GetTextDirection() { } TextDirection GetTextDirectionForLocale(const char* locale_name) { - UScriptCode scripts[10]; // 10 scripts should be enough for any locale. + UScriptCode scripts[10]; // 10 scripts should be enough for any locale. UErrorCode error = U_ZERO_ERROR; int n = uscript_getCode(locale_name, scripts, 10, &error); DCHECK(U_SUCCESS(error) && n > 0); diff --git a/chrome/common/l10n_util_unittest.cc b/chrome/common/l10n_util_unittest.cc index c7ade0f..668e88c 100644 --- a/chrome/common/l10n_util_unittest.cc +++ b/chrome/common/l10n_util_unittest.cc @@ -99,36 +99,36 @@ void SetICUDefaultLocale(const std::wstring& locale_string) { TEST_F(L10nUtilTest, GetAppLocale) { // Use a temporary locale dir so we don't have to actually build the locale // dlls for this test. - std::wstring orig_locale_dir; + FilePath orig_locale_dir; PathService::Get(chrome::DIR_LOCALES, &orig_locale_dir); - std::wstring new_locale_dir; - EXPECT_TRUE(file_util::CreateNewTempDirectory(L"l10n_util_test", - &new_locale_dir)); - PathService::Override(chrome::DIR_LOCALES, new_locale_dir); + FilePath new_locale_dir; + EXPECT_TRUE(file_util::CreateNewTempDirectory( + FILE_PATH_LITERAL("l10n_util_test"), + &new_locale_dir)); + PathService::Override(chrome::DIR_LOCALES, new_locale_dir.ToWStringHack()); // Make fake locale files. - const wchar_t* filenames[] = { - L"en-US", - L"en-GB", - L"fr", - L"es-419", - L"es", - L"zh-TW", - L"zh-CN", - L"he", - L"fil", - L"nb", - L"or", + std::string filenames[] = { + "en-US", + "en-GB", + "fr", + "es-419", + "es", + "zh-TW", + "zh-CN", + "he", + "fil", + "nb", + "or", }; #if defined(OS_WIN) - static const wchar_t kLocaleFileExtension[] = L".dll"; + static const char kLocaleFileExtension[] = ".dll"; #elif defined(OS_POSIX) - static const wchar_t kLocaleFileExtension[] = L".pak"; + static const char kLocaleFileExtension[] = ".pak"; #endif for (size_t i = 0; i < arraysize(filenames); ++i) { - std::wstring filename = new_locale_dir; - file_util::AppendToPath(&filename, filenames[i]); - filename += kLocaleFileExtension; + FilePath filename = new_locale_dir.AppendASCII( + filenames[i] + kLocaleFileExtension); file_util::WriteFile(filename, "", 0); } @@ -204,7 +204,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { #endif // Clean up. - PathService::Override(chrome::DIR_LOCALES, orig_locale_dir); + PathService::Override(chrome::DIR_LOCALES, orig_locale_dir.ToWStringHack()); file_util::Delete(new_locale_dir, true); UErrorCode error_code = U_ZERO_ERROR; Locale::setDefault(locale, error_code); diff --git a/chrome/common/pref_service_uitest.cc b/chrome/common/pref_service_uitest.cc index e5da154..6e2ab7f 100644 --- a/chrome/common/pref_service_uitest.cc +++ b/chrome/common/pref_service_uitest.cc @@ -5,7 +5,6 @@ #include <string> #include "base/command_line.h" -#include "base/file_path.h" #include "base/file_util.h" #include "base/values.h" #include "build/build_config.h" @@ -28,7 +27,7 @@ public: file_util::CreateDirectory(tmp_profile_); FilePath reference_pref_file = - FilePath::FromWStringHack(test_data_directory_) + test_data_directory_ .AppendASCII("profiles") .AppendASCII("window_placement") .Append(chrome::kLocalStateFilename); |