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

Unified Diff: chrome/browser/spellchecker/spellcheck_service_unittest.cc

Issue 11293241: Cleaning up the custom dictionary code relative to the SpellcheckService to make the custom diction… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spellcheck_service_unittest.cc
diff --git a/chrome/browser/spellchecker/spellcheck_service_unittest.cc b/chrome/browser/spellchecker/spellcheck_service_unittest.cc
index 1a6610d733f61b18b91df57959f873c7746e2bb9..5fbbc112560430c71ed8f815c005ab84ed85d09f 100644
--- a/chrome/browser/spellchecker/spellcheck_service_unittest.cc
+++ b/chrome/browser/spellchecker/spellcheck_service_unittest.cc
@@ -46,103 +46,6 @@ class SpellcheckServiceTest : public testing::Test {
scoped_ptr<TestingProfile> profile_;
};
-// TODO(rlp/rouslan): Shift some of these to a cutsom dictionary test suite.
-TEST_F(SpellcheckServiceTest, SpellcheckSetCustomWordList) {
- SpellcheckService* spellcheck_service =
- SpellcheckServiceFactory::GetForProfile(profile_.get());
-
- WordList loaded_custom_words;
- loaded_custom_words.push_back("foo");
- loaded_custom_words.push_back("bar");
- WordList expected(loaded_custom_words);
- spellcheck_service->GetCustomDictionary()->SetCustomWordList(
- &loaded_custom_words);
- EXPECT_EQ(spellcheck_service->GetCustomWords(), expected);
-}
-
-TEST_F(SpellcheckServiceTest, CustomWordAddedLocally) {
- SpellcheckService* spellcheck_service =
- SpellcheckServiceFactory::GetForProfile(profile_.get());
-
- WordList loaded_custom_words;
- spellcheck_service->GetCustomDictionary()->Load();
- WordList expected;
- EXPECT_EQ(spellcheck_service->GetCustomWords(), expected);
- spellcheck_service->CustomWordAddedLocally("foo");
- expected.push_back("foo");
- EXPECT_EQ(spellcheck_service->GetCustomWords(), expected);
- spellcheck_service->CustomWordAddedLocally("bar");
- expected.push_back("bar");
- EXPECT_EQ(spellcheck_service->GetCustomWords(), expected);
-}
-
-TEST_F(SpellcheckServiceTest, SaveAndLoad) {
- SpellcheckService* spellcheck_service =
- SpellcheckServiceFactory::GetForProfile(profile_.get());
-
- WordList loaded_custom_words;
- spellcheck_service->LoadDictionaryIntoCustomWordList(&loaded_custom_words);
-
- // The custom word list should be empty now.
- WordList expected;
- EXPECT_EQ(loaded_custom_words, expected);
-
- spellcheck_service->WriteWordToCustomDictionary("foo");
- expected.push_back("foo");
-
- spellcheck_service->WriteWordToCustomDictionary("bar");
- expected.push_back("bar");
-
- // The custom word list should include written words.
- spellcheck_service->LoadDictionaryIntoCustomWordList(&loaded_custom_words);
- EXPECT_EQ(loaded_custom_words, expected);
-
- // Load in another instance of SpellCheckService.
- // The result should be the same.
- SpellcheckService spellcheck_service2(profile_.get());
- WordList loaded_custom_words2;
- spellcheck_service2.LoadDictionaryIntoCustomWordList(&loaded_custom_words2);
- EXPECT_EQ(loaded_custom_words2, expected);
- // Flush the loop now to prevent service init tasks from being run during
- // TearDown();
- MessageLoop::current()->RunUntilIdle();
-}
-
-TEST_F(SpellcheckServiceTest, MultiProfile) {
- SpellcheckService* spellcheck_service =
- SpellcheckServiceFactory::GetForProfile(profile_.get());
- TestingProfile profile2;
- SpellcheckService* spellcheck_service2 =
- static_cast<SpellcheckService*>(
- SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
- &profile2, &BuildSpellcheckService));
-
- WordList expected1;
- WordList expected2;
-
- spellcheck_service->WriteWordToCustomDictionary("foo");
- spellcheck_service->WriteWordToCustomDictionary("bar");
- expected1.push_back("foo");
- expected1.push_back("bar");
-
- spellcheck_service2->WriteWordToCustomDictionary("hoge");
- spellcheck_service2->WriteWordToCustomDictionary("fuga");
- expected2.push_back("hoge");
- expected2.push_back("fuga");
-
- WordList actual1;
- spellcheck_service->LoadDictionaryIntoCustomWordList(&actual1);
- EXPECT_EQ(actual1, expected1);
-
- WordList actual2;
- spellcheck_service2->LoadDictionaryIntoCustomWordList(&actual2);
- EXPECT_EQ(actual2, expected2);
-
- // Flush the loop now to prevent service init tasks from being run during
- // TearDown();
- MessageLoop::current()->RunUntilIdle();
-}
-
TEST_F(SpellcheckServiceTest, GetSpellCheckLanguages1) {
std::vector<std::string> accept_languages;
accept_languages.push_back("en");
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.cc ('k') | chrome/browser/tab_contents/spelling_menu_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698