Index: base/i18n/rtl_unittest.cc |
diff --git a/base/i18n/rtl_unittest.cc b/base/i18n/rtl_unittest.cc |
index ddaff1e4372026b44cff21ac00906fcb8fc19db3..a35539fa22575c85d4ea1b3ea4e2871b5c0cbc1d 100644 |
--- a/base/i18n/rtl_unittest.cc |
+++ b/base/i18n/rtl_unittest.cc |
@@ -19,6 +19,21 @@ namespace i18n { |
namespace { |
+class ScopedSetICUDefaultLocale { |
+ std::string default_locale; |
+ |
+ public: |
+ ScopedSetICUDefaultLocale(std::string locale); |
+ ~ScopedSetICUDefaultLocale(); |
+}; |
+ |
+ScopedSetICUDefaultLocale::ScopedSetICUDefaultLocale(std::string locale) |
+ : default_locale(locale) {} |
+ |
+ScopedSetICUDefaultLocale::~ScopedSetICUDefaultLocale() { |
+ i18n::SetICUDefaultLocale(default_locale.data()); |
+} |
+ |
// A test utility function to set the application default text direction. |
void SetRTL(bool rtl) { |
// Override the current locale/direction. |
@@ -305,6 +320,7 @@ TEST_F(RTLTest, WrapString) { |
const bool was_rtl = IsRTL(); |
+ ScopedSetICUDefaultLocale restore_object(uloc_getDefault()); |
for (size_t i = 0; i < 2; ++i) { |
// Toggle the application default text direction (to try each direction). |
SetRTL(!IsRTL()); |
@@ -352,6 +368,7 @@ TEST_F(RTLTest, GetDisplayStringInLTRDirectionality) { |
const bool was_rtl = IsRTL(); |
+ ScopedSetICUDefaultLocale restore_object(uloc_getDefault()); |
for (size_t i = 0; i < 2; ++i) { |
// Toggle the application default text direction (to try each direction). |
SetRTL(!IsRTL()); |
@@ -438,6 +455,7 @@ TEST_F(RTLTest, UnadjustStringForLocaleDirection) { |
const bool was_rtl = IsRTL(); |
+ ScopedSetICUDefaultLocale restore_object(uloc_getDefault()); |
for (size_t i = 0; i < 2; ++i) { |
// Toggle the application default text direction (to try each direction). |
SetRTL(!IsRTL()); |