diff --git a/components/media_effects/BUILD.gn b/components/media_effects/BUILD.gn index 4afaad410937c..c7f2a0e1d1018 100644 --- a/components/media_effects/BUILD.gn +++ b/components/media_effects/BUILD.gn @@ -22,8 +22,8 @@ source_set("unit_tests") { deps = [ ":media_effects", "//base", - "//components/media_effects/test", "//components/prefs:test_support", + "//components/user_prefs/test:test_support", "//content/test:test_support", "//testing/gtest", ] diff --git a/components/media_effects/media_effects_service_factory_unittest.cc b/components/media_effects/media_effects_service_factory_unittest.cc index 01a6a46581061..296b6bdc4d73c 100644 --- a/components/media_effects/media_effects_service_factory_unittest.cc +++ b/components/media_effects/media_effects_service_factory_unittest.cc @@ -4,15 +4,15 @@ #include "components/media_effects/media_effects_service_factory.h" -#include "components/media_effects/test/test_browser_context_with_prefs.h" +#include "components/user_prefs/test/test_browser_context_with_prefs.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" class MediaEffectsServiceFactoryTest : public testing::Test { protected: content::BrowserTaskEnvironment task_environment_; - media_effects::TestBrowserContextWithPrefs profile1_; - media_effects::TestBrowserContextWithPrefs profile2_; + user_prefs::TestBrowserContextWithPrefs profile1_; + user_prefs::TestBrowserContextWithPrefs profile2_; }; TEST_F(MediaEffectsServiceFactoryTest, @@ -33,7 +33,7 @@ TEST_F(MediaEffectsServiceFactoryTest, TEST_F(MediaEffectsServiceFactoryTest, GetForBrowserContext_IncognitoProfileReturnsDifferentService) { - media_effects::TestBrowserContextWithPrefs incognito_profile2; + user_prefs::TestBrowserContextWithPrefs incognito_profile2; incognito_profile2.set_is_off_the_record(true); ASSERT_NE(&profile2_, &incognito_profile2); EXPECT_NE( diff --git a/components/media_effects/media_effects_service_unittest.cc b/components/media_effects/media_effects_service_unittest.cc index 6779002452733..93eb899438f82 100644 --- a/components/media_effects/media_effects_service_unittest.cc +++ b/components/media_effects/media_effects_service_unittest.cc @@ -6,10 +6,8 @@ #include "base/run_loop.h" #include "base/test/test_future.h" -#include "components/media_effects/test/test_browser_context_with_prefs.h" -#include "components/prefs/testing_pref_service.h" +#include "components/user_prefs/test/test_browser_context_with_prefs.h" #include "content/public/test/browser_task_environment.h" -#include "content/public/test/test_browser_context.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/insets_f.h" @@ -44,7 +42,7 @@ void SetFramingSync( class MediaEffectsServiceTest : public testing::Test { protected: content::BrowserTaskEnvironment task_environment_; - media_effects::TestBrowserContextWithPrefs browser_context_; + user_prefs::TestBrowserContextWithPrefs browser_context_; MediaEffectsService service_{browser_context_.prefs()}; }; diff --git a/components/media_effects/test/BUILD.gn b/components/media_effects/test/BUILD.gn deleted file mode 100644 index 3479beb8ad095..0000000000000 --- a/components/media_effects/test/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2023 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -source_set("test") { - testonly = true - - sources = [ - "test_browser_context_with_prefs.cc", - "test_browser_context_with_prefs.h", - ] - - deps = [ - "//components/keyed_service/content", - "//components/prefs:test_support", - "//components/user_prefs:user_prefs", - "//content/test:test_support", - ] -} diff --git a/components/media_effects/test/test_browser_context_with_prefs.cc b/components/media_effects/test/test_browser_context_with_prefs.cc deleted file mode 100644 index b477ab78fde11..0000000000000 --- a/components/media_effects/test/test_browser_context_with_prefs.cc +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/media_effects/test/test_browser_context_with_prefs.h" - -#include "components/user_prefs/user_prefs.h" - -namespace media_effects { - -TestBrowserContextWithPrefs::TestBrowserContextWithPrefs() - : browser_context_dependency_manager_( - BrowserContextDependencyManager::GetInstance()) { - browser_context_dependency_manager_->MarkBrowserContextLive(this); - user_prefs::UserPrefs::Set(this, &prefs_); -} - -TestBrowserContextWithPrefs::~TestBrowserContextWithPrefs() { - browser_context_dependency_manager_->DestroyBrowserContextServices(this); -} - -} // namespace media_effects diff --git a/components/media_effects/test/test_browser_context_with_prefs.h b/components/media_effects/test/test_browser_context_with_prefs.h deleted file mode 100644 index 694d6d2314999..0000000000000 --- a/components/media_effects/test/test_browser_context_with_prefs.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_MEDIA_EFFECTS_TEST_TEST_BROWSER_CONTEXT_WITH_PREFS_H_ -#define COMPONENTS_MEDIA_EFFECTS_TEST_TEST_BROWSER_CONTEXT_WITH_PREFS_H_ - -#include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "components/prefs/testing_pref_service.h" -#include "content/public/test/test_browser_context.h" - -namespace media_effects { - -// TODO(crbug.com/1479195): Find a more re-usable place for this to live. -class TestBrowserContextWithPrefs : public content::TestBrowserContext { - public: - TestBrowserContextWithPrefs(); - - TestBrowserContextWithPrefs(const TestBrowserContextWithPrefs&) = delete; - TestBrowserContextWithPrefs& operator=(const TestBrowserContextWithPrefs&) = - delete; - - ~TestBrowserContextWithPrefs() override; - - PrefService* prefs() { return &prefs_; } - PrefRegistrySimple* pref_registry() { return prefs_.registry(); } - - private: - const raw_ptr<BrowserContextDependencyManager> - browser_context_dependency_manager_; - TestingPrefServiceSimple prefs_; -}; - -} // namespace media_effects - -#endif // COMPONENTS_MEDIA_EFFECTS_TEST_TEST_BROWSER_CONTEXT_WITH_PREFS_H_