#include "content/renderer/media/renderer_webaudiodevice_impl.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "media/base/audio_capturer_source.h"
#include "media/base/audio_glitch_info.h"
#include "media/base/limits.h"
#include "media/base/mock_audio_renderer_sink.h"
#include "media/base/output_device_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/web/modules/media/audio/audio_device_factory.h"
_;
InSequence;
namespace content {
namespace {
class MockAudioRendererSink : public media::AudioRendererSink { … };
constexpr int kHardwareSampleRate = …;
constexpr int kHardwareBufferSize = …;
const blink::LocalFrameToken kFrameToken;
const media::OutputDeviceInfo kHealthyDevice(
media::OutputDeviceStatus::OUTPUT_DEVICE_STATUS_OK);
const media::OutputDeviceInfo kErrorDevice(
media::OutputDeviceStatus::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL);
media::AudioParameters MockGetOutputDeviceParameters(
const blink::LocalFrameToken& frame_token,
const std::string& device_id) { … }
class RendererWebAudioDeviceImplUnderTest : public RendererWebAudioDeviceImpl { … };
}
class RendererWebAudioDeviceImplTest
: public media::AudioRendererSink::RenderCallback,
public blink::AudioDeviceFactory,
public testing::Test { … };
TEST_F(RendererWebAudioDeviceImplTest, ChannelLayout) { … }
TEST_F(RendererWebAudioDeviceImplTest, TestLatencyHintValues) { … }
TEST_F(RendererWebAudioDeviceImplTest, NullSink_RenderWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest, NullSink_PauseResumeWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest,
NullSink_StartRenderStopStartRenderStopWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest, NullSink_RepeatedStartWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest, NullSink_RepeatedPauseWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest, NullSink_RepeatedResumeWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest, NullSink_RepeatedStopWorks) { … }
TEST_F(RendererWebAudioDeviceImplTest,
CreateSinkAndGetDeviceStatus_HealthyDevice) { … }
TEST_F(RendererWebAudioDeviceImplTest,
CreateSinkAndGetDeviceStatus_ErrorDevice) { … }
TEST_F(RendererWebAudioDeviceImplTest,
CreateSinkAndGetDeviceStatus_SilentSink) { … }
}