OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <tuple> | 9 #include <tuple> |
10 #include <vector> | 10 #include <vector> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 base::string16 sent_text = std::get<2>(params); | 114 base::string16 sent_text = std::get<2>(params); |
115 std::vector<SpellCheckResult> sent_results = std::get<3>(params); | 115 std::vector<SpellCheckResult> sent_results = std::get<3>(params); |
116 EXPECT_TRUE(ok); | 116 EXPECT_TRUE(ok); |
117 EXPECT_EQ(kCallbackId, sent_identifier); | 117 EXPECT_EQ(kCallbackId, sent_identifier); |
118 EXPECT_EQ(kSuccess, sent_success); | 118 EXPECT_EQ(kSuccess, sent_success); |
119 EXPECT_EQ(kText, sent_text); | 119 EXPECT_EQ(kText, sent_text); |
120 ASSERT_EQ(1U, sent_results.size()); | 120 ASSERT_EQ(1U, sent_results.size()); |
121 EXPECT_EQ(kDecoration, sent_results[0].decoration); | 121 EXPECT_EQ(kDecoration, sent_results[0].decoration); |
122 EXPECT_EQ(kLocation, sent_results[0].location); | 122 EXPECT_EQ(kLocation, sent_results[0].location); |
123 EXPECT_EQ(kLength, sent_results[0].length); | 123 EXPECT_EQ(kLength, sent_results[0].length); |
124 EXPECT_EQ(kReplacement, sent_results[0].replacement); | 124 EXPECT_EQ(kReplacement, sent_results[0].replacements[0]); |
125 } | 125 } |
126 | 126 |
127 TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTest) { | 127 TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTest) { |
128 std::vector<SpellCheckResult> results; | 128 std::vector<SpellCheckResult> results; |
129 results.push_back(SpellCheckResult( | 129 results.push_back(SpellCheckResult( |
130 SpellCheckResult::SPELLING, 0, 6, base::ASCIIToUTF16("Hello"))); | 130 SpellCheckResult::SPELLING, 0, 6, base::ASCIIToUTF16("Hello"))); |
131 results.push_back(SpellCheckResult( | 131 results.push_back(SpellCheckResult( |
132 SpellCheckResult::SPELLING, 7, 7, base::ASCIIToUTF16("world"))); | 132 SpellCheckResult::SPELLING, 7, 7, base::ASCIIToUTF16("world"))); |
133 | 133 |
134 scoped_refptr<TestingSpellCheckMessageFilter> filter( | 134 scoped_refptr<TestingSpellCheckMessageFilter> filter( |
135 new TestingSpellCheckMessageFilter); | 135 new TestingSpellCheckMessageFilter); |
136 filter->OnTextCheckComplete(1, 1, true, base::ASCIIToUTF16("Helllo walrd"), | 136 filter->OnTextCheckComplete(1, 1, true, base::ASCIIToUTF16("Helllo walrd"), |
137 results); | 137 results); |
138 ASSERT_EQ(1U, filter->sent_messages.size()); | 138 ASSERT_EQ(1U, filter->sent_messages.size()); |
139 | 139 |
140 SpellCheckMsg_RespondSpellingService::Param params; | 140 SpellCheckMsg_RespondSpellingService::Param params; |
141 bool ok = SpellCheckMsg_RespondSpellingService::Read( | 141 bool ok = SpellCheckMsg_RespondSpellingService::Read( |
142 filter->sent_messages[0].get(), ¶ms); | 142 filter->sent_messages[0].get(), ¶ms); |
143 EXPECT_TRUE(ok); | 143 EXPECT_TRUE(ok); |
144 | 144 |
145 std::vector<SpellCheckResult> sent_results = std::get<3>(params); | 145 std::vector<SpellCheckResult> sent_results = std::get<3>(params); |
146 EXPECT_EQ(2U, sent_results.size()); | 146 EXPECT_EQ(2U, sent_results.size()); |
147 } | 147 } |
148 #endif | 148 #endif |
OLD | NEW |