Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: components/spellcheck/renderer/spellcheck_provider_test.cc

Issue 2848943002: Allow storing multiple replacements on SpellCheckResult (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 blink::WebVector<blink::WebString> replacements;
groby-ooo-7-16 2017/04/28 23:45:55 I don't think you need this.
87 blink::kWebTextDecorationTypeSpelling, 0, 5, blink::WebString("hello"))); 87 results.push_back(
88 blink::WebTextCheckingResult(blink::kWebTextDecorationTypeSpelling, 0, 5,
89 std::vector<blink::WebString>({"hello"})));
88 completion->DidFinishCheckingText(results); 90 completion->DidFinishCheckingText(results);
89 last_request_ = text; 91 last_request_ = text;
90 last_results_ = results; 92 last_results_ = results;
91 #endif 93 #endif
92 } 94 }
93 95
94 void TestingSpellCheckProvider::ResetResult() { 96 void TestingSpellCheckProvider::ResetResult() {
95 text_.clear(); 97 text_.clear();
96 } 98 }
97 99
98 void TestingSpellCheckProvider::SetLastResults( 100 void TestingSpellCheckProvider::SetLastResults(
99 const base::string16 last_request, 101 const base::string16 last_request,
100 blink::WebVector<blink::WebTextCheckingResult>& last_results) { 102 blink::WebVector<blink::WebTextCheckingResult>& last_results) {
101 last_request_ = last_request; 103 last_request_ = last_request;
102 last_results_ = last_results; 104 last_results_ = last_results;
103 } 105 }
104 106
105 bool TestingSpellCheckProvider::SatisfyRequestFromCache( 107 bool TestingSpellCheckProvider::SatisfyRequestFromCache(
106 const base::string16& text, 108 const base::string16& text,
107 blink::WebTextCheckingCompletion* completion) { 109 blink::WebTextCheckingCompletion* completion) {
108 return SpellCheckProvider::SatisfyRequestFromCache(text, completion); 110 return SpellCheckProvider::SatisfyRequestFromCache(text, completion);
109 } 111 }
110 112
111 SpellCheckProviderTest::SpellCheckProviderTest() {} 113 SpellCheckProviderTest::SpellCheckProviderTest() {}
112 SpellCheckProviderTest::~SpellCheckProviderTest() {} 114 SpellCheckProviderTest::~SpellCheckProviderTest() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698