OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/common/spellcheck_marker.h" | 9 #include "chrome/common/spellcheck_marker.h" |
10 #include "chrome/common/spellcheck_messages.h" | 10 #include "chrome/common/spellcheck_messages.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 EXPECT_EQ(completion.completion_count_, 4U); | 125 EXPECT_EQ(completion.completion_count_, 4U); |
126 EXPECT_EQ(completion.cancellation_count_, 1U); | 126 EXPECT_EQ(completion.cancellation_count_, 1U); |
127 EXPECT_EQ(provider_.spelling_service_call_count_, 2U); | 127 EXPECT_EQ(provider_.spelling_service_call_count_, 2U); |
128 } | 128 } |
129 | 129 |
130 // Tests that the SpellCheckProvider calls didFinishCheckingText() when | 130 // Tests that the SpellCheckProvider calls didFinishCheckingText() when |
131 // necessary. | 131 // necessary. |
132 TEST_F(SpellCheckProviderTest, CompleteNecessaryRequests) { | 132 TEST_F(SpellCheckProviderTest, CompleteNecessaryRequests) { |
133 FakeTextCheckingCompletion completion; | 133 FakeTextCheckingCompletion completion; |
134 | 134 |
135 string16 text = ASCIIToUTF16("Icland is an icland "); | 135 base::string16 text = ASCIIToUTF16("Icland is an icland "); |
136 provider_.RequestTextChecking( | 136 provider_.RequestTextChecking( |
137 blink::WebString(text), &completion, std::vector<SpellCheckMarker>()); | 137 blink::WebString(text), &completion, std::vector<SpellCheckMarker>()); |
138 EXPECT_EQ(0U, completion.cancellation_count_) << "Should finish checking \"" | 138 EXPECT_EQ(0U, completion.cancellation_count_) << "Should finish checking \"" |
139 << text << "\""; | 139 << text << "\""; |
140 | 140 |
141 const int kSubstringLength = 18; | 141 const int kSubstringLength = 18; |
142 string16 substring = text.substr(0, kSubstringLength); | 142 base::string16 substring = text.substr(0, kSubstringLength); |
143 provider_.RequestTextChecking(blink::WebString(substring), | 143 provider_.RequestTextChecking(blink::WebString(substring), |
144 &completion, | 144 &completion, |
145 std::vector<SpellCheckMarker>()); | 145 std::vector<SpellCheckMarker>()); |
146 EXPECT_EQ(0U, completion.cancellation_count_) << "Should finish checking \"" | 146 EXPECT_EQ(0U, completion.cancellation_count_) << "Should finish checking \"" |
147 << substring << "\""; | 147 << substring << "\""; |
148 | 148 |
149 provider_.RequestTextChecking( | 149 provider_.RequestTextChecking( |
150 blink::WebString(text), &completion, std::vector<SpellCheckMarker>()); | 150 blink::WebString(text), &completion, std::vector<SpellCheckMarker>()); |
151 EXPECT_EQ(0U, completion.cancellation_count_) << "Should finish checking \"" | 151 EXPECT_EQ(0U, completion.cancellation_count_) << "Should finish checking \"" |
152 << text << "\""; | 152 << text << "\""; |
(...skipping 19 matching lines...) Expand all Loading... |
172 | 172 |
173 provider_.RequestTextChecking(blink::WebString("hello world."), | 173 provider_.RequestTextChecking(blink::WebString("hello world."), |
174 &completion, | 174 &completion, |
175 std::vector<SpellCheckMarker>()); | 175 std::vector<SpellCheckMarker>()); |
176 EXPECT_EQ(completion.completion_count_, 3U); | 176 EXPECT_EQ(completion.completion_count_, 3U); |
177 EXPECT_EQ(completion.cancellation_count_, 1U); | 177 EXPECT_EQ(completion.cancellation_count_, 1U); |
178 EXPECT_EQ(provider_.spelling_service_call_count_, 2U); | 178 EXPECT_EQ(provider_.spelling_service_call_count_, 2U); |
179 } | 179 } |
180 | 180 |
181 } // namespace | 181 } // namespace |
OLD | NEW |