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

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

Issue 11280013: Unit-tests for removing words from the dictionary (Closed) Base URL: http://git.chromium.org/chromium/src.git@dictionary
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
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_custom_dictionary.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
index b5fb4253be5d799a4e88c3ee9b1aaa235607f581..bdbc15ea52f963249653d8dab66c3ae504b859f2 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
@@ -45,7 +45,6 @@ class SpellcheckCustomDictionaryTest : public testing::Test {
scoped_ptr<TestingProfile> profile_;
};
-// TODO(rlp/rouslan): Shift some of these to a cutsom dictionary test suite.
TEST_F(SpellcheckCustomDictionaryTest, SpellcheckSetCustomWordList) {
SpellcheckService* spellcheck_service =
SpellcheckServiceFactory::GetForProfile(profile_.get());
@@ -60,14 +59,13 @@ TEST_F(SpellcheckCustomDictionaryTest, SpellcheckSetCustomWordList) {
EXPECT_EQ(custom_dictionary->GetWords(), expected);
}
-TEST_F(SpellcheckCustomDictionaryTest, CustomWordAddedLocally) {
+TEST_F(SpellcheckCustomDictionaryTest, CustomWordAddedAndRemovedLocally) {
SpellcheckService* spellcheck_service =
SpellcheckServiceFactory::GetForProfile(profile_.get());
WordList loaded_custom_words;
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
- custom_dictionary->Load();
WordList expected;
EXPECT_EQ(custom_dictionary->GetWords(), expected);
custom_dictionary->CustomWordAddedLocally("foo");
@@ -76,6 +74,11 @@ TEST_F(SpellcheckCustomDictionaryTest, CustomWordAddedLocally) {
custom_dictionary->CustomWordAddedLocally("bar");
expected.push_back("bar");
EXPECT_EQ(custom_dictionary->GetWords(), expected);
+
+ custom_dictionary->CustomWordRemovedLocally("foo");
+ custom_dictionary->CustomWordRemovedLocally("bar");
+ expected.clear();
+ EXPECT_EQ(custom_dictionary->GetWords(), expected);
}
TEST_F(SpellcheckCustomDictionaryTest, SaveAndLoad) {
@@ -108,6 +111,13 @@ TEST_F(SpellcheckCustomDictionaryTest, SaveAndLoad) {
spellcheck_service2.GetCustomDictionary()->
LoadDictionaryIntoCustomWordList(&loaded_custom_words2);
EXPECT_EQ(loaded_custom_words2, expected);
+
+ custom_dictionary->EraseWordFromCustomDictionary("foo");
+ custom_dictionary->EraseWordFromCustomDictionary("bar");
+ custom_dictionary->LoadDictionaryIntoCustomWordList(&loaded_custom_words);
+ expected.clear();
+ EXPECT_EQ(loaded_custom_words, expected);
+
// Flush the loop now to prevent service init tasks from being run during
// TearDown();
MessageLoop::current()->RunUntilIdle();
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_custom_dictionary.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698