#include "content/browser/media/forwarding_audio_stream_factory.h"
#include <memory>
#include <tuple>
#include <utility>
#include "base/containers/queue.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/mock_callback.h"
#include "base/unguessable_token.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
#include "media/base/audio_parameters.h"
#include "media/mojo/mojom/audio_output_stream.mojom.h"
#include "media/mojo/mojom/audio_processing.mojom.h"
#include "media/mojo/mojom/audio_stream_factory.mojom.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/audio/public/cpp/fake_stream_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/media/renderer_audio_input_stream_factory.mojom.h"
InSequence;
Mock;
NotNull;
StrictMock;
Test;
namespace content {
namespace {
AudioProcessingConfigPtr;
class MockStreamFactory final : public audio::FakeStreamFactory,
public media::mojom::LocalMuter { … };
class MockBroker : public AudioStreamBroker { … };
class MockBrokerFactory final : public AudioStreamBrokerFactory { … };
class MockLoopbackSink : public AudioStreamBroker::LoopbackSink { … };
class ForwardingAudioStreamFactoryTest : public RenderViewHostTestHarness { … };
const char ForwardingAudioStreamFactoryTest::kInputDeviceId[] = …;
const char ForwardingAudioStreamFactoryTest::kOutputDeviceId[] = …;
const media::AudioParameters ForwardingAudioStreamFactoryTest::kParams = …;
const uint32_t ForwardingAudioStreamFactoryTest::kSharedMemoryCount = …;
const bool ForwardingAudioStreamFactoryTest::kEnableAgc = …;
const bool kMuteSource = …;
}
TEST_F(ForwardingAudioStreamFactoryTest, CreateInputStream_CreatesInputStream) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
CreateLoopbackStream_CreatesLoopbackStream) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
CreateOutputStream_CreatesOutputStream) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
InputBrokerDeleterCalled_DestroysInputStream) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
LoopbackBrokerDeleterCalled_DestroysInputStream) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
OutputBrokerDeleterCalled_DestroysOutputStream) { … }
TEST_F(ForwardingAudioStreamFactoryTest, DestroyFrame_DestroysRelatedStreams) { … }
TEST_F(ForwardingAudioStreamFactoryTest, DestroyWebContents_DestroysStreams) { … }
TEST_F(ForwardingAudioStreamFactoryTest, LastStreamDeleted_ClearsFactoryPtr) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
MuteNoOutputStreams_DoesNotConnectMuter) { … }
TEST_F(ForwardingAudioStreamFactoryTest, MuteWithOutputStream_ConnectsMuter) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
WhenMuting_ConnectedWhenOutputStreamExists) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
WhenMuting_AddRemoveSecondStream_DoesNotChangeMuting) { … }
TEST_F(ForwardingAudioStreamFactoryTest,
Destruction_CallsOnSourceGoneOnRegisteredLoopbackSinks) { … }
}