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 browser()->profile()->GetPrefs()->SetString(setting_name, "fr,es,de,en"); |
35 base::ListValue dictionaries; | 36 base::ListValue dictionaries; |
36 dictionaries.AppendString("fr"); | 37 dictionaries.AppendString("fr"); |
37 SetDictionariesPref(dictionaries); | 38 SetDictionariesPref(dictionaries); |
38 browser()->profile()->GetPrefs()->SetString(prefs::kSpellCheckDictionary, | 39 browser()->profile()->GetPrefs()->SetString( |
Lei Zhang
2016/08/16 15:42:57
Maybe same the pointer from GetPrefs() on line 35
timvolodine
2016/08/16 18:19:15
Done.
| |
39 std::string()); | 40 spellcheck::prefs::kSpellCheckDictionary, std::string()); |
40 } | 41 } |
41 | 42 |
42 void MultilanguageOptionsBrowserTest::SetDictionariesPref( | 43 void MultilanguageOptionsBrowserTest::SetDictionariesPref( |
43 const base::ListValue& value) { | 44 const base::ListValue& value) { |
44 browser()->profile()->GetPrefs()->Set(prefs::kSpellCheckDictionaries, value); | 45 browser()->profile()->GetPrefs()->Set( |
46 spellcheck::prefs::kSpellCheckDictionaries, value); | |
45 } | 47 } |
OLD | NEW |