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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/common/spellcheck_messages.h" | 9 #include "chrome/common/spellcheck_messages.h" |
10 #include "chrome/renderer/spellchecker/spellcheck_provider_test.h" | 10 #include "chrome/renderer/spellchecker/spellcheck_provider_test.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // a period. | 78 // a period. |
79 provider_.ResetResult(); | 79 provider_.ResetResult(); |
80 provider_.RequestTextChecking( | 80 provider_.RequestTextChecking( |
81 WebKit::WebString("First Second\nThird Fourth."), &completion); | 81 WebKit::WebString("First Second\nThird Fourth."), &completion); |
82 EXPECT_EQ(0, provider_.offset_); | 82 EXPECT_EQ(0, provider_.offset_); |
83 EXPECT_EQ(ASCIIToUTF16("First Second\nThird Fourth."), provider_.text_); | 83 EXPECT_EQ(ASCIIToUTF16("First Second\nThird Fourth."), provider_.text_); |
84 } | 84 } |
85 | 85 |
86 // Tests that the SpellCheckProvider class cancels incoming spellcheck requests | 86 // Tests that the SpellCheckProvider class cancels incoming spellcheck requests |
87 // when it does not need to handle them. | 87 // when it does not need to handle them. |
88 TEST_F(SpellCheckProviderTest,CancelUnnecessaryRequests) { | 88 TEST_F(SpellCheckProviderTest, CancelUnnecessaryRequests) { |
89 FakeTextCheckingCompletion completion; | 89 FakeTextCheckingCompletion completion; |
90 provider_.RequestTextChecking(WebKit::WebString("hello."), | 90 provider_.RequestTextChecking(WebKit::WebString("hello."), |
91 &completion); | 91 &completion); |
92 EXPECT_EQ(completion.completion_count_, 1U); | 92 EXPECT_EQ(completion.completion_count_, 1U); |
93 EXPECT_EQ(completion.cancellation_count_, 0U); | 93 EXPECT_EQ(completion.cancellation_count_, 0U); |
94 | 94 |
95 // Test that the SpellCheckProvider class cancels an incoming request with the | 95 // Test that the SpellCheckProvider class cancels an incoming request with the |
96 // text same as above. | 96 // text same as above. |
97 provider_.RequestTextChecking(WebKit::WebString("hello."), | 97 provider_.RequestTextChecking(WebKit::WebString("hello."), |
98 &completion); | 98 &completion); |
(...skipping 10 matching lines...) Expand all Loading... |
109 // Test that the SpellCheckProvider class sends a request when it receives a | 109 // Test that the SpellCheckProvider class sends a request when it receives a |
110 // Russian word. | 110 // Russian word. |
111 const wchar_t kRussianWord[] = L"\x0431\x0451\x0434\x0440\x0430"; | 111 const wchar_t kRussianWord[] = L"\x0431\x0451\x0434\x0440\x0430"; |
112 provider_.RequestTextChecking(WebKit::WebString(WideToUTF16(kRussianWord)), | 112 provider_.RequestTextChecking(WebKit::WebString(WideToUTF16(kRussianWord)), |
113 &completion); | 113 &completion); |
114 EXPECT_EQ(completion.completion_count_, 4U); | 114 EXPECT_EQ(completion.completion_count_, 4U); |
115 EXPECT_EQ(completion.cancellation_count_, 2U); | 115 EXPECT_EQ(completion.cancellation_count_, 2U); |
116 } | 116 } |
117 | 117 |
118 } // namespace | 118 } // namespace |
OLD | NEW |