chromium/content/browser/media/audio_stream_monitor_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/media/audio_stream_monitor.h"

#include <map>
#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/invalidate_type.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "media/base/audio_power_monitor.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_test_helper.h"
#endif

InvokeWithoutArgs;

namespace content {

namespace {

const GlobalRenderFrameHostId kRenderFrameHostId =;
const GlobalRenderFrameHostId kRenderFrameHostIdSameProcess =;
const GlobalRenderFrameHostId kRenderFrameHostIdOtherProcess =;
const int kStreamId =;
const int kAnotherStreamId =;

// Used to confirm audio indicator state changes occur at the correct times.
class MockWebContentsDelegate : public WebContentsDelegate {};

}  // namespace

class AudioStreamMonitorTest : public RenderViewHostTestHarness {};

TEST_F(AudioStreamMonitorTest, MonitorsWhenProvidedAStream) {}

// Tests that AudioStreamMonitor keeps the indicator on for the holding period
// even if there is silence during the holding period.
// See comments in audio_stream_monitor.h for expected behavior.
TEST_F(AudioStreamMonitorTest, IndicatorIsOnUntilHoldingPeriodHasPassed) {}

// Tests that the AudioStreamMonitor correctly processes updates from two
// different streams in the same tab.
TEST_F(AudioStreamMonitorTest, HandlesMultipleStreamUpdate) {}

TEST_F(AudioStreamMonitorTest, MultipleRendererProcesses) {}

TEST_F(AudioStreamMonitorTest, RenderProcessGone) {}

TEST_F(AudioStreamMonitorTest, RenderFrameGone) {}

TEST_F(AudioStreamMonitorTest, OneAudibleClient) {}

TEST_F(AudioStreamMonitorTest, MultipleAudibleClients) {}

TEST_F(AudioStreamMonitorTest, MultipleAudibleClientsMultipleRenderFrames) {}

TEST_F(AudioStreamMonitorTest, AudibleClientAndStream) {}

}  // namespace content