chromium/third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_input_test.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_input.h"

#include <stddef.h>
#include <memory>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "media/base/audio_latency.h"
#include "media/base/fake_audio_render_callback.h"
#include "media/base/mock_audio_renderer_sink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/modules/media/audio/audio_renderer_mixer.h"
#include "third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_pool.h"

_;

namespace blink {

constexpr int kSampleRate =;
constexpr int kBufferSize =;
constexpr media::ChannelLayout kChannelLayout =;
constexpr char kDefaultDeviceId[] =;
constexpr char kAnotherDeviceId[] =;
constexpr char kUnauthorizedDeviceId[] =;
constexpr char kNonexistentDeviceId[] =;

class AudioRendererMixerInputTest : public testing::Test,
                                    public AudioRendererMixerPool {};

// Test that getting and setting the volume work as expected.  The volume is
// returned from ProvideInput() only when playing.
TEST_F(AudioRendererMixerInputTest, GetSetVolume) {}

// Test Start()/Play()/Pause()/Stop()/playing() all work as expected.  Also
// implicitly tests that AddMixerInput() and RemoveMixerInput() work without
// crashing; functional tests for these methods are in AudioRendererMixerTest.
TEST_F(AudioRendererMixerInputTest, StartPlayPauseStopPlaying) {}

// Test that Stop() can be called before Initialize() and Start().
TEST_F(AudioRendererMixerInputTest, StopBeforeInitializeOrStart) {}

// Test that Start() can be called after Stop().
TEST_F(AudioRendererMixerInputTest, StartAfterStop) {}

// Test that Initialize() can be called again after Stop().
TEST_F(AudioRendererMixerInputTest, InitializeAfterStop) {}

// Test SwitchOutputDevice().
TEST_F(AudioRendererMixerInputTest, SwitchOutputDevice) {}

// Test SwitchOutputDevice() to the same device as the current (default) device
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceToSameDevice) {}

// Test SwitchOutputDevice() to the new device
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceToAnotherDevice) {}

// Test that SwitchOutputDevice() to a nonexistent device fails.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceToNonexistentDevice) {}

// Test that SwitchOutputDevice() to an unauthorized device fails.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceToUnauthorizedDevice) {}

// Test that calling SwitchOutputDevice() before Start() succeeds.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceBeforeStart) {}

// Test that calling SwitchOutputDevice() succeeds even if Start() is never
// called.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceWithoutStart) {}

// Test that calling SwitchOutputDevice() works after calling Stop(), and that
// restarting works after the call to SwitchOutputDevice().
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceAfterStopBeforeRestart) {}

// Test that calling SwitchOutputDevice() works before calling Initialize(),
// and that initialization and restart work after the call to
// SwitchOutputDevice().
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceBeforeInitialize) {}

// Test that calling SwitchOutputDevice() before
// GetOutputDeviceInfoAsync() works correctly.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceBeforeGODIA) {}

// Test that calling SwitchOutputDevice() during an ongoing
// GetOutputDeviceInfoAsync() call works correctly.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceDuringGODIA) {}

// Test that calling GetOutputDeviceInfoAsync() during an ongoing
// SwitchOutputDevice() call works correctly.
TEST_F(AudioRendererMixerInputTest, GODIADuringSwitchOutputDevice) {}

// Test that calling GetOutputDeviceInfoAsync() during an ongoing
// SwitchOutputDevice() call which eventually fails works correctly.
TEST_F(AudioRendererMixerInputTest, GODIADuringSwitchOutputDeviceWhichFails) {}

// Test that calling SwitchOutputDevice() with an empty device id does nothing
// when we're already on the default device.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceEmptyDeviceId) {}

}  // namespace blink