Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: components/spellcheck/renderer/spellcheck_unittest.cc

Issue 2671263003: Merge 3004: Revert of Remove ScopedVector in components/spellcheck (patchset #5 id:80001 of https:/… (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/spellcheck/renderer/spellcheck_provider_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/spellcheck/renderer/spellcheck.h" 5 #include "components/spellcheck/renderer/spellcheck.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h"
16 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
17 #include "base/path_service.h" 16 #include "base/path_service.h"
18 #include "base/run_loop.h" 17 #include "base/run_loop.h"
19 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
21 #include "build/build_config.h" 20 #include "build/build_config.h"
22 #include "components/spellcheck/common/spellcheck_common.h" 21 #include "components/spellcheck/common/spellcheck_common.h"
23 #include "components/spellcheck/common/spellcheck_result.h" 22 #include "components/spellcheck/common/spellcheck_result.h"
24 #include "components/spellcheck/renderer/hunspell_engine.h" 23 #include "components/spellcheck/renderer/hunspell_engine.h"
25 #include "components/spellcheck/renderer/spellcheck_language.h" 24 #include "components/spellcheck/renderer/spellcheck_language.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 67
69 void InitializeSpellCheck(const std::string& language) { 68 void InitializeSpellCheck(const std::string& language) {
70 base::FilePath hunspell_directory = GetHunspellDirectory(); 69 base::FilePath hunspell_directory = GetHunspellDirectory();
71 EXPECT_FALSE(hunspell_directory.empty()); 70 EXPECT_FALSE(hunspell_directory.empty());
72 base::File file( 71 base::File file(
73 spellcheck::GetVersionedFileName(language, hunspell_directory), 72 spellcheck::GetVersionedFileName(language, hunspell_directory),
74 base::File::FLAG_OPEN | base::File::FLAG_READ); 73 base::File::FLAG_OPEN | base::File::FLAG_READ);
75 #if defined(OS_MACOSX) 74 #if defined(OS_MACOSX)
76 // TODO(groby): Forcing spellcheck to use hunspell, even on OSX. 75 // TODO(groby): Forcing spellcheck to use hunspell, even on OSX.
77 // Instead, tests should exercise individual spelling engines. 76 // Instead, tests should exercise individual spelling engines.
78 spell_check_->languages_.push_back(base::MakeUnique<SpellcheckLanguage>()); 77 spell_check_->languages_.push_back(new SpellcheckLanguage());
79 spell_check_->languages_.front()->platform_spelling_engine_.reset( 78 spell_check_->languages_.front()->platform_spelling_engine_.reset(
80 new HunspellEngine); 79 new HunspellEngine);
81 spell_check_->languages_.front()->Init(std::move(file), language); 80 spell_check_->languages_.front()->Init(std::move(file), language);
82 #else 81 #else
83 spell_check_->AddSpellcheckLanguage(std::move(file), language); 82 spell_check_->AddSpellcheckLanguage(std::move(file), language);
84 #endif 83 #endif
85 } 84 }
86 85
87 ~SpellCheckTest() override {} 86 ~SpellCheckTest() override {}
88 87
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 // to be updated accordingly. 1556 // to be updated accordingly.
1558 ASSERT_EQ(5, spellcheck::kMaxSuggestions); 1557 ASSERT_EQ(5, spellcheck::kMaxSuggestions);
1559 FillSuggestions(suggestions_list, &suggestion_results); 1558 FillSuggestions(suggestions_list, &suggestion_results);
1560 ASSERT_EQ(5U, suggestion_results.size()); 1559 ASSERT_EQ(5U, suggestion_results.size());
1561 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); 1560 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]);
1562 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); 1561 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]);
1563 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); 1562 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]);
1564 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); 1563 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]);
1565 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); 1564 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]);
1566 } 1565 }
OLDNEW
« no previous file with comments | « components/spellcheck/renderer/spellcheck_provider_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698