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

Side by Side Diff: components/test_runner/mock_spell_check.cc

Issue 2648433008: Use explicit WebString conversions in LayoutTest related files (Closed)
Patch Set: . Created 3 years, 11 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 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 "components/test_runner/mock_spell_check.h" 5 #include "components/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 30 matching lines...) Expand all
41 41
42 // Initialize this spellchecker. 42 // Initialize this spellchecker.
43 InitializeIfNeeded(); 43 InitializeIfNeeded();
44 44
45 // Reset the result values as our spellchecker does. 45 // Reset the result values as our spellchecker does.
46 *misspelled_offset = 0; 46 *misspelled_offset = 0;
47 *misspelled_length = 0; 47 *misspelled_length = 0;
48 48
49 // Convert to a base::string16 because we store base::string16 instances in 49 // Convert to a base::string16 because we store base::string16 instances in
50 // misspelled_words_ and blink::WebString has no find(). 50 // misspelled_words_ and blink::WebString has no find().
51 base::string16 string_text = text; 51 base::string16 string_text = text.utf16();
52 int skipped_length = 0; 52 int skipped_length = 0;
53 53
54 while (!string_text.empty()) { 54 while (!string_text.empty()) {
55 // Extract the first possible English word from the given string. 55 // Extract the first possible English word from the given string.
56 // The given string may include non-ASCII characters or numbers. So, we 56 // The given string may include non-ASCII characters or numbers. So, we
57 // should filter out such characters before start looking up our 57 // should filter out such characters before start looking up our
58 // misspelled-word table. 58 // misspelled-word table.
59 // (This is a simple version of our SpellCheckWordIterator class.) 59 // (This is a simple version of our SpellCheckWordIterator class.)
60 // If the given string doesn't include any ASCII characters, we can treat 60 // If the given string doesn't include any ASCII characters, we can treat
61 // the string as valid one. 61 // the string as valid one.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Mark as initialized to prevent this object from being initialized twice 169 // Mark as initialized to prevent this object from being initialized twice
170 // or more. 170 // or more.
171 initialized_ = true; 171 initialized_ = true;
172 172
173 // Since this MockSpellCheck class doesn't download dictionaries, this 173 // Since this MockSpellCheck class doesn't download dictionaries, this
174 // function always returns false. 174 // function always returns false.
175 return false; 175 return false;
176 } 176 }
177 177
178 } // namespace test_runner 178 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/mock_grammar_check.cc ('k') | components/test_runner/spell_check_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698