Commit 9887ccc8 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Convert indirect uses of TestingFactoryFunction

TestingFactoryFunction is a simple function pointer. It is
deprecated in favor of TestingFactory which is a Callback<>.
Convert indirect uses by using base::BindRepeating() in all
invocation of SetTestingFactory/AddTestingFactory.

This converts uses in src//chrome/browser/spellchecker.

This CL was uploaded by git cl split.

R=groby@chromium.org

Bug: 809610
Change-Id: Idc50a6ffd6c25fa2c321c0d39f4fa62412581a64
Reviewed-on: https://chromium-review.googlesource.com/c/1258918Reviewed-by: default avatarRachel Blum <groby@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597048}
parent da8161d7
......@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
......@@ -73,7 +74,7 @@ class SpellcheckCustomDictionaryTest : public testing::Test {
void SetUp() override {
// Use SetTestingFactoryAndUse to force creation and initialization.
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile_, &BuildSpellcheckService);
&profile_, base::BindRepeating(&BuildSpellcheckService));
}
// A wrapper around SpellcheckCustomDictionary::LoadDictionaryFile private
......@@ -199,10 +200,9 @@ TEST_F(SpellcheckCustomDictionaryTest, MultiProfile) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -436,10 +436,9 @@ TEST_F(SpellcheckCustomDictionaryTest, MergeDataAndStartSyncing) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -502,7 +501,7 @@ TEST_F(SpellcheckCustomDictionaryTest, SyncBeforeLoadDoesNotDuplicateWords) {
SpellcheckCustomDictionary* custom_dictionary2 =
static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService))
&profile2, base::BindRepeating(&BuildSpellcheckService)))
->GetCustomDictionary();
std::unique_ptr<SpellcheckCustomDictionary::Change> change(
......@@ -551,10 +550,9 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigBeforeSyncing) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -596,10 +594,9 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigAndServerFull) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -650,10 +647,9 @@ TEST_F(SpellcheckCustomDictionaryTest, ServerTooBig) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -703,10 +699,9 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigToStartSyncing) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -751,10 +746,9 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigToContiueSyncing) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -804,10 +798,9 @@ TEST_F(SpellcheckCustomDictionaryTest, LoadAfterSyncStart) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -847,10 +840,9 @@ TEST_F(SpellcheckCustomDictionaryTest, LoadAfterSyncStartTooBigToSync) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -897,10 +889,9 @@ TEST_F(SpellcheckCustomDictionaryTest, LoadDuplicatesAfterSync) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -1012,10 +1003,9 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionarySyncNotification) {
SpellcheckCustomDictionary* custom_dictionary =
spellcheck_service->GetCustomDictionary();
TestingProfile profile2;
SpellcheckService* spellcheck_service2 =
static_cast<SpellcheckService*>(
SpellcheckService* spellcheck_service2 = static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&profile2, &BuildSpellcheckService));
&profile2, base::BindRepeating(&BuildSpellcheckService)));
SpellcheckCustomDictionary* custom_dictionary2 =
spellcheck_service2->GetCustomDictionary();
......@@ -1064,7 +1054,7 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionarySyncLimit) {
SpellcheckService* server_spellcheck_service =
static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&server_profile, &BuildSpellcheckService));
&server_profile, base::BindRepeating(&BuildSpellcheckService)));
// Here, |server_custom_dictionary| plays the role of the sync server.
SpellcheckCustomDictionary* server_custom_dictionary =
......@@ -1114,7 +1104,7 @@ TEST_F(SpellcheckCustomDictionaryTest, DictionarySyncLimit) {
SpellcheckService* client_spellcheck_service =
static_cast<SpellcheckService*>(
SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse(
&client_profile, &BuildSpellcheckService));
&client_profile, base::BindRepeating(&BuildSpellcheckService)));
// Here, |client_custom_dictionary| plays the role of the client.
SpellcheckCustomDictionary* client_custom_dictionary =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment