OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "components/spellcheck/renderer/spellcheck_provider_test.h" | 6 #include "components/spellcheck/renderer/spellcheck_provider_test.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/WebKit/public/platform/WebString.h" | 8 #include "third_party/WebKit/public/platform/WebString.h" |
9 #include "third_party/WebKit/public/platform/WebVector.h" | 9 #include "third_party/WebKit/public/platform/WebVector.h" |
10 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 10 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 EXPECT_TRUE(provider_.SatisfyRequestFromCache(base::ASCIIToUTF16("This is a"), | 22 EXPECT_TRUE(provider_.SatisfyRequestFromCache(base::ASCIIToUTF16("This is a"), |
23 &completion)); | 23 &completion)); |
24 EXPECT_EQ(completion.completion_count_, 1U); | 24 EXPECT_EQ(completion.completion_count_, 1U); |
25 } | 25 } |
26 | 26 |
27 TEST_F(SpellCheckProviderCacheTest, SubstringWithMisspellings) { | 27 TEST_F(SpellCheckProviderCacheTest, SubstringWithMisspellings) { |
28 FakeTextCheckingCompletion completion; | 28 FakeTextCheckingCompletion completion; |
29 | 29 |
30 blink::WebVector<blink::WebTextCheckingResult> last_results; | 30 blink::WebVector<blink::WebTextCheckingResult> last_results; |
31 std::vector<blink::WebTextCheckingResult> results; | 31 std::vector<blink::WebTextCheckingResult> results; |
32 results.push_back(blink::WebTextCheckingResult( | 32 results.push_back( |
33 blink::kWebTextDecorationTypeSpelling, 5, 3, blink::WebString("isq"))); | 33 blink::WebTextCheckingResult(blink::kWebTextDecorationTypeSpelling, 5, 3, |
| 34 std::vector<blink::WebString>({"isq"}))); |
34 last_results.Assign(results); | 35 last_results.Assign(results); |
35 provider_.SetLastResults(base::ASCIIToUTF16("This isq a test"), last_results); | 36 provider_.SetLastResults(base::ASCIIToUTF16("This isq a test"), last_results); |
36 EXPECT_TRUE(provider_.SatisfyRequestFromCache( | 37 EXPECT_TRUE(provider_.SatisfyRequestFromCache( |
37 base::ASCIIToUTF16("This isq a"), &completion)); | 38 base::ASCIIToUTF16("This isq a"), &completion)); |
38 EXPECT_EQ(completion.completion_count_, 1U); | 39 EXPECT_EQ(completion.completion_count_, 1U); |
39 } | 40 } |
40 | 41 |
41 TEST_F(SpellCheckProviderCacheTest, ShorterTextNotSubstring) { | 42 TEST_F(SpellCheckProviderCacheTest, ShorterTextNotSubstring) { |
42 FakeTextCheckingCompletion completion; | 43 FakeTextCheckingCompletion completion; |
43 | 44 |
44 blink::WebVector<blink::WebTextCheckingResult> last_results; | 45 blink::WebVector<blink::WebTextCheckingResult> last_results; |
45 provider_.SetLastResults(base::ASCIIToUTF16("This is a test"), last_results); | 46 provider_.SetLastResults(base::ASCIIToUTF16("This is a test"), last_results); |
46 EXPECT_FALSE(provider_.SatisfyRequestFromCache( | 47 EXPECT_FALSE(provider_.SatisfyRequestFromCache( |
47 base::ASCIIToUTF16("That is a"), &completion)); | 48 base::ASCIIToUTF16("That is a"), &completion)); |
48 EXPECT_EQ(completion.completion_count_, 0U); | 49 EXPECT_EQ(completion.completion_count_, 0U); |
49 } | 50 } |
50 | 51 |
51 } // namespace | 52 } // namespace |
OLD | NEW |