#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/client/audio/audio_player.h"
#include <cstdint>
#include <memory>
#include "base/compiler_specific.h"
#include "base/functional/callback.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const int kAudioSamplesPerFrame = …;
const int kAudioSampleBytes = …;
const int kAudioFrameBytes = …;
const int kPaddingBytes = …;
const uint8_t kDefaultBufferData = …;
const uint8_t kDummyAudioData = …;
}
namespace remoting {
class FakeAudioPlayer : public AudioPlayer { … };
class AudioPlayerTest : public ::testing::Test { … };
std::unique_ptr<AudioPacket> CreatePacketWithSamplingRate(
AudioPacket::SamplingRate rate,
int samples) { … }
std::unique_ptr<AudioPacket> CreatePacket44100Hz(int samples) { … }
std::unique_ptr<AudioPacket> CreatePacket48000Hz(int samples) { … }
TEST_F(AudioPlayerTest, Init) { … }
TEST_F(AudioPlayerTest, MultipleSamples) { … }
TEST_F(AudioPlayerTest, ChangeSampleRate) { … }
TEST_F(AudioPlayerTest, ExceedLatency) { … }
TEST_F(AudioPlayerTest, ConsumePartialPacket) { … }
TEST_F(AudioPlayerTest, ConsumeAcrossPackets) { … }
TEST_F(AudioPlayerTest, ConsumeEntirePacket) { … }
TEST_F(AudioPlayerTest, NoDataToConsume) { … }
TEST_F(AudioPlayerTest, NotEnoughDataToConsume) { … }
}