diff --git a/browser/brave_rewards/rewards_service_factory.cc b/browser/brave_rewards/rewards_service_factory.cc index 2c0cec44bc67..764184330fb6 100644 --- a/browser/brave_rewards/rewards_service_factory.cc +++ b/browser/brave_rewards/rewards_service_factory.cc @@ -84,11 +84,6 @@ KeyedService* RewardsServiceFactory::BuildServiceInstanceFor( notification_observer = std::make_unique(profile); #endif - auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForContext(context); - auto* storage_partition = profile->GetDefaultStoragePartition(); - auto* bitmap_fetcher_service = - BitmapFetcherServiceFactory::GetForBrowserContext(profile); // Set up the rewards data source content::URLDataSource::Add(profile, std::make_unique(profile)); @@ -96,11 +91,12 @@ KeyedService* RewardsServiceFactory::BuildServiceInstanceFor( profile->GetPrefs(), profile->GetPath(), FaviconServiceFactory::GetForProfile(profile, ServiceAccessType::EXPLICIT_ACCESS), - bitmap_fetcher_service, storage_partition, + BitmapFetcherServiceFactory::GetForBrowserContext(profile), + profile->GetDefaultStoragePartition(), #if BUILDFLAG(ENABLE_GREASELION) greaselion::GreaselionServiceFactory::GetForBrowserContext(context), #endif - brave_wallet_service)); + brave_wallet::BraveWalletServiceFactory::GetServiceForContext(context))); rewards_service->Init(std::move(extension_observer), std::move(notification_observer)); return rewards_service.release(); diff --git a/components/brave_rewards/browser/rewards_protocol_navigation_throttle_unittest.cc b/components/brave_rewards/browser/rewards_protocol_navigation_throttle_unittest.cc index bb3479c8d0bf..3e4bf86a82bd 100644 --- a/components/brave_rewards/browser/rewards_protocol_navigation_throttle_unittest.cc +++ b/components/brave_rewards/browser/rewards_protocol_navigation_throttle_unittest.cc @@ -8,8 +8,8 @@ #include #include -#include "brave/components/brave_rewards/browser/rewards_protocol_navigation_throttle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" // clang-format off // npm run test -- brave_unit_tests --filter="*RewardsProtocolNavigationThrottleTest*" diff --git a/components/brave_rewards/browser/rewards_service_impl_jp_unittest.cc b/components/brave_rewards/browser/rewards_service_impl_jp_unittest.cc index c456cce55ef7..dd375f78af42 100644 --- a/components/brave_rewards/browser/rewards_service_impl_jp_unittest.cc +++ b/components/brave_rewards/browser/rewards_service_impl_jp_unittest.cc @@ -3,23 +3,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include - #include "base/files/scoped_temp_dir.h" -#include "base/memory/ptr_util.h" -#include "base/memory/raw_ptr.h" #include "base/test/scoped_feature_list.h" #include "brave/browser/brave_rewards/rewards_service_factory.h" #include "brave/components/brave_rewards/browser/rewards_service_impl.h" -#include "brave/components/brave_rewards/browser/rewards_service_observer.h" #include "brave/components/brave_rewards/browser/test_util.h" #include "brave/components/brave_rewards/common/features.h" -#include "brave/components/brave_rewards/common/mojom/rewards.mojom.h" #include "brave/components/brave_rewards/common/pref_names.h" -#include "brave/components/brave_rewards/common/rewards_flags.h" #include "brave/components/brave_rewards/core/global_constants.h" #include "brave/components/greaselion/browser/buildflags/buildflags.h" #include "brave/components/l10n/common/test/scoped_default_locale.h" +#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" +#include "chrome/browser/favicon/favicon_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/test/base/testing_browser_process.h" #include "components/prefs/pref_service.h" @@ -46,12 +41,16 @@ class RewardsServiceJPTest : public testing::Test { std::make_unique("ja_JP"); profile_ = CreateBraveRewardsProfile(temp_dir_.GetPath()); ASSERT_TRUE(profile_); + rewards_service_ = std::make_unique( + profile()->GetPrefs(), profile()->GetPath(), + FaviconServiceFactory::GetForProfile( + profile(), ServiceAccessType::EXPLICIT_ACCESS), + BitmapFetcherServiceFactory::GetForBrowserContext(profile()), + profile()->GetDefaultStoragePartition(), #if BUILDFLAG(ENABLE_GREASELION) - rewards_service_ = - std::make_unique(profile(), nullptr, nullptr); -#else - rewards_service_ = std::make_unique(profile(), nullptr); + nullptr, #endif + nullptr); ASSERT_TRUE(rewards_service()); profile()->GetPrefs()->SetString(prefs::kDeclaredGeo, "JP"); diff --git a/components/brave_rewards/browser/rewards_service_impl_unittest.cc b/components/brave_rewards/browser/rewards_service_impl_unittest.cc index feb5526f77ea..a65a55e6ee9e 100644 --- a/components/brave_rewards/browser/rewards_service_impl_unittest.cc +++ b/components/brave_rewards/browser/rewards_service_impl_unittest.cc @@ -3,15 +3,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include "brave/components/brave_rewards/browser/rewards_service_impl.h" + #include #include "base/files/scoped_temp_dir.h" -#include "base/memory/ptr_util.h" -#include "base/memory/raw_ptr.h" #include "base/test/scoped_feature_list.h" #include "brave/browser/brave_rewards/rewards_service_factory.h" -#include "brave/components/brave_rewards/browser/rewards_service_impl.h" #include "brave/components/brave_rewards/browser/rewards_service_observer.h" #include "brave/components/brave_rewards/browser/test_util.h" #include "brave/components/brave_rewards/common/features.h" @@ -20,6 +18,8 @@ #include "brave/components/brave_rewards/core/global_constants.h" #include "brave/components/greaselion/browser/buildflags/buildflags.h" #include "brave/components/l10n/common/test/scoped_default_locale.h" +#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" +#include "chrome/browser/favicon/favicon_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/test/base/testing_browser_process.h" #include "components/prefs/pref_service.h" @@ -67,12 +67,17 @@ class RewardsServiceTest : public testing::Test { std::make_unique("en_US"); profile_ = CreateBraveRewardsProfile(temp_dir_.GetPath()); ASSERT_TRUE(profile_.get()); + + rewards_service_ = std::make_unique( + profile()->GetPrefs(), profile()->GetPath(), + FaviconServiceFactory::GetForProfile( + profile(), ServiceAccessType::EXPLICIT_ACCESS), + BitmapFetcherServiceFactory::GetForBrowserContext(profile()), + profile()->GetDefaultStoragePartition(), #if BUILDFLAG(ENABLE_GREASELION) - rewards_service_ = - std::make_unique(profile(), nullptr, nullptr); -#else - rewards_service_ = std::make_unique(profile(), nullptr); + nullptr, #endif + nullptr); ASSERT_TRUE(rewards_service()); observer_ = std::make_unique(); rewards_service_->AddObserver(observer_.get());