OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 #include "chrome/browser/chromeos/base/locale_util.h" | 10 #include "chrome/browser/chromeos/base/locale_util.h" |
11 #include "chrome/browser/chromeos/customization/customization_document.h" | 11 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chromeos/system/fake_statistics_provider.h" | 15 #include "chromeos/system/fake_statistics_provider.h" |
15 #include "chromeos/system/statistics_provider.h" | 16 #include "chromeos/system/statistics_provider.h" |
16 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 | 20 |
20 using chromeos::locale_util::SwitchLanguageCallback; | 21 using chromeos::locale_util::SwitchLanguageCallback; |
21 using chromeos::locale_util::LanguageSwitchResult; | 22 using chromeos::locale_util::LanguageSwitchResult; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 }; | 177 }; |
177 | 178 |
178 } // anonymous namespace | 179 } // anonymous namespace |
179 | 180 |
180 typedef InProcessBrowserTest CustomizationLocaleTest; | 181 typedef InProcessBrowserTest CustomizationLocaleTest; |
181 | 182 |
182 IN_PROC_BROWSER_TEST_F(CustomizationLocaleTest, CheckAvailableLocales) { | 183 IN_PROC_BROWSER_TEST_F(CustomizationLocaleTest, CheckAvailableLocales) { |
183 for (size_t i = 0; i < languages_available.size(); ++i) { | 184 for (size_t i = 0; i < languages_available.size(); ++i) { |
184 LanguageSwitchedWaiter waiter(base::Bind(&VerifyLanguageSwitched)); | 185 LanguageSwitchedWaiter waiter(base::Bind(&VerifyLanguageSwitched)); |
185 locale_util::SwitchLanguage(languages_available[i], true, true, | 186 locale_util::SwitchLanguage(languages_available[i], true, true, |
186 waiter.Callback()); | 187 waiter.Callback(), |
| 188 ProfileManager::GetActiveUserProfile()); |
187 waiter.Wait(); | 189 waiter.Wait(); |
188 { | 190 { |
189 std::string resolved_locale; | 191 std::string resolved_locale; |
190 base::ThreadRestrictions::ScopedAllowIO allow_io; | 192 base::ThreadRestrictions::ScopedAllowIO allow_io; |
191 l10n_util::CheckAndResolveLocale(languages_available[i], | 193 l10n_util::CheckAndResolveLocale(languages_available[i], |
192 &resolved_locale); | 194 &resolved_locale); |
193 EXPECT_EQ(GetExpectedLanguage(languages_available[i]), resolved_locale) | 195 EXPECT_EQ(GetExpectedLanguage(languages_available[i]), resolved_locale) |
194 << "CheckAndResolveLocale() failed for language='" | 196 << "CheckAndResolveLocale() failed for language='" |
195 << languages_available[i] << "'"; | 197 << languages_available[i] << "'"; |
196 } | 198 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 break; | 248 break; |
247 } | 249 } |
248 } | 250 } |
249 } | 251 } |
250 | 252 |
251 INSTANTIATE_TEST_CASE_P(StringSequence, | 253 INSTANTIATE_TEST_CASE_P(StringSequence, |
252 CustomizationVPDTest, | 254 CustomizationVPDTest, |
253 testing::ValuesIn(kVPDInitialLocales)); | 255 testing::ValuesIn(kVPDInitialLocales)); |
254 | 256 |
255 } // namespace chromeos | 257 } // namespace chromeos |
OLD | NEW |