diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 18:27:43 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 18:27:43 +0000 |
commit | 217bc8dd14a24d429dcad7a7b7bb0fa5e9d0404d (patch) | |
tree | e5be33bb7ca2265496492610dcd01af6e93c96e7 /chrome/browser/locale_tests_uitest.cc | |
parent | 7a97d29f07bebe8cc2ba52ec9dbeded128a95c21 (diff) | |
download | chromium_src-217bc8dd14a24d429dcad7a7b7bb0fa5e9d0404d.zip chromium_src-217bc8dd14a24d429dcad7a7b7bb0fa5e9d0404d.tar.gz chromium_src-217bc8dd14a24d429dcad7a7b7bb0fa5e9d0404d.tar.bz2 |
Only check --lang and the app language pref on Windows. They
don't make sense on Linux/Mac so disable them.
I think we don't want to have a app language option on Linux
since the standard way to do this is to use LANG or LC_ALL.
Update the locale ui test to set LC_ALL on Linux.
BUG=15359
Review URL: http://codereview.chromium.org/155819
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/locale_tests_uitest.cc')
-rw-r--r-- | chrome/browser/locale_tests_uitest.cc | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/chrome/browser/locale_tests_uitest.cc b/chrome/browser/locale_tests_uitest.cc index eaebe3c..808ecae 100644 --- a/chrome/browser/locale_tests_uitest.cc +++ b/chrome/browser/locale_tests_uitest.cc @@ -4,24 +4,61 @@ #include "chrome/test/ui/ui_test.h" -class LocaleTestsDa : public UITest { +#include "build/build_config.h" + +class LocaleTestsBase : public UITest { public: - LocaleTestsDa() : UITest() { + LocaleTestsBase() : UITest(), old_lc_all_(NULL) { + } + + protected: + void RestoreLcAllEnvironment() { +#if defined(OS_LINUX) + if (old_lc_all_) { + setenv("LC_ALL", old_lc_all_, 1); + } else { + unsetenv("LC_ALL"); + } +#endif + }; + + const char* old_lc_all_; +}; + + +class LocaleTestsDa : public LocaleTestsBase { + public: + LocaleTestsDa() : LocaleTestsBase() { launch_arguments_.AppendSwitchWithValue(L"lang", L"da"); + + // Linux doesn't use --lang, it only uses environment variables to set the + // language. +#if defined(OS_LINUX) + old_lc_all_ = getenv("LC_ALL"); + setenv("LC_ALL", "da_DK.UTF-8", 1); +#endif } }; -class LocaleTestsHe : public UITest { +class LocaleTestsHe : public LocaleTestsBase { public: - LocaleTestsHe() : UITest() { + LocaleTestsHe() : LocaleTestsBase() { launch_arguments_.AppendSwitchWithValue(L"lang", L"he"); +#if defined(OS_LINUX) + old_lc_all_ = getenv("LC_ALL"); + setenv("LC_ALL", "he_IL.UTF-8", 1); +#endif } }; -class LocaleTestsZhTw : public UITest { +class LocaleTestsZhTw : public LocaleTestsBase { public: - LocaleTestsZhTw() : UITest() { + LocaleTestsZhTw() : LocaleTestsBase() { launch_arguments_.AppendSwitchWithValue(L"lang", L"zh-TW"); +#if defined(OS_LINUX) + old_lc_all_ = getenv("LC_ALL"); + setenv("LC_ALL", "zh_TW.UTF-8", 1); +#endif } }; @@ -30,13 +67,16 @@ class LocaleTestsZhTw : public UITest { // See bug 9758. TEST_F(LocaleTestsDa, TestStart) { // Just making sure we can start/shutdown cleanly. + RestoreLcAllEnvironment(); } TEST_F(LocaleTestsHe, TestStart) { // Just making sure we can start/shutdown cleanly. + RestoreLcAllEnvironment(); } TEST_F(LocaleTestsZhTw, TestStart) { // Just making sure we can start/shutdown cleanly. + RestoreLcAllEnvironment(); } #endif |