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

Side by Side Diff: webkit/tools/test_shell/mock_spellcheck.h

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_ 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_
6 #define WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_ 6 #define WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/string16.h" 11 #include "base/string16.h.h"
12 12
13 // A mock implementation of a spell-checker used for WebKit tests. 13 // A mock implementation of a spell-checker used for WebKit tests.
14 // This class only implements the minimal functionarities required by WebKit 14 // This class only implements the minimal functionarities required by WebKit
15 // tests, i.e. this class just compares the given string with known misspelled 15 // tests, i.e. this class just compares the given string with known misspelled
16 // words in webkit tests and mark them as missspelled. 16 // words in webkit tests and mark them as missspelled.
17 // Even though this is sufficent for webkit tests, this class is not suitable 17 // Even though this is sufficent for webkit tests, this class is not suitable
18 // for any other usages. 18 // for any other usages.
19 class MockSpellCheck { 19 class MockSpellCheck {
20 public: 20 public:
21 MockSpellCheck(); 21 MockSpellCheck();
22 ~MockSpellCheck(); 22 ~MockSpellCheck();
23 23
24 // Checks the spellings of the specified text. 24 // Checks the spellings of the specified text.
25 // This function returns true if the text consists of valid words, and 25 // This function returns true if the text consists of valid words, and
26 // returns false if it includes invalid words. 26 // returns false if it includes invalid words.
27 // When the given text includes invalid words, this function sets the 27 // When the given text includes invalid words, this function sets the
28 // position of the first invalid word to misspelledOffset, and the length of 28 // position of the first invalid word to misspelledOffset, and the length of
29 // the first invalid word to misspelledLength, respectively. 29 // the first invalid word to misspelledLength, respectively.
30 // For example, when the given text is " zz zz", this function sets 3 to 30 // For example, when the given text is " zz zz", this function sets 3 to
31 // misspelledOffset and 2 to misspelledLength, respectively. 31 // misspelledOffset and 2 to misspelledLength, respectively.
32 bool SpellCheckWord(const string16& text, 32 bool SpellCheckWord(const base::string16& text,
33 int* misspelledOffset, 33 int* misspelledOffset,
34 int* misspelledLength); 34 int* misspelledLength);
35 35
36 // Emulates suggestions for misspelled words. 36 // Emulates suggestions for misspelled words.
37 // The suggestions are pushed to |suggestions| parameters. 37 // The suggestions are pushed to |suggestions| parameters.
38 void FillSuggestions(const string16& word, 38 void FillSuggestions(const base::string16& word,
39 std::vector<string16>* suggestions); 39 std::vector<base::string16>* suggestions);
40 private: 40 private:
41 // Initialize the internal resources if we need to initialize it. 41 // Initialize the internal resources if we need to initialize it.
42 // Initializing this object may take long time. To prevent from hurting 42 // Initializing this object may take long time. To prevent from hurting
43 // the performance of test_shell, we initialize this object when 43 // the performance of test_shell, we initialize this object when
44 // SpellCheckWord() is called for the first time. 44 // SpellCheckWord() is called for the first time.
45 // To be compliant with SpellCheck:InitializeIfNeeded(), this function 45 // To be compliant with SpellCheck:InitializeIfNeeded(), this function
46 // returns true if this object is downloading a dictionary, otherwise 46 // returns true if this object is downloading a dictionary, otherwise
47 // it returns false. 47 // it returns false.
48 bool InitializeIfNeeded(); 48 bool InitializeIfNeeded();
49 49
50 // A table that consists of misspelled words. 50 // A table that consists of misspelled words.
51 std::map<string16, bool> misspelled_words_; 51 std::map<base::string16, bool> misspelled_words_;
52 52
53 // A flag representing whether or not this object is initialized. 53 // A flag representing whether or not this object is initialized.
54 bool initialized_; 54 bool initialized_;
55 }; 55 };
56 56
57 #endif // WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_ 57 #endif // WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698