| 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 {L"\xFF28\xFF45\xFF4C\xFF4C\xFF4F", true}, | 193 {L"\xFF28\xFF45\xFF4C\xFF4C\xFF4F", true}, |
| 194 // Two valid Greek words (meaning "hello") consisting of seven Greek | 194 // Two valid Greek words (meaning "hello") consisting of seven Greek |
| 195 // letters | 195 // letters |
| 196 {L"\x03B3\x03B5\x03B9\x03AC" L" " L"\x03C3\x03BF\x03C5", true}, | 196 {L"\x03B3\x03B5\x03B9\x03AC" L" " L"\x03C3\x03BF\x03C5", true}, |
| 197 // A valid Russian word (meaning "hello") consisting of twelve Cyrillic | 197 // A valid Russian word (meaning "hello") consisting of twelve Cyrillic |
| 198 // letters | 198 // letters |
| 199 {L"\x0437\x0434\x0440\x0430\x0432\x0441" | 199 {L"\x0437\x0434\x0440\x0430\x0432\x0441" |
| 200 L"\x0442\x0432\x0443\x0439\x0442\x0435", true}, | 200 L"\x0442\x0432\x0443\x0439\x0442\x0435", true}, |
| 201 // A valid English contraction | 201 // A valid English contraction |
| 202 {L"isn't", true}, | 202 {L"isn't", true}, |
| 203 // A valid English contraction with a typographical apostrophe. |
| 204 {L"isn\x2019t", true}, |
| 203 // A valid English word enclosed with underscores. | 205 // A valid English word enclosed with underscores. |
| 204 {L"_hello_", true}, | 206 {L"_hello_", true}, |
| 205 | 207 |
| 206 // A valid English word with a preceding whitespace | 208 // A valid English word with a preceding whitespace |
| 207 {L" " L"hello", true}, | 209 {L" " L"hello", true}, |
| 208 // A valid English word with a preceding no-break space | 210 // A valid English word with a preceding no-break space |
| 209 {L"\xA0" L"hello", true}, | 211 {L"\xA0" L"hello", true}, |
| 210 // A valid English word with a preceding ideographic space | 212 // A valid English word with a preceding ideographic space |
| 211 {L"\x3000" L"hello", true}, | 213 {L"\x3000" L"hello", true}, |
| 212 // A valid English word with a preceding Chinese word | 214 // A valid English word with a preceding Chinese word |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 {L"ello", false, 0, 0, L"hello"}, | 416 {L"ello", false, 0, 0, L"hello"}, |
| 415 {L"ello", false, 0, 0, L"cello"}, | 417 {L"ello", false, 0, 0, L"cello"}, |
| 416 {L"wate", false, 0, 0, L"water"}, | 418 {L"wate", false, 0, 0, L"water"}, |
| 417 {L"wate", false, 0, 0, L"waste"}, | 419 {L"wate", false, 0, 0, L"waste"}, |
| 418 {L"wate", false, 0, 0, L"sate"}, | 420 {L"wate", false, 0, 0, L"sate"}, |
| 419 {L"wate", false, 0, 0, L"ate"}, | 421 {L"wate", false, 0, 0, L"ate"}, |
| 420 {L"jum", false, 0, 0, L"jump"}, | 422 {L"jum", false, 0, 0, L"jump"}, |
| 421 {L"jum", false, 0, 0, L"hum"}, | 423 {L"jum", false, 0, 0, L"hum"}, |
| 422 {L"jum", false, 0, 0, L"sum"}, | 424 {L"jum", false, 0, 0, L"sum"}, |
| 423 {L"jum", false, 0, 0, L"um"}, | 425 {L"jum", false, 0, 0, L"um"}, |
| 426 {L"alot", false, 0, 0, L"a lot"}, |
| 424 // A regression test for Issue 36523. | 427 // A regression test for Issue 36523. |
| 425 {L"privliged", false, 0, 0, L"privileged"}, | 428 {L"privliged", false, 0, 0, L"privileged"}, |
| 426 // TODO (Sidchat): add many more examples. | 429 // TODO (Sidchat): add many more examples. |
| 427 }; | 430 }; |
| 428 | 431 |
| 429 for (size_t i = 0; i < arraysize(kTestCases); ++i) { | 432 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| 430 std::vector<base::string16> suggestions; | 433 std::vector<base::string16> suggestions; |
| 431 size_t input_length = 0; | 434 size_t input_length = 0; |
| 432 if (kTestCases[i].input != NULL) { | 435 if (kTestCases[i].input != NULL) { |
| 433 input_length = wcslen(kTestCases[i].input); | 436 input_length = wcslen(kTestCases[i].input); |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 strlen(kTestCases[i].misspelled), | 1366 strlen(kTestCases[i].misspelled), |
| 1364 0, | 1367 0, |
| 1365 &misspelling_start, | 1368 &misspelling_start, |
| 1366 &misspelling_length, | 1369 &misspelling_length, |
| 1367 &suggestions)); | 1370 &suggestions)); |
| 1368 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); | 1371 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); |
| 1369 if (suggestions.size() > 0) | 1372 if (suggestions.size() > 0) |
| 1370 EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); | 1373 EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); |
| 1371 } | 1374 } |
| 1372 } | 1375 } |
| OLD | NEW |