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 "components/spellcheck/renderer/spellcheck_provider_test.h" | 5 #include "components/spellcheck/renderer/spellcheck_provider_test.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "components/spellcheck/common/spellcheck_messages.h" | 9 #include "components/spellcheck/common/spellcheck_messages.h" |
10 #include "components/spellcheck/renderer/spellcheck.h" | 10 #include "components/spellcheck/renderer/spellcheck.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ++spelling_service_call_count_; | 76 ++spelling_service_call_count_; |
77 blink::WebTextCheckingCompletion* completion = | 77 blink::WebTextCheckingCompletion* completion = |
78 text_check_completions_.Lookup(identifier); | 78 text_check_completions_.Lookup(identifier); |
79 if (!completion) { | 79 if (!completion) { |
80 ResetResult(); | 80 ResetResult(); |
81 return; | 81 return; |
82 } | 82 } |
83 text_.assign(text); | 83 text_.assign(text); |
84 text_check_completions_.Remove(identifier); | 84 text_check_completions_.Remove(identifier); |
85 std::vector<blink::WebTextCheckingResult> results; | 85 std::vector<blink::WebTextCheckingResult> results; |
86 results.push_back(blink::WebTextCheckingResult( | 86 results.push_back( |
87 blink::kWebTextDecorationTypeSpelling, 0, 5, blink::WebString("hello"))); | 87 blink::WebTextCheckingResult(blink::kWebTextDecorationTypeSpelling, 0, 5, |
| 88 std::vector<blink::WebString>({"hello"}))); |
88 completion->DidFinishCheckingText(results); | 89 completion->DidFinishCheckingText(results); |
89 last_request_ = text; | 90 last_request_ = text; |
90 last_results_ = results; | 91 last_results_ = results; |
91 #endif | 92 #endif |
92 } | 93 } |
93 | 94 |
94 void TestingSpellCheckProvider::ResetResult() { | 95 void TestingSpellCheckProvider::ResetResult() { |
95 text_.clear(); | 96 text_.clear(); |
96 } | 97 } |
97 | 98 |
98 void TestingSpellCheckProvider::SetLastResults( | 99 void TestingSpellCheckProvider::SetLastResults( |
99 const base::string16 last_request, | 100 const base::string16 last_request, |
100 blink::WebVector<blink::WebTextCheckingResult>& last_results) { | 101 blink::WebVector<blink::WebTextCheckingResult>& last_results) { |
101 last_request_ = last_request; | 102 last_request_ = last_request; |
102 last_results_ = last_results; | 103 last_results_ = last_results; |
103 } | 104 } |
104 | 105 |
105 bool TestingSpellCheckProvider::SatisfyRequestFromCache( | 106 bool TestingSpellCheckProvider::SatisfyRequestFromCache( |
106 const base::string16& text, | 107 const base::string16& text, |
107 blink::WebTextCheckingCompletion* completion) { | 108 blink::WebTextCheckingCompletion* completion) { |
108 return SpellCheckProvider::SatisfyRequestFromCache(text, completion); | 109 return SpellCheckProvider::SatisfyRequestFromCache(text, completion); |
109 } | 110 } |
110 | 111 |
111 SpellCheckProviderTest::SpellCheckProviderTest() {} | 112 SpellCheckProviderTest::SpellCheckProviderTest() {} |
112 SpellCheckProviderTest::~SpellCheckProviderTest() {} | 113 SpellCheckProviderTest::~SpellCheckProviderTest() {} |
OLD | NEW |