0
Files
src/components/media_effects/media_effects_service_factory_unittest.cc
Bryant Chandler 2c84a6c039 [media_effects] Switch to user_prefs::TestBrowserContextWithPrefs
This deletes the local implementation and switches to a common
implementation.

Bug: 1479195
Change-Id: Ic6f1142f11d9a0c3b3e6acee79d34bd0822584c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4853185
Commit-Queue: Piotr Bialecki <bialpio@chromium.org>
Reviewed-by: Piotr Bialecki <bialpio@chromium.org>
Auto-Submit: Bryant Chandler <bryantchandler@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1196571}
2023-09-14 14:23:43 +00:00

43 lines
1.8 KiB
C++

// 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/media_effects_service_factory.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_;
user_prefs::TestBrowserContextWithPrefs profile1_;
user_prefs::TestBrowserContextWithPrefs profile2_;
};
TEST_F(MediaEffectsServiceFactoryTest,
GetForBrowserContext_SameProfileReturnsSameService) {
ASSERT_NE(&profile1_, &profile2_);
EXPECT_EQ(MediaEffectsServiceFactory::GetForBrowserContext(&profile1_),
MediaEffectsServiceFactory::GetForBrowserContext(&profile1_));
EXPECT_EQ(MediaEffectsServiceFactory::GetForBrowserContext(&profile2_),
MediaEffectsServiceFactory::GetForBrowserContext(&profile2_));
}
TEST_F(MediaEffectsServiceFactoryTest,
GetForBrowserContext_DifferentProfileReturnsDifferentService) {
ASSERT_NE(&profile1_, &profile2_);
EXPECT_NE(MediaEffectsServiceFactory::GetForBrowserContext(&profile1_),
MediaEffectsServiceFactory::GetForBrowserContext(&profile2_));
}
TEST_F(MediaEffectsServiceFactoryTest,
GetForBrowserContext_IncognitoProfileReturnsDifferentService) {
user_prefs::TestBrowserContextWithPrefs incognito_profile2;
incognito_profile2.set_is_off_the_record(true);
ASSERT_NE(&profile2_, &incognito_profile2);
EXPECT_NE(
MediaEffectsServiceFactory::GetForBrowserContext(&profile2_),
MediaEffectsServiceFactory::GetForBrowserContext(&incognito_profile2));
}