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

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

Issue 1937203002: Fixed hasty language selection in GetCorrespondingSpellCheckLanguage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added another unit test Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/common/spellcheck_common.cc » ('j') | chrome/common/spellcheck_common.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <ostream> 7 #include <ostream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 base::MessageLoop message_loop_; 105 base::MessageLoop message_loop_;
106 content::TestBrowserThread ui_thread_; 106 content::TestBrowserThread ui_thread_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(SpellcheckServiceUnitTest); 108 DISALLOW_COPY_AND_ASSIGN(SpellcheckServiceUnitTest);
109 }; 109 };
110 110
111 INSTANTIATE_TEST_CASE_P( 111 INSTANTIATE_TEST_CASE_P(
112 TestCases, 112 TestCases,
113 SpellcheckServiceUnitTest, 113 SpellcheckServiceUnitTest,
114 testing::Values( 114 testing::Values(
115 TestCase("en,aa", "aa", "", ""),
115 TestCase("en,en-JP,fr,aa", "fr", "fr", "fr"), 116 TestCase("en,en-JP,fr,aa", "fr", "fr", "fr"),
116 TestCase("en,en-JP,fr,zz,en-US", "fr", "fr,en-US", "fr"), 117 TestCase("en,en-JP,fr,zz,en-US", "fr", "fr,en-US", "fr"),
118 TestCase("en,en-US,en-GB", "en-GB", "en-US,en-GB", "en-GB"),
117 TestCase("en,en-US,en-AU", "en-AU", "en-US,en-AU", "en-AU"), 119 TestCase("en,en-US,en-AU", "en-AU", "en-US,en-AU", "en-AU"),
118 TestCase("en,en-US,en-AU", "en-US", "en-US,en-AU", "en-US"), 120 TestCase("en,en-US,en-AU", "en-US", "en-US,en-AU", "en-US"),
119 TestCase("en,en-US", "en-US", "en-US", "en-US"), 121 TestCase("en,en-US", "en-US", "en-US", "en-US"),
120 TestCase("en,en-US,fr", "en-US", "en-US,fr", "en-US"), 122 TestCase("en,en-US,fr", "en-US", "en-US,fr", "en-US"),
121 TestCase("en,fr,en-US,en-AU", "en-US,fr", "fr,en-US,en-AU", "fr,en-US"), 123 TestCase("en,fr,en-US,en-AU", "en-US,fr", "fr,en-US,en-AU", "fr,en-US"),
122 TestCase("en-US,en", "en-US", "en-US", "en-US"), 124 TestCase("en-US,en", "en-US", "en-US", "en-US"),
123 TestCase("hu-HU,hr-HR", "hr", "hu,hr", "hr"))); 125 TestCase("hu-HU,hr-HR", "hr", "hu,hr", "hr")));
124 126
125 TEST_P(SpellcheckServiceUnitTest, GetDictionaries) { 127 TEST_P(SpellcheckServiceUnitTest, GetDictionaries) {
126 prefs()->SetString(prefs::kAcceptLanguages, GetParam().accept_languages); 128 prefs()->SetString(prefs::kAcceptLanguages, GetParam().accept_languages);
127 base::ListValue spellcheck_dictionaries; 129 base::ListValue spellcheck_dictionaries;
128 spellcheck_dictionaries.AppendStrings(GetParam().spellcheck_dictionaries); 130 spellcheck_dictionaries.AppendStrings(GetParam().spellcheck_dictionaries);
129 prefs()->Set(prefs::kSpellCheckDictionaries, spellcheck_dictionaries); 131 prefs()->Set(prefs::kSpellCheckDictionaries, spellcheck_dictionaries);
130 132
131 std::vector<SpellcheckService::Dictionary> dictionaries; 133 std::vector<SpellcheckService::Dictionary> dictionaries;
132 SpellcheckService::GetDictionaries(context(), &dictionaries); 134 SpellcheckService::GetDictionaries(context(), &dictionaries);
133 135
134 EXPECT_EQ(GetParam().expected_dictionaries, dictionaries); 136 EXPECT_EQ(GetParam().expected_dictionaries, dictionaries);
135 } 137 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/spellcheck_common.cc » ('j') | chrome/common/spellcheck_common.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698