AlexaClientSDK
1.19.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) |
void | sendStopDirective () |
void | sendClearQueueDirective () |
void | sendUpdateProgressReportIntervalDirective () |
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 | verifyMessageOrder (const std::vector< std::string > &orderedMessageList, int index, std::function< void()> trigger) |
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) |
void | testPlayEnqueueFinishPlay () |
Public Attributes | |
std::unique_ptr< alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory > | m_mockFactory |
MediaPlayerFactory to generate MockMediaPlayers 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_mockSpeaker |
Speaker 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::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 |
alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::AudioPlayerTest | ( | ) |
void alexaClientSDK::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::test::AudioPlayerTest::reSetUp | ( | int | numberOfPlayers | ) |
void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendClearQueueDirective | ( | ) |
Consolidate code to send ClearQueue directive
void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendPlayDirective | ( | long | offsetInMilliseconds = OFFSET_IN_MILLISECONDS_TEST | ) |
Consolidate code to send Play directive.
offsetInMilliseconds | The offset to use in the directive. |
void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendStopDirective | ( | ) |
Consolidate code to send Stop directive.
void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendUpdateProgressReportIntervalDirective | ( | ) |
Sends UpdateProgressReportInterval directive.
|
override |
|
override |
void alexaClientSDK::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::test::AudioPlayerTest::verifyMessageOrder | ( | const std::vector< std::string > & | orderedMessageList, |
int | index, | ||
std::function< void()> | trigger | ||
) |
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 |
void alexaClientSDK::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnAcquireChannel | ( | ) |
This is invoked in response to a acquireChannel
call.
true
std::future< bool > alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnReleaseChannel | ( | ) |
This is invoked in response to a releaseChannel
call.
true
void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnSendMessage | ( | ) |
Fulfills the m_wakeSendMessagePromise
. This is invoked in response to a sendMessage
call.
SetStateResult alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnSetState | ( | ) |
This is invoked in response to a setState
call.
SUCCESS
. std::shared_ptr<AttachmentManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_attachmentManager |
Attachment manager used to create a reader.
std::shared_ptr<AudioPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_audioPlayer |
AudioPlayer
to test
std::map<std::string, int> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_expectedMessages |
Map for expected messages testing.
std::condition_variable alexaClientSDK::capabilityAgents::audioPlayer::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::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_messageSentTrigger |
Condition variable to wake on a message being sent.
std::shared_ptr<MockCaptionManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockCaptionManager |
A mock CaptionManager
instance to handle captions parsing.
std::shared_ptr<MockContextManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockContextManager |
ContextManager
to provide state and update state.
std::unique_ptr<MockDirectiveHandlerResult> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockDirectiveHandlerResult |
A directive handler result to send the result to.
std::shared_ptr<MockExceptionEncounteredSender> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockExceptionSender |
An exception sender used to send exception encountered events to AVS.
std::unique_ptr<alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockFactory |
MediaPlayerFactory
to generate MockMediaPlayers for testing;
std::shared_ptr<MockFocusManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockFocusManager |
FocusManager
to request focus to the DIALOG channel.
std::shared_ptr<MockMediaPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMediaPlayer |
Player to send the audio to.
std::shared_ptr<MockMediaPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMediaPlayerTrack2 |
Another Player to send the audio to.
std::shared_ptr<MockMediaPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMediaPlayerTrack3 |
Another Player to send the audio to.
std::shared_ptr<MockMessageSender> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMessageSender |
A message sender used to send events to AVS.
std::shared_ptr<MockMetricRecorder> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMetricRecorder |
The mock MetricRecorderInterface
.
std::shared_ptr<MockPlaybackRouter> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockPlaybackRouter |
A playback router to notify when AudioPlayer
becomes active.
std::shared_ptr<MockChannelVolumeInterface> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockSpeaker |
Speaker to send the audio to.
std::mutex alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mutex |
General purpose mutex.
MediaPlayerInterface::SourceId alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_sourceId |
Identifier for the currently selected audio source.
std::shared_ptr<TestAudioPlayerObserver> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_testAudioPlayerObserver |
A
test observer to wait for AudioPlayer
state changes
std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeAcquireChannelFuture |
Future to notify when acquireChannel
is called.
std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeAcquireChannelPromise |
Promise to be fulfilled when acquireChannel
is called.
std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeReleaseChannelFuture |
Future to notify when releaseChannel
is called.
std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeReleaseChannelPromise |
Promise to be fulfilled when acquireChannel
is called.
std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSendMessageFuture |
Future to notify when sendMessage
is called.
std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSendMessagePromise |
Promise to be fulfilled when sendMessage
is called.
std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSetStateFuture |
Future to notify when setState
is called.
std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSetStatePromise |
Promise to be fulfilled when setState
is called.
AlexaClientSDK 1.19.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0