Chromium Code Reviews| 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 "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1319 InitializeIfNeeded(); | 1319 InitializeIfNeeded(); |
| 1320 ASSERT_FALSE(InitializeIfNeeded()); | 1320 ASSERT_FALSE(InitializeIfNeeded()); |
| 1321 | 1321 |
| 1322 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { | 1322 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { |
| 1323 bool result = CheckSpelling(kTestCases[i].word, 0); | 1323 bool result = CheckSpelling(kTestCases[i].word, 0); |
| 1324 EXPECT_EQ(kTestCases[i].expected_result, result) << | 1324 EXPECT_EQ(kTestCases[i].expected_result, result) << |
| 1325 "Failed test for " << kTestCases[i].word; | 1325 "Failed test for " << kTestCases[i].word; |
| 1326 } | 1326 } |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 // Chrome should not suggest "Othello" for "hellllo" or "identically" for | |
| 1330 // "accidently". | |
| 1331 TEST_F(SpellCheckTest, LogicalSuggestions) { | |
|
groby-ooo-7-16
2013/02/27 00:51:29
Grumble. This should technically test hunspell, no
| |
| 1332 static const struct { | |
| 1333 const char* misspelled; | |
| 1334 const char* suggestion; | |
| 1335 } kTestCases[] = { | |
| 1336 { "hellllo", "hello" }, | |
| 1337 { "accidently", "accidentally" } | |
| 1338 }; | |
| 1339 | |
| 1340 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { | |
| 1341 int misspelling_start = 0; | |
| 1342 int misspelling_length = 0; | |
| 1343 std::vector<string16> suggestions; | |
| 1344 EXPECT_FALSE(spell_check()->SpellCheckWord( | |
| 1345 ASCIIToUTF16(kTestCases[i].misspelled).c_str(), | |
| 1346 strlen(kTestCases[i].misspelled), | |
| 1347 0, | |
| 1348 &misspelling_start, | |
| 1349 &misspelling_length, | |
| 1350 &suggestions)); | |
| 1351 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); | |
| 1352 if (suggestions.size() > 0) | |
| 1353 EXPECT_EQ(suggestions[0], ASCIIToUTF16(kTestCases[i].suggestion)); | |
| 1354 } | |
| 1355 } | |
| OLD | NEW |