diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 01:20:56 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 01:20:56 +0000 |
commit | 8fc0c4db979ee2f2d2423378dd3b9d102d9045c0 (patch) | |
tree | 6daea228a2995bcc527507a994d7615af9bbeb55 /chrome/browser | |
parent | c3515284acdfe396393537c1638443477714c608 (diff) | |
download | chromium_src-8fc0c4db979ee2f2d2423378dd3b9d102d9045c0.zip chromium_src-8fc0c4db979ee2f2d2423378dd3b9d102d9045c0.tar.gz chromium_src-8fc0c4db979ee2f2d2423378dd3b9d102d9045c0.tar.bz2 |
Changes spellcheck_unittest to read dictionaries directly from the src tree. Removes the build rules to copy test dictionaries to Dictionaries/.
Review URL: http://codereview.chromium.org/40082
Patch from rohitrao.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/spellcheck_unittest.cc | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/chrome/browser/spellcheck_unittest.cc b/chrome/browser/spellcheck_unittest.cc index 0378ad4..cf3fe1b 100644 --- a/chrome/browser/spellcheck_unittest.cc +++ b/chrome/browser/spellcheck_unittest.cc @@ -26,6 +26,18 @@ class SpellCheckTest : public testing::Test { extern void InitHunspellWithFiles(FILE* file_aff_hunspell, FILE* file_dic_hunspell); +FilePath GetHunspellDirectory() { + FilePath hunspell_directory; + if (!PathService::Get(base::DIR_SOURCE_ROOT, &hunspell_directory)) + return FilePath(); + + hunspell_directory = hunspell_directory.AppendASCII("chrome"); + hunspell_directory = hunspell_directory.AppendASCII("third_party"); + hunspell_directory = hunspell_directory.AppendASCII("hunspell"); + hunspell_directory = hunspell_directory.AppendASCII("dictionaries"); + return hunspell_directory; +} + // Operates unit tests for the webkit_glue::SpellCheckWord() function // with the US English dictionary. // The unit tests in this function consist of: @@ -249,9 +261,8 @@ TEST_F(SpellCheckTest, SpellCheckStrings_EN_US) { {L"ifmmp:ifmmp", false, 0, 11}, }; - FilePath hunspell_directory; - ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, - &hunspell_directory)); + FilePath hunspell_directory = GetHunspellDirectory(); + ASSERT_FALSE(hunspell_directory.empty()); scoped_refptr<SpellChecker> spell_checker(new SpellChecker( hunspell_directory, L"en-US", NULL, FilePath())); @@ -303,9 +314,8 @@ TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) { // TODO (Sidchat): add many more examples. }; - FilePath hunspell_directory; - ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, - &hunspell_directory)); + FilePath hunspell_directory = GetHunspellDirectory(); + ASSERT_FALSE(hunspell_directory.empty()); scoped_refptr<SpellChecker> spell_checker(new SpellChecker( hunspell_directory, L"en-US", NULL, FilePath())); @@ -351,10 +361,9 @@ TEST_F(SpellCheckTest, DISABLED_SpellCheckAddToDictionary_EN_US) { {L"Googler"}, }; - FilePath hunspell_directory; FilePath custom_dictionary_file(kTempCustomDictionaryFile); - ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, - &hunspell_directory)); + FilePath hunspell_directory = GetHunspellDirectory(); + ASSERT_FALSE(hunspell_directory.empty()); scoped_refptr<SpellChecker> spell_checker(new SpellChecker( hunspell_directory, L"en-US", NULL, custom_dictionary_file)); @@ -420,10 +429,9 @@ TEST_F(SpellCheckTest, DISABLED_SpellCheckSuggestionsAddToDictionary_EN_US) { {L"Googler"}, }; - FilePath hunspell_directory; FilePath custom_dictionary_file(kTempCustomDictionaryFile); - ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, - &hunspell_directory)); + FilePath hunspell_directory = GetHunspellDirectory(); + ASSERT_FALSE(hunspell_directory.empty()); scoped_refptr<SpellChecker> spell_checker(new SpellChecker( hunspell_directory, L"en-US", NULL, custom_dictionary_file)); |