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

Side by Side Diff: chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 years, 2 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
« no previous file with comments | « chrome/installer/util/version.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 SpellcheckCharAttribute attributes; 119 SpellcheckCharAttribute attributes;
120 attributes.SetDefaultLanguage(kTestCases[i].language); 120 attributes.SetDefaultLanguage(kTestCases[i].language);
121 121
122 string16 input(WideToUTF16(kTestText)); 122 string16 input(WideToUTF16(kTestText));
123 SpellcheckWordIterator iterator; 123 SpellcheckWordIterator iterator;
124 EXPECT_TRUE(iterator.Initialize(&attributes, input.c_str(), input.length(), 124 EXPECT_TRUE(iterator.Initialize(&attributes, input.c_str(), input.length(),
125 kTestCases[i].allow_contraction)); 125 kTestCases[i].allow_contraction));
126 126
127 std::vector<string16> expected_words; 127 std::vector<string16> expected_words;
128 SplitString(WideToUTF16(kTestCases[i].expected_words), ' ', 128 base::SplitString(
129 &expected_words); 129 WideToUTF16(kTestCases[i].expected_words), ' ', &expected_words);
130 130
131 string16 actual_word; 131 string16 actual_word;
132 int actual_start, actual_end; 132 int actual_start, actual_end;
133 size_t index = 0; 133 size_t index = 0;
134 while (iterator.GetNextWord(&actual_word, &actual_start, &actual_end)) { 134 while (iterator.GetNextWord(&actual_word, &actual_start, &actual_end)) {
135 EXPECT_TRUE(index < expected_words.size()); 135 EXPECT_TRUE(index < expected_words.size());
136 if (index < expected_words.size()) 136 if (index < expected_words.size())
137 EXPECT_EQ(expected_words[index], actual_word); 137 EXPECT_EQ(expected_words[index], actual_word);
138 ++index; 138 ++index;
139 } 139 }
(...skipping 16 matching lines...) Expand all
156 156
157 // When SpellcheckWordIterator uses an inconsistent ICU ruleset, the following 157 // When SpellcheckWordIterator uses an inconsistent ICU ruleset, the following
158 // iterator.GetNextWord() call gets stuck in an infinite loop. Therefore, this 158 // iterator.GetNextWord() call gets stuck in an infinite loop. Therefore, this
159 // test succeeds if this call returns without timeouts. 159 // test succeeds if this call returns without timeouts.
160 string16 actual_word; 160 string16 actual_word;
161 int actual_start, actual_end; 161 int actual_start, actual_end;
162 EXPECT_FALSE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end)); 162 EXPECT_FALSE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end));
163 EXPECT_EQ(0, actual_start); 163 EXPECT_EQ(0, actual_start);
164 EXPECT_EQ(0, actual_end); 164 EXPECT_EQ(0, actual_end);
165 } 165 }
OLDNEW
« no previous file with comments | « chrome/installer/util/version.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698