diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 19:30:21 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 19:30:21 +0000 |
commit | eda2b5a29df212809fb3ee5a8e8c42017b635f1c (patch) | |
tree | e0b9116beca023c3400cee5e28baa7114dee9cd2 /chrome/browser/spellcheck_unittest.cc | |
parent | 01804b55e214f78aec2618b811a5ffa7079104dd (diff) | |
download | chromium_src-eda2b5a29df212809fb3ee5a8e8c42017b635f1c.zip chromium_src-eda2b5a29df212809fb3ee5a8e8c42017b635f1c.tar.gz chromium_src-eda2b5a29df212809fb3ee5a8e8c42017b635f1c.tar.bz2 |
Add Automatic spell correction support in Chrome.
Issue=7624
Review URL: http://codereview.chromium.org/42608
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellcheck_unittest.cc')
-rw-r--r-- | chrome/browser/spellcheck_unittest.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/chrome/browser/spellcheck_unittest.cc b/chrome/browser/spellcheck_unittest.cc index 8a9731f..aa76bf0 100644 --- a/chrome/browser/spellcheck_unittest.cc +++ b/chrome/browser/spellcheck_unittest.cc @@ -495,3 +495,36 @@ TEST_F(SpellCheckTest, DISABLED_SpellCheckSuggestionsAddToDictionary_EN_US) { // Remove the temp custom dictionary file. file_util::Delete(custom_dictionary_file, false); } + +TEST_F(SpellCheckTest, GetAutoCorrectionWord_EN_US) { + static const struct { + // A misspelled word. + const wchar_t* input; + + // An expected result for this test case. + // Should be an empty string if there are no suggestions for auto correct. + const wchar_t* expected_result; + } kTestCases[] = { + {L"teh", L"the"}, + {L"moer", L"more"}, + {L"watre", L"water"}, + {L"noen", L""}, + {L"what", L""}, + }; + + FilePath hunspell_directory = GetHunspellDirectory(); + ASSERT_FALSE(hunspell_directory.empty()); + + scoped_refptr<SpellChecker> spell_checker(new SpellChecker( + hunspell_directory, "en-US", NULL, FilePath())); + + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { + std::wstring misspelled_word(kTestCases[i].input); + std::wstring expected_autocorrect_word(kTestCases[i].expected_result); + std::wstring autocorrect_word; + spell_checker->GetAutoCorrectionWord(misspelled_word, &autocorrect_word); + + // Check for spelling. + EXPECT_EQ(expected_autocorrect_word, autocorrect_word); + } +} |