Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service_unittest.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/spellchecker/spellcheck_service.h" 5 #include "chrome/browser/spellchecker/spellcheck_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "components/user_prefs/user_prefs.h" 15 #include "components/user_prefs/user_prefs.h"
16 #include "content/public/test/test_browser_thread.h" 16 #include "content/public/test/test_browser_thread.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 struct SpellcheckLanguageTestCase { 19 struct SpellcheckLanguageTestCase {
20 SpellcheckLanguageTestCase(const std::string& accept_languages, 20 SpellcheckLanguageTestCase(const std::string& accept_languages,
21 const std::string& unsplit_spellcheck_dictionaries, 21 const std::string& unsplit_spellcheck_dictionaries,
22 size_t num_expected_enabled_spellcheck_languages, 22 size_t num_expected_enabled_spellcheck_languages,
23 const std::string& unsplit_expected_languages) 23 const std::string& unsplit_expected_languages)
24 : accept_languages(accept_languages), 24 : accept_languages(accept_languages),
25 num_expected_enabled_spellcheck_languages( 25 num_expected_enabled_spellcheck_languages(
26 num_expected_enabled_spellcheck_languages) { 26 num_expected_enabled_spellcheck_languages) {
27 base::SplitString(unsplit_spellcheck_dictionaries, ',', 27 spellcheck_dictionaries = base::SplitString(
28 &spellcheck_dictionaries); 28 unsplit_spellcheck_dictionaries, ",",
29 base::SplitString(unsplit_expected_languages, ',', 29 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
30 &expected_spellcheck_languages); 30 expected_spellcheck_languages = base::SplitString(
31 unsplit_expected_languages, ",",
32 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
31 } 33 }
32 ~SpellcheckLanguageTestCase() {} 34 ~SpellcheckLanguageTestCase() {}
33 35
34 std::string accept_languages; 36 std::string accept_languages;
35 std::vector<std::string> spellcheck_dictionaries; 37 std::vector<std::string> spellcheck_dictionaries;
36 size_t num_expected_enabled_spellcheck_languages; 38 size_t num_expected_enabled_spellcheck_languages;
37 std::vector<std::string> expected_spellcheck_languages; 39 std::vector<std::string> expected_spellcheck_languages;
38 }; 40 };
39 41
40 class SpellcheckServiceUnitTest 42 class SpellcheckServiceUnitTest
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 dictionaries.AppendStrings(GetParam().spellcheck_dictionaries); 95 dictionaries.AppendStrings(GetParam().spellcheck_dictionaries);
94 prefs()->Set(prefs::kSpellCheckDictionaries, dictionaries); 96 prefs()->Set(prefs::kSpellCheckDictionaries, dictionaries);
95 97
96 std::vector<std::string> spellcheck_languages; 98 std::vector<std::string> spellcheck_languages;
97 EXPECT_EQ(GetParam().num_expected_enabled_spellcheck_languages, 99 EXPECT_EQ(GetParam().num_expected_enabled_spellcheck_languages,
98 SpellcheckService::GetSpellCheckLanguages(context(), 100 SpellcheckService::GetSpellCheckLanguages(context(),
99 &spellcheck_languages)); 101 &spellcheck_languages));
100 102
101 EXPECT_EQ(GetParam().expected_spellcheck_languages, spellcheck_languages); 103 EXPECT_EQ(GetParam().expected_spellcheck_languages, spellcheck_languages);
102 } 104 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.cc ('k') | chrome/browser/ssl/ssl_error_classification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698