![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
Public Member Functions | |
AudioPlayerTest () | |
void | SetUp () override |
void | TearDown () override |
void | reSetUp (int numberOfPlayers) |
SetStateResult | wakeOnSetState () |
bool | wakeOnAcquireChannel () |
std::future< bool > | wakeOnReleaseChannel () |
void | wakeOnSendMessage () |
void | sendPlayDirective (long offsetInMilliseconds=OFFSET_IN_MILLISECONDS_TEST, long endOffsetInMilliseconds=0L) |
void | badEndOffsetDirective (long offset, long endOffset) |
void | sendStopDirective () |
void | sendClearQueueDirective (ClearBehavior clearBehavior) |
void | sendUpdateProgressReportIntervalDirective () |
bool | verifyPlaybackMessage (std::shared_ptr< avsCommon::avs::MessageRequest > request, std::string expectedName, bool verifyReport=false) |
bool | verifyMessage (std::shared_ptr< avsCommon::avs::MessageRequest > request, std::string expectedName) |
void | verifyMessageMap (std::shared_ptr< avsCommon::avs::MessageRequest > request, std::map< std::string, int > *expectedMessages) |
void | verifyMessageOrder2Phase (const std::vector< std::string > &orderedMessageList, size_t index, std::function< void()> trigger1, std::function< void()> trigger2) |
void | verifyState (const std::string &providedState, const std::string &expectedState) |
void | verifyTags (std::shared_ptr< avsCommon::avs::MessageRequest > request, std::map< std::string, int > *expectedMessages, bool validateBoolean=true) |
void | extractPlaybackAttributes (std::shared_ptr< avsCommon::avs::MessageRequest > request, PlaybackAttributes *actualPlaybackAttributes) |
void | extractPlaybackReports (std::shared_ptr< avsCommon::avs::MessageRequest > request, std::vector< PlaybackReport > *actualPlaybackReports) |
bool | extractMediaPlayerState (std::shared_ptr< avsCommon::avs::MessageRequest > request, const std::string &expectedState, MediaPlayerState *playerState) |
void | testPlayEnqueueFinishPlay () |
![]() | |
virtual | ~Test () |
Public Attributes | |
std::shared_ptr< avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface > | m_mockMediaResourceProvider |
PooledMediaResourceProviderInterface to provide mock media players and speakers for testing. More... | |
std::shared_ptr< AudioPlayer > | m_audioPlayer |
AudioPlayer to test More... | |
std::shared_ptr< TestAudioPlayerObserver > | m_testAudioPlayerObserver |
A test observer to wait for AudioPlayer state changes More... | |
std::shared_ptr< MockMediaPlayer > | m_mockMediaPlayer |
Player to send the audio to. More... | |
std::shared_ptr< MockMediaPlayer > | m_mockMediaPlayerTrack2 |
Another Player to send the audio to. More... | |
std::shared_ptr< MockMediaPlayer > | m_mockMediaPlayerTrack3 |
Another Player to send the audio to. More... | |
std::shared_ptr< MockChannelVolumeInterface > | m_mockChannelVolume |
ChannelVolumeInterface to send the audio to. More... | |
std::shared_ptr< MockContextManager > | m_mockContextManager |
ContextManager to provide state and update state. More... | |
std::shared_ptr< MockFocusManager > | m_mockFocusManager |
FocusManager to request focus to the DIALOG channel. More... | |
std::unique_ptr< MockDirectiveHandlerResult > | m_mockDirectiveHandlerResult |
A directive handler result to send the result to. More... | |
std::shared_ptr< MockMessageSender > | m_mockMessageSender |
A message sender used to send events to AVS. More... | |
std::shared_ptr< MockExceptionEncounteredSender > | m_mockExceptionSender |
An exception sender used to send exception encountered events to AVS. More... | |
std::shared_ptr< MockPlaybackRouter > | m_mockPlaybackRouter |
A playback router to notify when AudioPlayer becomes active. More... | |
std::shared_ptr< MockCaptionManager > | m_mockCaptionManager |
A mock CaptionManager instance to handle captions parsing. More... | |
std::shared_ptr< AttachmentManager > | m_attachmentManager |
Attachment manager used to create a reader. More... | |
std::map< std::string, int > | m_expectedMessages |
Map for expected messages testing. More... | |
MediaPlayerInterface::SourceId | m_sourceId |
Identifier for the currently selected audio source. More... | |
std::shared_ptr< MockMetricRecorder > | m_mockMetricRecorder |
The mock MetricRecorderInterface . More... | |
std::shared_ptr< MockCryptoFactory > | m_cryptoFactory |
The mock MockCryptoFactory . More... | |
std::promise< void > | m_wakeSetStatePromise |
Promise to be fulfilled when setState is called. More... | |
std::future< void > | m_wakeSetStateFuture |
Future to notify when setState is called. More... | |
std::promise< void > | m_wakeAcquireChannelPromise |
Promise to be fulfilled when acquireChannel is called. More... | |
std::future< void > | m_wakeAcquireChannelFuture |
Future to notify when acquireChannel is called. More... | |
std::promise< void > | m_wakeReleaseChannelPromise |
Promise to be fulfilled when acquireChannel is called. More... | |
std::future< void > | m_wakeReleaseChannelFuture |
Future to notify when releaseChannel is called. More... | |
std::promise< void > | m_wakeSendMessagePromise |
Promise to be fulfilled when sendMessage is called. More... | |
std::future< void > | m_wakeSendMessageFuture |
Future to notify when sendMessage is called. More... | |
std::mutex | m_mutex |
General purpose mutex. More... | |
std::condition_variable | m_messageSentTrigger |
Condition variable to wake on a message being sent. More... | |
std::condition_variable | m_mediaPlayerCallTrigger |
Additional Inherited Members | |
![]() | |
typedef internal::SetUpTestCaseFunc | SetUpTestCaseFunc |
typedef internal::TearDownTestCaseFunc | TearDownTestCaseFunc |
![]() | |
static void | SetUpTestCase () |
static void | TearDownTestCase () |
static bool | HasFatalFailure () |
static bool | HasNonfatalFailure () |
static bool | HasFailure () |
static void | RecordProperty (const std::string &key, const std::string &value) |
static void | RecordProperty (const std::string &key, int value) |
![]() | |
Test () | |
alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::AudioPlayerTest | ( | ) |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::badEndOffsetDirective | ( | long | offset, |
long | endOffset | ||
) |
Consolidate code with bad end offset in a play directive. endOffset <= offset
offset | "start" offset in the directive |
endOffset | endOffset in the directive |
bool alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::extractMediaPlayerState | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
const std::string & | expectedState, | ||
MediaPlayerState * | playerState | ||
) |
Extracts mediaPlayerState from playback event for verification.
request | The MessageRequest to extract. |
actualPlaybackAttributes | The PlaybackAttributes extracted. |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::extractPlaybackAttributes | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
PlaybackAttributes * | actualPlaybackAttributes | ||
) |
Extracts playback attributes from message for verification.
request | The MessageRequest to extract. |
actualPlaybackAttributes | The PlaybackAttributes extracted. |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::extractPlaybackReports | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
std::vector< PlaybackReport > * | actualPlaybackReports | ||
) |
Extracts playback reports from message for verification.
request | The MessageRequest to extract. |
actualPlaybackReports | Pointer to list of PlaybackReport extracted. |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::reSetUp | ( | int | numberOfPlayers | ) |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::sendClearQueueDirective | ( | ClearBehavior | clearBehavior | ) |
Consolidate code to send ClearQueue directive
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::sendPlayDirective | ( | long | offsetInMilliseconds = OFFSET_IN_MILLISECONDS_TEST , |
long | endOffsetInMilliseconds = 0L |
||
) |
Consolidate code to send Play directive.
offsetInMilliseconds | The offset to use in the directive. |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::sendStopDirective | ( | ) |
Consolidate code to send Stop directive.
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::sendUpdateProgressReportIntervalDirective | ( | ) |
Sends UpdateProgressReportInterval directive.
|
overridevirtual |
Reimplemented from testing::Test.
|
overridevirtual |
Reimplemented from testing::Test.
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::testPlayEnqueueFinishPlay | ( | ) |
Run through test of playing, enqueuing, finish, play
This test sets up a sequence of 1 REPLACE track, followed by 3 ENQUEUE tracks, then tests that they are all played in sequence. It is called from tests that set up different numbers of MediaPlayers in a Factory Pool to ensure everything works smoothly.
bool alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::verifyMessage | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
std::string | expectedName | ||
) |
Verify that the message name matches the expected name
request | The MessageRequest to verify |
expectedName | The expected name to find in the json header |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::verifyMessageMap | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
std::map< std::string, int > * | expectedMessages | ||
) |
Verify that the sent request matches one in a Map of expectedMessages
request | The MessageRequest to verify |
expectedMessages | The map of expected messages and a count of how many are seen |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::verifyMessageOrder2Phase | ( | const std::vector< std::string > & | orderedMessageList, |
size_t | index, | ||
std::function< void()> | trigger1, | ||
std::function< void()> | trigger2 | ||
) |
verify that the sent request matches the indexed message in the list
orderedMessageList | The list of expected messages, in order expected |
index | The expected message to match |
bool alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::verifyPlaybackMessage | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
std::string | expectedName, | ||
bool | verifyReport = false |
||
) |
Verify that the message name matches the expected name, and contains fields common to PlaybackEvents
request | The MessageRequest to verify |
expectedName | The expected name to find in the json header |
verifyReport | True to look for PlaybackReport |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::verifyState | ( | const std::string & | providedState, |
const std::string & | expectedState | ||
) |
Verify that the provided state matches the expected state
jsonState | The state to verify |
expectedState | The expected state |
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::verifyTags | ( | std::shared_ptr< avsCommon::avs::MessageRequest > | request, |
std::map< std::string, int > * | expectedMessages, | ||
bool | validateBoolean = true |
||
) |
Verify that the message name matches the expected name and also verify expected tags.
request | The MessageRequest to verify |
expectedMessages | Map of expected tags and count of how many are seen. |
bool alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::wakeOnAcquireChannel | ( | ) |
This is invoked in response to a acquireChannel
call.
true
std::future< bool > alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::wakeOnReleaseChannel | ( | ) |
This is invoked in response to a releaseChannel
call.
true
void alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::wakeOnSendMessage | ( | ) |
Fulfills the m_wakeSendMessagePromise
. This is invoked in response to a sendMessage
call.
SetStateResult alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::wakeOnSetState | ( | ) |
This is invoked in response to a setState
call.
SUCCESS
. std::shared_ptr<AttachmentManager> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_attachmentManager |
Attachment manager used to create a reader.
std::shared_ptr<AudioPlayer> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_audioPlayer |
AudioPlayer
to test
std::shared_ptr<MockCryptoFactory> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_cryptoFactory |
The mock MockCryptoFactory
.
std::map<std::string, int> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_expectedMessages |
Map for expected messages testing.
std::condition_variable alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mediaPlayerCallTrigger |
Condition variable to wake on MediaPlayer calls. This is used when a MediaPlayer call is expected to occur without a corresponding change in PlayerActivity.
std::condition_variable alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_messageSentTrigger |
Condition variable to wake on a message being sent.
std::shared_ptr<MockCaptionManager> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockCaptionManager |
A mock CaptionManager
instance to handle captions parsing.
std::shared_ptr<MockChannelVolumeInterface> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockChannelVolume |
ChannelVolumeInterface to send the audio to.
std::shared_ptr<MockContextManager> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockContextManager |
ContextManager
to provide state and update state.
std::unique_ptr<MockDirectiveHandlerResult> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockDirectiveHandlerResult |
A directive handler result to send the result to.
std::shared_ptr<MockExceptionEncounteredSender> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockExceptionSender |
An exception sender used to send exception encountered events to AVS.
std::shared_ptr<MockFocusManager> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockFocusManager |
FocusManager
to request focus to the DIALOG channel.
std::shared_ptr<MockMediaPlayer> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockMediaPlayer |
Player to send the audio to.
std::shared_ptr<MockMediaPlayer> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockMediaPlayerTrack2 |
Another Player to send the audio to.
std::shared_ptr<MockMediaPlayer> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockMediaPlayerTrack3 |
Another Player to send the audio to.
std::shared_ptr<avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockMediaResourceProvider |
PooledMediaResourceProviderInterface
to provide mock media players and speakers for testing.
std::shared_ptr<MockMessageSender> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockMessageSender |
A message sender used to send events to AVS.
std::shared_ptr<MockMetricRecorder> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockMetricRecorder |
The mock MetricRecorderInterface
.
std::shared_ptr<MockPlaybackRouter> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mockPlaybackRouter |
A playback router to notify when AudioPlayer
becomes active.
std::mutex alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_mutex |
General purpose mutex.
MediaPlayerInterface::SourceId alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_sourceId |
Identifier for the currently selected audio source.
std::shared_ptr<TestAudioPlayerObserver> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_testAudioPlayerObserver |
A
test observer to wait for AudioPlayer
state changes
std::future<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeAcquireChannelFuture |
Future to notify when acquireChannel
is called.
std::promise<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeAcquireChannelPromise |
Promise to be fulfilled when acquireChannel
is called.
std::future<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeReleaseChannelFuture |
Future to notify when releaseChannel
is called.
std::promise<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeReleaseChannelPromise |
Promise to be fulfilled when acquireChannel
is called.
std::future<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeSendMessageFuture |
Future to notify when sendMessage
is called.
std::promise<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeSendMessagePromise |
Promise to be fulfilled when sendMessage
is called.
std::future<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeSetStateFuture |
Future to notify when setState
is called.
std::promise<void> alexaClientSDK::acsdkAudioPlayer::test::AudioPlayerTest::m_wakeSetStatePromise |
Promise to be fulfilled when setState
is called.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0