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/file_util.h" | 5 #include "base/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" |
11 #include "chrome/common/spellcheck_common.h" | 11 #include "chrome/common/spellcheck_common.h" |
12 #include "chrome/common/spellcheck_result.h" | 12 #include "chrome/common/spellcheck_result.h" |
13 #include "chrome/renderer/spellchecker/hunspell_engine.h" | 13 #include "chrome/renderer/spellchecker/hunspell_engine.h" |
14 #include "chrome/renderer/spellchecker/spellcheck.h" | 14 #include "chrome/renderer/spellchecker/spellcheck.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 16 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
17 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 17 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
18 #include "ui/base/l10n/l10n_util.h" | |
19 | 18 |
20 namespace { | 19 namespace { |
21 | 20 |
22 base::FilePath GetHunspellDirectory() { | 21 base::FilePath GetHunspellDirectory() { |
23 base::FilePath hunspell_directory; | 22 base::FilePath hunspell_directory; |
24 if (!PathService::Get(base::DIR_SOURCE_ROOT, &hunspell_directory)) | 23 if (!PathService::Get(base::DIR_SOURCE_ROOT, &hunspell_directory)) |
25 return base::FilePath(); | 24 return base::FilePath(); |
26 | 25 |
27 hunspell_directory = hunspell_directory.AppendASCII("third_party"); | 26 hunspell_directory = hunspell_directory.AppendASCII("third_party"); |
28 hunspell_directory = hunspell_directory.AppendASCII("hunspell_dictionaries"); | 27 hunspell_directory = hunspell_directory.AppendASCII("hunspell_dictionaries"); |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 strlen(kTestCases[i].misspelled), | 1365 strlen(kTestCases[i].misspelled), |
1367 0, | 1366 0, |
1368 &misspelling_start, | 1367 &misspelling_start, |
1369 &misspelling_length, | 1368 &misspelling_length, |
1370 &suggestions)); | 1369 &suggestions)); |
1371 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); | 1370 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); |
1372 if (suggestions.size() > 0) | 1371 if (suggestions.size() > 0) |
1373 EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); | 1372 EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); |
1374 } | 1373 } |
1375 } | 1374 } |
OLD | NEW |