| 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" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 base::File file( | 68 base::File file( |
| 69 chrome::spellcheck_common::GetVersionedFileName(language, | 69 chrome::spellcheck_common::GetVersionedFileName(language, |
| 70 hunspell_directory), | 70 hunspell_directory), |
| 71 base::File::FLAG_OPEN | base::File::FLAG_READ); | 71 base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 72 #if defined(OS_MACOSX) | 72 #if defined(OS_MACOSX) |
| 73 // TODO(groby): Forcing spellcheck to use hunspell, even on OSX. | 73 // TODO(groby): Forcing spellcheck to use hunspell, even on OSX. |
| 74 // Instead, tests should exercise individual spelling engines. | 74 // Instead, tests should exercise individual spelling engines. |
| 75 spell_check_->languages_.push_back(new SpellcheckLanguage()); | 75 spell_check_->languages_.push_back(new SpellcheckLanguage()); |
| 76 spell_check_->languages_.front()->platform_spelling_engine_.reset( | 76 spell_check_->languages_.front()->platform_spelling_engine_.reset( |
| 77 new HunspellEngine); | 77 new HunspellEngine); |
| 78 spell_check_->languages_.front()->Init(file.Pass(), language); | 78 spell_check_->languages_.front()->Init(std::move(file), language); |
| 79 #else | 79 #else |
| 80 spell_check_->AddSpellcheckLanguage(std::move(file), language); | 80 spell_check_->AddSpellcheckLanguage(std::move(file), language); |
| 81 #endif | 81 #endif |
| 82 } | 82 } |
| 83 | 83 |
| 84 ~SpellCheckTest() override {} | 84 ~SpellCheckTest() override {} |
| 85 | 85 |
| 86 SpellCheck* spell_check() { return spell_check_.get(); } | 86 SpellCheck* spell_check() { return spell_check_.get(); } |
| 87 | 87 |
| 88 bool CheckSpelling(const std::string& word, int tag) { | 88 bool CheckSpelling(const std::string& word, int tag) { |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 // to be updated accordingly. | 1550 // to be updated accordingly. |
| 1551 ASSERT_EQ(5, chrome::spellcheck_common::kMaxSuggestions); | 1551 ASSERT_EQ(5, chrome::spellcheck_common::kMaxSuggestions); |
| 1552 FillSuggestions(suggestions_list, &suggestion_results); | 1552 FillSuggestions(suggestions_list, &suggestion_results); |
| 1553 ASSERT_EQ(5U, suggestion_results.size()); | 1553 ASSERT_EQ(5U, suggestion_results.size()); |
| 1554 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); | 1554 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); |
| 1555 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); | 1555 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); |
| 1556 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); | 1556 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); |
| 1557 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); | 1557 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); |
| 1558 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); | 1558 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); |
| 1559 } | 1559 } |
| OLD | NEW |