OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/i18n/rtl.h" | 5 #include "base/i18n/rtl.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
9 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 9 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
10 #include "chrome/common/extensions/manifest_url_handler.h" | 10 #include "chrome/common/extensions/manifest_url_handler.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | 146 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |
147 #else | 147 #else |
148 std::string locale = l10n_util::GetApplicationLocale(""); | 148 std::string locale = l10n_util::GetApplicationLocale(""); |
149 base::i18n::SetICUDefaultLocale("he"); | 149 base::i18n::SetICUDefaultLocale("he"); |
150 #endif | 150 #endif |
151 | 151 |
152 // No strong RTL characters in name. | 152 // No strong RTL characters in name. |
153 scoped_refptr<Extension> extension(LoadAndExpectSuccess( | 153 scoped_refptr<Extension> extension(LoadAndExpectSuccess( |
154 "init_valid_name_no_rtl.json")); | 154 "init_valid_name_no_rtl.json")); |
155 | 155 |
156 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); | 156 base::string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); |
157 base::i18n::AdjustStringForLocaleDirection(&localized_name); | 157 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
158 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); | 158 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); |
159 | 159 |
160 // Strong RTL characters in name. | 160 // Strong RTL characters in name. |
161 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); | 161 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); |
162 | 162 |
163 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)"); | 163 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)"); |
164 base::i18n::AdjustStringForLocaleDirection(&localized_name); | 164 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
165 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); | 165 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); |
166 | 166 |
167 // Reset locale. | 167 // Reset locale. |
168 #if defined(TOOLKIT_GTK) | 168 #if defined(TOOLKIT_GTK) |
169 gtk_widget_set_default_direction(gtk_dir); | 169 gtk_widget_set_default_direction(gtk_dir); |
170 #else | 170 #else |
171 base::i18n::SetICUDefaultLocale(locale); | 171 base::i18n::SetICUDefaultLocale(locale); |
172 #endif | 172 #endif |
173 } | 173 } |
174 | 174 |
175 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |