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

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

Issue 2658013002: Remove ScopedVector in components/spellcheck (Closed)
Patch Set: Remove ScopedVector in components/spellcheck Created 3 years, 11 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
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"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
17 #include "base/run_loop.h" 18 #include "base/run_loop.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "components/spellcheck/common/spellcheck_common.h" 22 #include "components/spellcheck/common/spellcheck_common.h"
22 #include "components/spellcheck/common/spellcheck_result.h" 23 #include "components/spellcheck/common/spellcheck_result.h"
23 #include "components/spellcheck/renderer/hunspell_engine.h" 24 #include "components/spellcheck/renderer/hunspell_engine.h"
24 #include "components/spellcheck/renderer/spellcheck_language.h" 25 #include "components/spellcheck/renderer/spellcheck_language.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 68
68 void InitializeSpellCheck(const std::string& language) { 69 void InitializeSpellCheck(const std::string& language) {
69 base::FilePath hunspell_directory = GetHunspellDirectory(); 70 base::FilePath hunspell_directory = GetHunspellDirectory();
70 EXPECT_FALSE(hunspell_directory.empty()); 71 EXPECT_FALSE(hunspell_directory.empty());
71 base::File file( 72 base::File file(
72 spellcheck::GetVersionedFileName(language, hunspell_directory), 73 spellcheck::GetVersionedFileName(language, hunspell_directory),
73 base::File::FLAG_OPEN | base::File::FLAG_READ); 74 base::File::FLAG_OPEN | base::File::FLAG_READ);
74 #if defined(OS_MACOSX) 75 #if defined(OS_MACOSX)
75 // TODO(groby): Forcing spellcheck to use hunspell, even on OSX. 76 // TODO(groby): Forcing spellcheck to use hunspell, even on OSX.
76 // Instead, tests should exercise individual spelling engines. 77 // Instead, tests should exercise individual spelling engines.
77 spell_check_->languages_.push_back(new SpellcheckLanguage()); 78 spell_check_->languages_.push_back(base::MakeUnique<SpellcheckLanguage>());
78 spell_check_->languages_.front()->platform_spelling_engine_.reset( 79 spell_check_->languages_.front()->platform_spelling_engine_.reset(
79 new HunspellEngine); 80 new HunspellEngine);
80 spell_check_->languages_.front()->Init(std::move(file), language); 81 spell_check_->languages_.front()->Init(std::move(file), language);
81 #else 82 #else
82 spell_check_->AddSpellcheckLanguage(std::move(file), language); 83 spell_check_->AddSpellcheckLanguage(std::move(file), language);
83 #endif 84 #endif
84 } 85 }
85 86
86 ~SpellCheckTest() override {} 87 ~SpellCheckTest() override {}
87 88
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 // to be updated accordingly. 1557 // to be updated accordingly.
1557 ASSERT_EQ(5, spellcheck::kMaxSuggestions); 1558 ASSERT_EQ(5, spellcheck::kMaxSuggestions);
1558 FillSuggestions(suggestions_list, &suggestion_results); 1559 FillSuggestions(suggestions_list, &suggestion_results);
1559 ASSERT_EQ(5U, suggestion_results.size()); 1560 ASSERT_EQ(5U, suggestion_results.size());
1560 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); 1561 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]);
1561 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); 1562 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]);
1562 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); 1563 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]);
1563 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); 1564 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]);
1564 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); 1565 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]);
1565 } 1566 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698