diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-20 13:40:20 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-22 12:41:23 +0000 |
commit | 7961cea6d1041e3e454dae6a1da660b453efd238 (patch) | |
tree | c0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/components/spellcheck | |
parent | b7034d0803538058e5c9d904ef03cf5eab34f6ef (diff) | |
download | qtwebengine-chromium-7961cea6d1041e3e454dae6a1da660b453efd238.tar.gz |
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/spellcheck')
13 files changed, 44 insertions, 57 deletions
diff --git a/chromium/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc b/chromium/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc index 9d030076080..df64b605f45 100644 --- a/chromium/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc +++ b/chromium/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc @@ -12,7 +12,7 @@ #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,7 +27,7 @@ class SpellcheckHostMetricsTest : public testing::Test { void RecordWordCountsForTesting() { metrics_->RecordWordCounts(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<SpellCheckHostMetrics> metrics_; }; diff --git a/chromium/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc b/chromium/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc index 155c2069d49..c671f3babde 100644 --- a/chromium/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc +++ b/chromium/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc @@ -12,7 +12,7 @@ #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "components/spellcheck/common/spellcheck_result.h" #include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -49,8 +49,8 @@ class SpellcheckPlatformMacTest: public testing::Test { base::Unretained(this))); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; spellcheck_platform::ScopedEnglishLanguageForTest scoped_language_; }; diff --git a/chromium/components/spellcheck/browser/spellcheck_platform_win.cc b/chromium/components/spellcheck/browser/spellcheck_platform_win.cc index 49cdd6d8acb..1ac94e7fa39 100644 --- a/chromium/components/spellcheck/browser/spellcheck_platform_win.cc +++ b/chromium/components/spellcheck/browser/spellcheck_platform_win.cc @@ -127,7 +127,7 @@ class WindowsSpellChecker { // used to post task to the background thread from main thread. scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_; - base::WeakPtrFactory<WindowsSpellChecker> weak_ptr_factory_; + base::WeakPtrFactory<WindowsSpellChecker> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(WindowsSpellChecker); }; @@ -136,8 +136,7 @@ WindowsSpellChecker::WindowsSpellChecker( const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, const scoped_refptr<base::SingleThreadTaskRunner> background_task_runner) : main_task_runner_(main_task_runner), - background_task_runner_(background_task_runner), - weak_ptr_factory_(this) { + background_task_runner_(background_task_runner) { background_task_runner_->PostTask( FROM_HERE, base::BindOnce( @@ -451,7 +450,8 @@ std::unique_ptr<WindowsSpellChecker>& GetWindowsSpellChecker() { static base::NoDestructor<std::unique_ptr<WindowsSpellChecker>> win_spell_checker(std::make_unique<WindowsSpellChecker>( base::ThreadTaskRunnerHandle::Get(), - base::CreateCOMSTATaskRunnerWithTraits({base::MayBlock()}))); + base::CreateCOMSTATaskRunner( + {base::ThreadPool(), base::MayBlock()}))); return *win_spell_checker; } } // anonymous namespace diff --git a/chromium/components/spellcheck/browser/spellcheck_platform_win_unittest.cc b/chromium/components/spellcheck/browser/spellcheck_platform_win_unittest.cc index cd71ff6c5a1..576f963c011 100644 --- a/chromium/components/spellcheck/browser/spellcheck_platform_win_unittest.cc +++ b/chromium/components/spellcheck/browser/spellcheck_platform_win_unittest.cc @@ -13,7 +13,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "base/win/windows_version.h" #include "components/spellcheck/common/spellcheck_features.h" #include "components/spellcheck/common/spellcheck_result.h" @@ -57,8 +57,8 @@ class SpellcheckPlatformWinTest : public testing::Test { std::vector<SpellCheckResult> spell_check_results_; base::OnceClosure quit_; - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; }; TEST_F(SpellcheckPlatformWinTest, SpellCheckSuggestions_EN_US) { diff --git a/chromium/components/spellcheck/browser/spelling_service_client.cc b/chromium/components/spellcheck/browser/spelling_service_client.cc index d41b5f74f31..4fc7f4a9902 100644 --- a/chromium/components/spellcheck/browser/spelling_service_client.cc +++ b/chromium/components/spellcheck/browser/spelling_service_client.cc @@ -167,7 +167,7 @@ bool SpellingServiceClient::RequestTextCheck( auto resource_request = std::make_unique<network::ResourceRequest>(); resource_request->url = BuildEndpointUrl(type); - resource_request->allow_credentials = false; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; resource_request->method = "POST"; std::unique_ptr<network::SimpleURLLoader> simple_url_loader = diff --git a/chromium/components/spellcheck/common/OWNERS b/chromium/components/spellcheck/common/OWNERS index 7f7ed5ec40d..3deee8cd9c3 100644 --- a/chromium/components/spellcheck/common/OWNERS +++ b/chromium/components/spellcheck/common/OWNERS @@ -2,7 +2,7 @@ per-file *_messages*.h=set noparent per-file *_messages*.h=file://ipc/SECURITY_OWNERS per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS diff --git a/chromium/components/spellcheck/common/spellcheck.typemap b/chromium/components/spellcheck/common/spellcheck.typemap index fa84bd42eaf..9b8732426e1 100644 --- a/chromium/components/spellcheck/common/spellcheck.typemap +++ b/chromium/components/spellcheck/common/spellcheck.typemap @@ -6,7 +6,7 @@ mojom = "//components/spellcheck/common/spellcheck.mojom" public_headers = [ "//components/spellcheck/common/spellcheck_result.h" ] -traits_headers = [ "//components/spellcheck/common/spellcheck_struct_traits.h" ] +traits_headers = [ "//components/spellcheck/common/spellcheck_mojom_traits.h" ] deps = [ "//components/spellcheck:buildflags", @@ -17,8 +17,8 @@ public_deps = [ ] sources = [ - "spellcheck_struct_traits.cc", - "spellcheck_struct_traits.h", + "spellcheck_mojom_traits.cc", + "spellcheck_mojom_traits.h", ] type_mappings = [ diff --git a/chromium/components/spellcheck/common/spellcheck_features.cc b/chromium/components/spellcheck/common/spellcheck_features.cc index 4462a2ac330..0bc03af8d4d 100644 --- a/chromium/components/spellcheck/common/spellcheck_features.cc +++ b/chromium/components/spellcheck/common/spellcheck_features.cc @@ -14,7 +14,7 @@ namespace spellcheck { #if BUILDFLAG(ENABLE_SPELLCHECK) const base::Feature kSpellingServiceRestApi{"SpellingServiceRestApi", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; #if defined(OS_WIN) const base::Feature kWinUseBrowserSpellChecker{ diff --git a/chromium/components/spellcheck/common/spellcheck_struct_traits.cc b/chromium/components/spellcheck/common/spellcheck_mojom_traits.cc index 2f0c4efc373..f935eaba654 100644 --- a/chromium/components/spellcheck/common/spellcheck_struct_traits.cc +++ b/chromium/components/spellcheck/common/spellcheck_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/spellcheck/common/spellcheck_struct_traits.h" +#include "components/spellcheck/common/spellcheck_mojom_traits.h" #include "mojo/public/cpp/base/string16_mojom_traits.h" diff --git a/chromium/components/spellcheck/common/spellcheck_struct_traits.h b/chromium/components/spellcheck/common/spellcheck_mojom_traits.h index cfdaa9e6dc9..6744c5ee804 100644 --- a/chromium/components/spellcheck/common/spellcheck_struct_traits.h +++ b/chromium/components/spellcheck/common/spellcheck_mojom_traits.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_STRUCT_TRAITS_H -#define COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_STRUCT_TRAITS_H +#ifndef COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MOJOM_TRAITS_H_ +#define COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MOJOM_TRAITS_H_ #include "components/spellcheck/common/spellcheck.mojom.h" #include "components/spellcheck/common/spellcheck_result.h" @@ -44,4 +44,4 @@ struct StructTraits<spellcheck::mojom::SpellCheckResultDataView, } // namespace mojo -#endif // COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_STRUCT_TRAITS_H +#endif // COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MOJOM_TRAITS_H_ diff --git a/chromium/components/spellcheck/renderer/empty_local_interface_provider.h b/chromium/components/spellcheck/renderer/empty_local_interface_provider.h index 9fe12c4d2d6..d861c9fed06 100644 --- a/chromium/components/spellcheck/renderer/empty_local_interface_provider.h +++ b/chromium/components/spellcheck/renderer/empty_local_interface_provider.h @@ -10,7 +10,7 @@ namespace spellcheck { // A dummy LocalInterfaceProvider that doesn't bind any remote application. -// May require a base::test::ScopedTaskEnvironment if GetInterface() is expected +// May require a base::test::TaskEnvironment if GetInterface() is expected // to be called. class EmptyLocalInterfaceProvider : public service_manager::LocalInterfaceProvider { diff --git a/chromium/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc b/chromium/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc index 62bbdace258..4c333abf366 100644 --- a/chromium/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc +++ b/chromium/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc @@ -14,7 +14,7 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "components/spellcheck/common/spellcheck_common.h" #include "components/spellcheck/common/spellcheck_result.h" #include "components/spellcheck/renderer/empty_local_interface_provider.h" @@ -114,7 +114,7 @@ class MultilingualSpellCheckTest : public testing::Test { } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; spellcheck::EmptyLocalInterfaceProvider embedder_provider_; // Owned by |provider_|. diff --git a/chromium/components/spellcheck/renderer/spellcheck_unittest.cc b/chromium/components/spellcheck/renderer/spellcheck_unittest.cc index 9160d9b3fe4..69f05fffb34 100644 --- a/chromium/components/spellcheck/renderer/spellcheck_unittest.cc +++ b/chromium/components/spellcheck/renderer/spellcheck_unittest.cc @@ -16,7 +16,7 @@ #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "build/build_config.h" #include "components/spellcheck/common/spellcheck_common.h" #include "components/spellcheck/common/spellcheck_result.h" @@ -70,9 +70,12 @@ class SpellCheckTest : public testing::Test { void InitializeSpellCheck(const std::string& language) { base::FilePath hunspell_directory = GetHunspellDirectory(); EXPECT_FALSE(hunspell_directory.empty()); - base::File file( - spellcheck::GetVersionedFileName(language, hunspell_directory), - base::File::FLAG_OPEN | base::File::FLAG_READ); + base::FilePath hunspell_file_path = + spellcheck::GetVersionedFileName(language, hunspell_directory); + base::File file(hunspell_file_path, + base::File::FLAG_OPEN | base::File::FLAG_READ); + EXPECT_TRUE(file.IsValid()) << hunspell_file_path << " is not valid" + << file.ErrorToString(file.GetLastFileError()); #if defined(OS_MACOSX) // TODO(groby): Forcing spellcheck to use hunspell, even on OSX. // Instead, tests should exercise individual spelling engines. @@ -127,7 +130,7 @@ class SpellCheckTest : public testing::Test { private: spellcheck::EmptyLocalInterfaceProvider embedder_provider_; std::unique_ptr<SpellCheck> spell_check_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; struct MockTextCheckingResult { @@ -1338,29 +1341,16 @@ TEST_F(SpellCheckTest, EnglishWords) { // Checks that NOSUGGEST works in English dictionaries. TEST_F(SpellCheckTest, NoSuggest) { + ReinitializeSpellCheck("xx-XX"); + static const struct { const char* input; const char* suggestion; - const char* locale; bool should_pass; - } kTestCases[] = { - {"suckerbert", "cocksucker", "en-GB", true}, - {"suckerbert", "cocksucker", "en-US", true}, - {"suckerbert", "cocksucker", "en-CA", true}, - {"suckerbert", "cocksucker", "en-AU", true}, - {"suckerbert", "cocksuckers", "en-GB", true}, - {"suckerbert", "cocksuckers", "en-US", true}, - {"suckerbert", "cocksuckers", "en-CA", true}, - {"suckerbert", "cocksuckers", "en-AU", true}, - {"Batasunaa", "Batasuna", "ca-ES", true}, - {"pornoo", "porno", "it-IT", true}, - {"catass", "catas", "lt-LT", true}, - {"kuracc", "kurac", "sl-SI", true}, - {"pittt", "pitt", "sv-SE", true}, - }; + } kTestCases[] = {{"typograpy", "typographit", true}, + {"typograpy", "typographits", true}}; for (const auto& test_case : kTestCases) { - ReinitializeSpellCheck(test_case.locale); size_t suggestion_length = 0; if (test_case.suggestion) suggestion_length = strlen(test_case.suggestion); @@ -1374,10 +1364,8 @@ TEST_F(SpellCheckTest, NoSuggest) { suggestion_length, kNoTag, &misspelling_start, &misspelling_length, nullptr); - EXPECT_EQ(test_case.should_pass, result) - << test_case.suggestion << " in " << test_case.locale; - // TODO(cb/673424): Bring this back when suggestions are sped up. -#if 0 + EXPECT_EQ(test_case.should_pass, result) << test_case.suggestion; + // Now verify that this test case does not show up as a suggestion. std::vector<base::string16> suggestions; size_t input_length = 0; @@ -1387,19 +1375,18 @@ TEST_F(SpellCheckTest, NoSuggest) { base::ASCIIToUTF16(test_case.input).c_str(), kNoOffset, input_length, kNoTag, &misspelling_start, &misspelling_length, &suggestions); + // Input word should be a misspelling. - EXPECT_FALSE(result) << test_case.input << " is not a misspelling in " - << test_case.locale; + EXPECT_FALSE(result) << test_case.input << " is not a misspelling"; + // Check if the suggested words occur. for (const base::string16& suggestion : suggestions) { for (const auto& test_case_to_check : kTestCases) { int compare_result = suggestion.compare( base::ASCIIToUTF16(test_case_to_check.suggestion)); - EXPECT_FALSE(compare_result == 0) - << test_case_to_check.suggestion << " in " << test_case.locale; + EXPECT_FALSE(compare_result == 0) << test_case_to_check.suggestion; } } -#endif } } |