| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/webui/options/multilanguage_options_browsertest.h" | 5 #include "chrome/browser/ui/webui/options/multilanguage_options_browsertest.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 15 #include "components/spellcheck/browser/pref_names.h" |
| 15 | 16 |
| 16 MultilanguageOptionsBrowserTest::MultilanguageOptionsBrowserTest() { | 17 MultilanguageOptionsBrowserTest::MultilanguageOptionsBrowserTest() { |
| 17 } | 18 } |
| 18 | 19 |
| 19 MultilanguageOptionsBrowserTest::~MultilanguageOptionsBrowserTest() { | 20 MultilanguageOptionsBrowserTest::~MultilanguageOptionsBrowserTest() { |
| 20 } | 21 } |
| 21 | 22 |
| 22 void MultilanguageOptionsBrowserTest::ClearSpellcheckDictionaries() { | 23 void MultilanguageOptionsBrowserTest::ClearSpellcheckDictionaries() { |
| 23 SetDictionariesPref(base::ListValue()); | 24 SetDictionariesPref(base::ListValue()); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void MultilanguageOptionsBrowserTest::SetUpOnMainThread() { | 27 void MultilanguageOptionsBrowserTest::SetUpOnMainThread() { |
| 27 WebUIBrowserTest::SetUpOnMainThread(); | 28 WebUIBrowserTest::SetUpOnMainThread(); |
| 28 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 29 std::string setting_name = prefs::kLanguagePreferredLanguages; | 30 std::string setting_name = prefs::kLanguagePreferredLanguages; |
| 30 #else | 31 #else |
| 31 std::string setting_name = prefs::kAcceptLanguages; | 32 std::string setting_name = prefs::kAcceptLanguages; |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 browser()->profile()->GetPrefs()->SetString(setting_name, "fr,es,de,en"); | 35 PrefService* pref_service = browser()->profile()->GetPrefs(); |
| 36 pref_service->SetString(setting_name, "fr,es,de,en"); |
| 35 base::ListValue dictionaries; | 37 base::ListValue dictionaries; |
| 36 dictionaries.AppendString("fr"); | 38 dictionaries.AppendString("fr"); |
| 37 SetDictionariesPref(dictionaries); | 39 SetDictionariesPref(dictionaries); |
| 38 browser()->profile()->GetPrefs()->SetString(prefs::kSpellCheckDictionary, | 40 pref_service->SetString(spellcheck::prefs::kSpellCheckDictionary, |
| 39 std::string()); | 41 std::string()); |
| 40 } | 42 } |
| 41 | 43 |
| 42 void MultilanguageOptionsBrowserTest::SetDictionariesPref( | 44 void MultilanguageOptionsBrowserTest::SetDictionariesPref( |
| 43 const base::ListValue& value) { | 45 const base::ListValue& value) { |
| 44 browser()->profile()->GetPrefs()->Set(prefs::kSpellCheckDictionaries, value); | 46 browser()->profile()->GetPrefs()->Set( |
| 47 spellcheck::prefs::kSpellCheckDictionaries, value); |
| 45 } | 48 } |
| OLD | NEW |