| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/test_runner/mock_spell_check.h" | 5 #include "content/shell/test_runner/mock_spell_check.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 bool MockSpellCheck::HasInCache(const blink::WebString& word) { | 108 bool MockSpellCheck::HasInCache(const blink::WebString& word) { |
| 109 return word == "Spell wellcome. Is it broken?" || | 109 return word == "Spell wellcome. Is it broken?" || |
| 110 word == "Spell wellcome.\x007F"; | 110 word == "Spell wellcome.\x007F"; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool MockSpellCheck::IsMultiWordMisspelling( | 113 bool MockSpellCheck::IsMultiWordMisspelling( |
| 114 const blink::WebString& text, | 114 const blink::WebString& text, |
| 115 std::vector<blink::WebTextCheckingResult>* results) { | 115 std::vector<blink::WebTextCheckingResult>* results) { |
| 116 if (text == "Helllo wordl.") { | 116 if (text == "Helllo wordl.") { |
| 117 results->push_back( | 117 results->push_back(blink::WebTextCheckingResult( |
| 118 blink::WebTextCheckingResult(blink::kWebTextDecorationTypeSpelling, 0, | 118 blink::kWebTextDecorationTypeSpelling, 0, 6, |
| 119 6, blink::WebString("Hello"))); | 119 std::vector<blink::WebString>({"Hello"}))); |
| 120 results->push_back( | 120 results->push_back(blink::WebTextCheckingResult( |
| 121 blink::WebTextCheckingResult(blink::kWebTextDecorationTypeSpelling, 7, | 121 blink::kWebTextDecorationTypeSpelling, 7, 5, |
| 122 5, blink::WebString("world"))); | 122 std::vector<blink::WebString>({"world"}))); |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MockSpellCheck::FillSuggestionList( | 128 void MockSpellCheck::FillSuggestionList( |
| 129 const blink::WebString& word, | 129 const blink::WebString& word, |
| 130 blink::WebVector<blink::WebString>* suggestions) { | 130 blink::WebVector<blink::WebString>* suggestions) { |
| 131 if (word == "wellcome") | 131 if (word == "wellcome") |
| 132 Append(suggestions, blink::WebString::FromUTF8("welcome")); | 132 Append(suggestions, blink::WebString::FromUTF8("welcome")); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // Mark as initialized to prevent this object from being initialized twice | 167 // Mark as initialized to prevent this object from being initialized twice |
| 168 // or more. | 168 // or more. |
| 169 initialized_ = true; | 169 initialized_ = true; |
| 170 | 170 |
| 171 // Since this MockSpellCheck class doesn't download dictionaries, this | 171 // Since this MockSpellCheck class doesn't download dictionaries, this |
| 172 // function always returns false. | 172 // function always returns false. |
| 173 return false; | 173 return false; |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace test_runner | 176 } // namespace test_runner |
| OLD | NEW |