#include "chrome/browser/content_settings/sound_content_setting_observer.h"
#include <memory>
#include <string>
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/recently_audible_helper.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/ukm/content/source_url_recorder.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/test/web_contents_tester.h"
#include "media/base/media_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/tabs/tab_utils.h"
#endif
namespace {
constexpr char kURL1[] = …;
constexpr char kURL2[] = …;
constexpr char kSiteMutedEvent[] = …;
constexpr char kSiteMutedReason[] = …;
#if !BUILDFLAG(IS_ANDROID)
constexpr char kChromeURL[] = …;
constexpr char kExtensionId[] = …;
#endif
}
class SoundContentSettingObserverTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(SoundContentSettingObserverTest, AudioMutingUpdatesWithContentSetting) { … }
TEST_F(SoundContentSettingObserverTest, AudioMutingUpdatesWithNavigation) { … }
#if !BUILDFLAG(IS_ANDROID)
TEST_F(SoundContentSettingObserverTest, DontMuteWhenUnmutedByExtension) { … }
TEST_F(SoundContentSettingObserverTest, DontUnmuteWhenMutedByExtension) { … }
TEST_F(SoundContentSettingObserverTest, DontUnmuteWhenMutedByAudioIndicator) { … }
TEST_F(SoundContentSettingObserverTest, DontUnmuteChromeTabWhenMuted) { … }
TEST_F(SoundContentSettingObserverTest,
UnmuteChromeTabWhenNavigatingToNonChromeUrl) { … }
TEST_F(SoundContentSettingObserverTest,
UnmuteNonChromeTabWhenNavigatingToChromeUrl) { … }
#endif
TEST_F(SoundContentSettingObserverTest,
UnmutedAudioPlayingDoesNotRecordSiteMuted) { … }
TEST_F(SoundContentSettingObserverTest, MutedAudioBlockedBySiteException) { … }
TEST_F(SoundContentSettingObserverTest,
MutingAudioWhileSoundIsPlayingBlocksSound) { … }
TEST_F(SoundContentSettingObserverTest, MuteByDefaultRecordsCorrectly) { … }
TEST_F(SoundContentSettingObserverTest,
MuteByDefaultAndExceptionRecordsException) { … }