summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--chrome/common/spellcheck_common.cc4
-rw-r--r--chrome/renderer/spellchecker/spellcheck_unittest.cc61
3 files changed, 64 insertions, 3 deletions
diff --git a/DEPS b/DEPS
index 34f63f7..6ca96d0 100644
--- a/DEPS
+++ b/DEPS
@@ -85,7 +85,7 @@ deps = {
"/trunk/deps/third_party/hunspell@149334",
"src/third_party/hunspell_dictionaries":
- "/trunk/deps/third_party/hunspell_dictionaries@164817",
+ "/trunk/deps/third_party/hunspell_dictionaries@168258",
"src/third_party/safe_browsing/testing":
(Var("googlecode_url") % "google-safe-browsing") + "/trunk/testing@112",
diff --git a/chrome/common/spellcheck_common.cc b/chrome/common/spellcheck_common.cc
index d25e07a5..767df7a 100644
--- a/chrome/common/spellcheck_common.cc
+++ b/chrome/common/spellcheck_common.cc
@@ -111,8 +111,8 @@ FilePath GetVersionedFileName(const std::string& input_language,
{"fo-FO", "-2-3"}, // 2-3 (May 2012): added a dictionary.
{"en-US", "-2-4"}, // 2-4 (October 2012): add more words.
{"en-CA", "-2-4"},
- {"en-GB", "-2-4"},
- {"en-AU", "-2-4"},
+ {"en-GB", "-2-5"}, // 2-5 (Nov 2012): Added NOSUGGEST flag = !.
+ {"en-AU", "-2-5"}, // Marked 1 word in each.
};
diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc
index 7f2c1b0..c6b6f60 100644
--- a/chrome/renderer/spellchecker/spellcheck_unittest.cc
+++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc
@@ -1141,4 +1141,65 @@ TEST_F(SpellCheckTest, EnglishWords) {
}
}
+// Checks that NOSUGGEST works in English dictionaries.
+TEST_F(SpellCheckTest, NoSuggest) {
+ static const struct {
+ const char* input;
+ bool should_pass;
+ } kTestCases[] = {
+ {"cocksucker", true},
+ {"cocksuckers", true},
+ };
+
+ static const char* kLocales[] = { "en-GB", "en-US", "en-CA", "en-AU" };
+
+ // First check that the NOSUGGEST flag didn't mark these words as not
+ // being in the dictionary.
+ size_t test_cases_size = ARRAYSIZE_UNSAFE(kTestCases);
+ for (size_t j = 0; j < arraysize(kLocales); ++j) {
+ ReinitializeSpellCheck(kLocales[j]);
+ for (size_t i = 0; i < test_cases_size; ++i) {
+ size_t input_length = 0;
+ if (kTestCases[i].input != NULL)
+ input_length = strlen(kTestCases[i].input);
+
+ int misspelling_start = 0;
+ int misspelling_length = 0;
+ bool result = spell_check()->SpellCheckWord(
+ ASCIIToUTF16(kTestCases[i].input).c_str(),
+ static_cast<int>(input_length),
+ 0,
+ &misspelling_start,
+ &misspelling_length, NULL);
+
+ EXPECT_EQ(kTestCases[i].should_pass, result) << kTestCases[i].input <<
+ " in " << kLocales[j];
+ }
+ }
+
+ // Now verify that neither of testCases show up as suggestions.
+ for (size_t d = 0; d < arraysize(kLocales); ++d) {
+ ReinitializeSpellCheck(kLocales[d]);
+ int misspelling_start;
+ int misspelling_length;
+ std::vector<string16> suggestions;
+ spell_check()->SpellCheckWord(
+ ASCIIToUTF16("suckerbert").c_str(),
+ 10,
+ 0,
+ &misspelling_start,
+ &misspelling_length,
+ &suggestions);
+ // Check if the suggested words occur.
+ for (int j = 0; j < static_cast<int>(suggestions.size()); j++) {
+ for (size_t t = 0; t < test_cases_size; t++) {
+ int compare_result =
+ suggestions.at(j).compare(ASCIIToUTF16(kTestCases[t].input));
+ EXPECT_FALSE(compare_result == 0) << kTestCases[t].input <<
+ " in " << kLocales[d];
+ }
+ }
+ }
+}
+
#endif