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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/extension_service_test_base.h" | 10 #include "chrome/browser/extensions/extension_service_test_base.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 void SetApplicationLocale(Profile* profile, const std::string& new_locale) { | 87 void SetApplicationLocale(Profile* profile, const std::string& new_locale) { |
88 #if defined(OS_CHROMEOS) | 88 #if defined(OS_CHROMEOS) |
89 // On ChromeOS locale is per-profile. | 89 // On ChromeOS locale is per-profile. |
90 profile->GetPrefs()->SetString(prefs::kApplicationLocale, new_locale); | 90 profile->GetPrefs()->SetString(prefs::kApplicationLocale, new_locale); |
91 #else | 91 #else |
92 g_browser_process->SetApplicationLocale(new_locale); | 92 g_browser_process->SetApplicationLocale(new_locale); |
93 #endif | 93 #endif |
94 } | 94 } |
95 | 95 |
96 virtual void SetUp() { | 96 void SetUp() override { |
97 extension_id_ = GetParam(); | 97 extension_id_ = GetParam(); |
98 if (extension_id_ == extension_misc::kHotwordSharedModuleId) { | 98 if (extension_id_ == extension_misc::kHotwordSharedModuleId) { |
99 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 99 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
100 switches::kEnableExperimentalHotwording); | 100 switches::kEnableExperimentalHotwording); |
101 } | 101 } |
102 | 102 |
103 extensions::ExtensionServiceTestBase::SetUp(); | 103 extensions::ExtensionServiceTestBase::SetUp(); |
104 } | 104 } |
105 | 105 |
106 base::FieldTrialList field_trial_list_; | 106 base::FieldTrialList field_trial_list_; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 EXPECT_EQ("fr_fr", | 335 EXPECT_EQ("fr_fr", |
336 profile()->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage)); | 336 profile()->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage)); |
337 | 337 |
338 // If the locale is set back to the last valid one, then an uninstall-install | 338 // If the locale is set back to the last valid one, then an uninstall-install |
339 // shouldn't be needed. | 339 // shouldn't be needed. |
340 SetApplicationLocale(profile(), "fr_fr"); | 340 SetApplicationLocale(profile(), "fr_fr"); |
341 EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile())); | 341 EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile())); |
342 EXPECT_FALSE(hotword_service->MaybeReinstallHotwordExtension()); | 342 EXPECT_FALSE(hotword_service->MaybeReinstallHotwordExtension()); |
343 EXPECT_EQ(1, hotword_service->uninstall_count()); // no change | 343 EXPECT_EQ(1, hotword_service->uninstall_count()); // no change |
344 } | 344 } |
OLD | NEW |