| 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 "chrome/renderer/spellchecker/spellcheck.h" | 5 #include "chrome/renderer/spellchecker/spellcheck.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/common/spellcheck_common.h" | 18 #include "chrome/common/spellcheck_common.h" |
| 19 #include "chrome/common/spellcheck_result.h" | |
| 20 #include "chrome/renderer/spellchecker/hunspell_engine.h" | 19 #include "chrome/renderer/spellchecker/hunspell_engine.h" |
| 21 #include "chrome/renderer/spellchecker/spellcheck_language.h" | 20 #include "chrome/renderer/spellchecker/spellcheck_language.h" |
| 21 #include "components/spellcheck/common/spellcheck_result.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "third_party/WebKit/public/platform/WebVector.h" | 23 #include "third_party/WebKit/public/platform/WebVector.h" |
| 24 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 24 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
| 25 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 25 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
| 26 | 26 |
| 27 #define TYPOGRAPHICAL_APOSTROPHE L"\x2019" | 27 #define TYPOGRAPHICAL_APOSTROPHE L"\x2019" |
| 28 | 28 |
| 29 using spellcheck::SpellCheckResult; |
| 30 |
| 29 namespace { | 31 namespace { |
| 30 const int kNoOffset = 0; | 32 const int kNoOffset = 0; |
| 31 const int kNoTag = 0; | 33 const int kNoTag = 0; |
| 32 | 34 |
| 33 base::FilePath GetHunspellDirectory() { | 35 base::FilePath GetHunspellDirectory() { |
| 34 base::FilePath hunspell_directory; | 36 base::FilePath hunspell_directory; |
| 35 if (!PathService::Get(base::DIR_SOURCE_ROOT, &hunspell_directory)) | 37 if (!PathService::Get(base::DIR_SOURCE_ROOT, &hunspell_directory)) |
| 36 return base::FilePath(); | 38 return base::FilePath(); |
| 37 | 39 |
| 38 hunspell_directory = hunspell_directory.AppendASCII("third_party"); | 40 hunspell_directory = hunspell_directory.AppendASCII("third_party"); |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 // to be updated accordingly. | 1561 // to be updated accordingly. |
| 1560 ASSERT_EQ(5, chrome::spellcheck_common::kMaxSuggestions); | 1562 ASSERT_EQ(5, chrome::spellcheck_common::kMaxSuggestions); |
| 1561 FillSuggestions(suggestions_list, &suggestion_results); | 1563 FillSuggestions(suggestions_list, &suggestion_results); |
| 1562 ASSERT_EQ(5U, suggestion_results.size()); | 1564 ASSERT_EQ(5U, suggestion_results.size()); |
| 1563 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); | 1565 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); |
| 1564 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); | 1566 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); |
| 1565 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); | 1567 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); |
| 1566 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); | 1568 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); |
| 1567 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); | 1569 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); |
| 1568 } | 1570 } |
| OLD | NEW |