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

Unified Diff: components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc

Issue 2857353002: Convert Spellcheck host MessageFilter IPC to mojo (Closed)
Patch Set: Use MakeUnique for the MessageLoop in TestingSpellCheckProvider. Created 3 years, 7 months 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: components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc
diff --git a/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc b/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc
index 34ab0a66224a29d0a5ddde797e06dc7aa0bba25d..7da30b83a325b6e92fce48c2fc71171732f8d73b 100644
--- a/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc
+++ b/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc
@@ -17,12 +17,14 @@ using base::WideToUTF16;
namespace {
+// Tests that the SpellCheckProvider object sends a spellcheck request when a
+// user finishes typing a word.
TEST_F(SpellCheckProviderTest, UsingHunspell) {
FakeTextCheckingCompletion completion;
provider_.RequestTextChecking(ASCIIToUTF16("hello"), &completion);
EXPECT_EQ(completion.completion_count_, 1U);
- EXPECT_EQ(provider_.messages_.size(), 0U);
EXPECT_EQ(provider_.pending_text_request_size(), 0U);
+ EXPECT_EQ(provider_.spelling_service_call_count_, 1U);
}
// Tests that the SpellCheckProvider object sends a spellcheck request when a
@@ -35,18 +37,21 @@ TEST_F(SpellCheckProviderTest, MultiLineText) {
provider_.ResetResult();
provider_.RequestTextChecking(base::string16(), &completion);
EXPECT_TRUE(provider_.text_.empty());
+ EXPECT_EQ(provider_.spelling_service_call_count_, 0U);
// Verify that the SpellCheckProvider class spellcheck the first word when we
// stop typing after finishing the first word.
provider_.ResetResult();
provider_.RequestTextChecking(ASCIIToUTF16("First"), &completion);
EXPECT_EQ(ASCIIToUTF16("First"), provider_.text_);
+ EXPECT_EQ(provider_.spelling_service_call_count_, 1U);
// Verify that the SpellCheckProvider class spellcheck the first line when we
// type a return key, i.e. when we finish typing a line.
provider_.ResetResult();
provider_.RequestTextChecking(ASCIIToUTF16("First Second\n"), &completion);
EXPECT_EQ(ASCIIToUTF16("First Second\n"), provider_.text_);
+ EXPECT_EQ(provider_.spelling_service_call_count_, 2U);
// Verify that the SpellCheckProvider class spellcheck the lines when we
// finish typing a word "Third" to the second line.
@@ -54,6 +59,7 @@ TEST_F(SpellCheckProviderTest, MultiLineText) {
provider_.RequestTextChecking(ASCIIToUTF16("First Second\nThird "),
&completion);
EXPECT_EQ(ASCIIToUTF16("First Second\nThird "), provider_.text_);
+ EXPECT_EQ(provider_.spelling_service_call_count_, 3U);
// Verify that the SpellCheckProvider class does not send a spellcheck request
// when a user inserts whitespace characters.
@@ -61,6 +67,7 @@ TEST_F(SpellCheckProviderTest, MultiLineText) {
provider_.RequestTextChecking(ASCIIToUTF16("First Second\nThird "),
&completion);
EXPECT_TRUE(provider_.text_.empty());
+ EXPECT_EQ(provider_.spelling_service_call_count_, 3U);
// Verify that the SpellCheckProvider class spellcheck the lines when we type
// a period.
@@ -68,6 +75,7 @@ TEST_F(SpellCheckProviderTest, MultiLineText) {
provider_.RequestTextChecking(ASCIIToUTF16("First Second\nThird Fourth."),
&completion);
EXPECT_EQ(ASCIIToUTF16("First Second\nThird Fourth."), provider_.text_);
+ EXPECT_EQ(provider_.spelling_service_call_count_, 4U);
}
// Tests that the SpellCheckProvider class does not send requests to the
« no previous file with comments | « components/spellcheck/renderer/spellcheck_provider.cc ('k') | components/spellcheck/renderer/spellcheck_provider_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698