AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Macros | Functions | Variables
MediaPlayerTest.cpp File Reference
#include <algorithm>
#include <chrono>
#include <condition_variable>
#include <fstream>
#include <limits>
#include <memory>
#include <mutex>
#include <thread>
#include <unordered_map>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <AVSCommon/AVS/Initialization/AlexaClientSDKInit.h>
#include <AVSCommon/AVS/SpeakerConstants/SpeakerConstants.h>
#include <AVSCommon/Utils/Configuration/ConfigurationNode.h>
#include <AVSCommon/Utils/Logger/Logger.h>
#include <AVSCommon/Utils/Memory/Memory.h>
#include <PlaylistParser/PlaylistParser.h>
#include "MediaPlayer/MediaPlayer.h"
#include "AVSCommon/Utils/MediaPlayer/MediaPlayerObserverInterface.h"
Include dependency graph for MediaPlayerTest.cpp:

Classes

class  alexaClientSDK::mediaPlayer::test::MockContentFetcher
 A mock content fetcher. More...
 
class  alexaClientSDK::mediaPlayer::test::MockContentFetcherFactory
 A mock factory that creates mock content fetchers. More...
 
class  alexaClientSDK::mediaPlayer::test::MockAttachmentReader
 
class  alexaClientSDK::mediaPlayer::test::MockPlayerObserver
 
class  alexaClientSDK::mediaPlayer::test::MediaPlayerTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::mediaPlayer
 
 alexaClientSDK::mediaPlayer::test
 

Macros

#define TAG   "MediaPlayerTest"
 String to identify log entries originating from this file. More...
 
#define LX(event)   alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
 

Functions

static const std::string alexaClientSDK::mediaPlayer::test::MP3_FILE_PATH ("/fox_dog.mp3")
 MP3 test file path. More...
 
static const std::string alexaClientSDK::mediaPlayer::test::TEST_M3U_PLAYLIST_URL ("fox_dog_playlist.m3u")
 
static const std::string alexaClientSDK::mediaPlayer::test::FILE_PREFIX ("file://")
 file URI Prefix More...
 
static const std::chrono::milliseconds alexaClientSDK::mediaPlayer::test::MP3_FILE_LENGTH (2688)
 File length for the MP3 test file. More...
 
static const std::chrono::milliseconds alexaClientSDK::mediaPlayer::test::OFFSET (2000)
 Offset to start playback at. More...
 
static const std::chrono::milliseconds alexaClientSDK::mediaPlayer::test::TOLERANCE (500)
 Tolerance when setting expectations. More...
 
static const std::chrono::milliseconds alexaClientSDK::mediaPlayer::test::PADDING (10)
 Padding to add to offsets when necessary. More...
 
 alexaClientSDK::mediaPlayer::test::INSTANTIATE_TEST_CASE_P (Parameterized, MediaPlayerTest, ::testing::Bool())
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_startPlayWaitForEnd)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_startPlayForUrl)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_consecutiveSetSource)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_startPlayWaitForEndStartPlayAgain)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_stopPlay)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_startPlayCallAfterStopPlay)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_startPlayCallAfterStopPlayDifferentSource)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_pauseDuringPlay)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_resumeAfterPauseThenStop)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_stopAfterPause)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_pauseAfterPause)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_resumeAfterPlay)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testTimer_getOffsetInMilliseconds)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_getOffsetInMillisecondsNullPipeline)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_getOffsetWhenStoppedFails)
 Tests that calls to getOffset fail when the pipeline is in a stopped state. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_getOffsetWhenPaused)
 Tests that calls to getOffset succeed when the pipeline is in a paused state. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_playingTwoAttachments)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, DISABLED_testSlow_unsteadyReads)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, DISABLED_testSlow_recoveryFromPausedReads)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_startPlayWithUrlPlaylistWaitForEnd)
 Tests playing a dummy playlist. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testTimer_setOffsetSeekableSource)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, DISABLED_test_setOffsetOutsideBounds)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, DISABLED_test_setSourceResetsOffset)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_repeatAttachment)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_setVolumePlays)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_setMutePlays)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_getSpeakerSettings)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_readTags)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_consecutiveSameApiCalls)
 Tests that consecutive calls to the same public API fails. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_immediatePause)
 Tests that pausing immediately before waiting for a callback is valid. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_multiplePlayAndSetSource)
 Tests setting multiple set source calls and observing onPlaybackStopped and onPlaybackFinished calls. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_invalidSourceId)
 Tests passing an invalid source id to a play() call. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_doublePause)
 Tests that two consecutive calls to pause fails. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_resumeWhenPlaying)
 Tests that a resume when already playing fails. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_resumeWhenStopped)
 Tests that a resume when stopped (not paused) fails. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, test_newSetSourceLeadsToStoppedCallback)
 Tests that a stop callback when playing leads to an onPlaybackStopped callback. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_resumeAfterPauseWithPendingPlay)
 Tests that resuming after a pause with a pending play leads to an onPlaybackResumed callback. More...
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_PlayWithFadeIn)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_PlayWithFadeInMidVolume)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_PlayWithFadeInOutOfLimit)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_PlayWithFadeInStartGreater)
 
 alexaClientSDK::mediaPlayer::test::TEST_P (MediaPlayerTest, testSlow_repeatPlayForUrl)
 Tests that playing continues until stop is called when repeat is on. More...
 
int main (int argc, char **argv)
 

Variables

static const MediaPlayer::SourceId alexaClientSDK::mediaPlayer::test::ERROR_SOURCE_ID = MediaPlayer::ERROR
 
std::string alexaClientSDK::mediaPlayer::test::inputsDirPath
 The path to the input Dir containing the test audio files. More...
 
static std::string alexaClientSDK::mediaPlayer::test::TEST_M3U_PLAYLIST_CONTENT
 
static const alexaClientSDK::avsCommon::utils::MediaType alexaClientSDK::mediaPlayer::test::MP3_TYPE = alexaClientSDK::avsCommon::utils::MediaType::MPEG
 
static std::unordered_map< std::string, std::string > alexaClientSDK::mediaPlayer::test::urlsToContentTypes
 
static std::unordered_map< std::string, std::string > alexaClientSDK::mediaPlayer::test::urlsToContent
 

Macro Definition Documentation

◆ LX

#define LX (   event)    alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

Create a LogEntry using this file's TAG and the specified event string.

Parameters
Theevent string for this LogEntry.

◆ TAG

#define TAG   "MediaPlayerTest"

String to identify log entries originating from this file.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0