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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
9 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" | 9 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" |
10 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 10 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess( | 157 scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess( |
158 "init_valid_name_no_rtl.json")); | 158 "init_valid_name_no_rtl.json")); |
159 | 159 |
160 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); | 160 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); |
161 base::i18n::AdjustStringForLocaleDirection(&localized_name); | 161 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
162 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); | 162 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); |
163 | 163 |
164 // Strong RTL characters in name. | 164 // Strong RTL characters in name. |
165 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); | 165 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); |
166 | 166 |
167 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)"); | 167 localized_name = base::WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)"); |
168 base::i18n::AdjustStringForLocaleDirection(&localized_name); | 168 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
169 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); | 169 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); |
170 | 170 |
171 // Reset locale. | 171 // Reset locale. |
172 #if defined(TOOLKIT_GTK) | 172 #if defined(TOOLKIT_GTK) |
173 gtk_widget_set_default_direction(gtk_dir); | 173 gtk_widget_set_default_direction(gtk_dir); |
174 #else | 174 #else |
175 base::i18n::SetICUDefaultLocale(locale); | 175 base::i18n::SetICUDefaultLocale(locale); |
176 #endif | 176 #endif |
177 } | 177 } |
OLD | NEW |