OLD | NEW |
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 <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/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 string16 actual_word; | 222 string16 actual_word; |
223 int actual_start, actual_end; | 223 int actual_start, actual_end; |
224 EXPECT_TRUE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end)); | 224 EXPECT_TRUE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end)); |
225 if (kTestCases[i].left_to_right) | 225 if (kTestCases[i].left_to_right) |
226 EXPECT_EQ(input_word, actual_word); | 226 EXPECT_EQ(input_word, actual_word); |
227 else | 227 else |
228 EXPECT_NE(input_word, actual_word); | 228 EXPECT_NE(input_word, actual_word); |
229 } | 229 } |
230 } | 230 } |
| 231 |
| 232 TEST(SpellcheckWordIteratorTest, Initialization) { |
| 233 // Test initialization works when a default language is set. |
| 234 { |
| 235 SpellcheckCharAttribute attributes; |
| 236 attributes.SetDefaultLanguage("en-US"); |
| 237 |
| 238 SpellcheckWordIterator iterator; |
| 239 EXPECT_TRUE(iterator.Initialize(&attributes, true)); |
| 240 } |
| 241 |
| 242 // Test initialization fails when no default language is set. |
| 243 { |
| 244 SpellcheckCharAttribute attributes; |
| 245 |
| 246 SpellcheckWordIterator iterator; |
| 247 EXPECT_FALSE(iterator.Initialize(&attributes, true)); |
| 248 } |
| 249 } |
OLD | NEW |