AlexaClientSDK  1.19.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Public Attributes | List of all members
alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest Class Reference
Inheritance diagram for alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest:
Collaboration graph
[legend]

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::PooledMediaPlayerFactorym_mockFactory
 MediaPlayerFactory to generate MockMediaPlayers for testing; More...
 
std::shared_ptr< AudioPlayerm_audioPlayer
 AudioPlayer to test More...
 
std::shared_ptr< TestAudioPlayerObserverm_testAudioPlayerObserver
 A test observer to wait for AudioPlayer state changes More...
 
std::shared_ptr< MockMediaPlayerm_mockMediaPlayer
 Player to send the audio to. More...
 
std::shared_ptr< MockMediaPlayerm_mockMediaPlayerTrack2
 Another Player to send the audio to. More...
 
std::shared_ptr< MockMediaPlayerm_mockMediaPlayerTrack3
 Another Player to send the audio to. More...
 
std::shared_ptr< MockChannelVolumeInterfacem_mockSpeaker
 Speaker to send the audio to. More...
 
std::shared_ptr< MockContextManagerm_mockContextManager
 ContextManager to provide state and update state. More...
 
std::shared_ptr< MockFocusManagerm_mockFocusManager
 FocusManager to request focus to the DIALOG channel. More...
 
std::unique_ptr< MockDirectiveHandlerResultm_mockDirectiveHandlerResult
 A directive handler result to send the result to. More...
 
std::shared_ptr< MockMessageSenderm_mockMessageSender
 A message sender used to send events to AVS. More...
 
std::shared_ptr< MockExceptionEncounteredSenderm_mockExceptionSender
 An exception sender used to send exception encountered events to AVS. More...
 
std::shared_ptr< MockPlaybackRouterm_mockPlaybackRouter
 A playback router to notify when AudioPlayer becomes active. More...
 
std::shared_ptr< MockCaptionManagerm_mockCaptionManager
 A mock CaptionManager instance to handle captions parsing. More...
 
std::shared_ptr< AttachmentManagerm_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< MockMetricRecorderm_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
 

Constructor & Destructor Documentation

◆ AudioPlayerTest()

alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::AudioPlayerTest ( )

Member Function Documentation

◆ extractPlaybackAttributes()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::extractPlaybackAttributes ( std::shared_ptr< avsCommon::avs::MessageRequest request,
PlaybackAttributes actualPlaybackAttributes 
)

Extracts playback attributes from message for verification.

Parameters
requestThe MessageRequest to extract.
actualPlaybackAttributesThe PlaybackAttributes extracted.

◆ extractPlaybackReports()

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.

Parameters
requestThe MessageRequest to extract.
actualPlaybackReportsPointer to list of PlaybackReport extracted.

◆ reSetUp()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::reSetUp ( int  numberOfPlayers)

◆ sendClearQueueDirective()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendClearQueueDirective ( )

Consolidate code to send ClearQueue directive

◆ sendPlayDirective()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendPlayDirective ( long  offsetInMilliseconds = OFFSET_IN_MILLISECONDS_TEST)

Consolidate code to send Play directive.

Parameters
offsetInMillisecondsThe offset to use in the directive.

◆ sendStopDirective()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendStopDirective ( )

Consolidate code to send Stop directive.

◆ sendUpdateProgressReportIntervalDirective()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::sendUpdateProgressReportIntervalDirective ( )

Sends UpdateProgressReportInterval directive.

◆ SetUp()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::SetUp ( )
override

◆ TearDown()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::TearDown ( )
override

◆ testPlayEnqueueFinishPlay()

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.

◆ verifyMessage()

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

Parameters
requestThe MessageRequest to verify
expectedNameThe expected name to find in the json header

◆ verifyMessageMap()

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

Parameters
requestThe MessageRequest to verify
expectedMessagesThe map of expected messages and a count of how many are seen

◆ verifyMessageOrder()

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

Parameters
orderedMessageListThe list of expected messages, in order expected
indexThe expected message to match

◆ verifyState()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::verifyState ( const std::string &  providedState,
const std::string &  expectedState 
)

Verify that the provided state matches the expected state

Parameters
jsonStateThe state to verify
expectedStateThe expected state

◆ verifyTags()

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.

Parameters
requestThe MessageRequest to verify
expectedMessagesMap of expected tags and count of how many are seen.

◆ wakeOnAcquireChannel()

bool alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnAcquireChannel ( )

This is invoked in response to a acquireChannel call.

Returns
true

◆ wakeOnReleaseChannel()

std::future< bool > alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnReleaseChannel ( )

This is invoked in response to a releaseChannel call.

Returns
true

◆ wakeOnSendMessage()

void alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnSendMessage ( )

Fulfills the m_wakeSendMessagePromise. This is invoked in response to a sendMessage call.

◆ wakeOnSetState()

SetStateResult alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::wakeOnSetState ( )

This is invoked in response to a setState call.

Returns
SUCCESS.

Member Data Documentation

◆ m_attachmentManager

std::shared_ptr<AttachmentManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_attachmentManager

Attachment manager used to create a reader.

◆ m_audioPlayer

std::shared_ptr<AudioPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_audioPlayer

AudioPlayer to test

◆ m_expectedMessages

std::map<std::string, int> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_expectedMessages

Map for expected messages testing.

◆ m_mediaPlayerCallTrigger

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.

◆ m_messageSentTrigger

std::condition_variable alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_messageSentTrigger

Condition variable to wake on a message being sent.

◆ m_mockCaptionManager

std::shared_ptr<MockCaptionManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockCaptionManager

A mock CaptionManager instance to handle captions parsing.

◆ m_mockContextManager

std::shared_ptr<MockContextManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockContextManager

ContextManager to provide state and update state.

◆ m_mockDirectiveHandlerResult

std::unique_ptr<MockDirectiveHandlerResult> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockDirectiveHandlerResult

A directive handler result to send the result to.

◆ m_mockExceptionSender

std::shared_ptr<MockExceptionEncounteredSender> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockExceptionSender

An exception sender used to send exception encountered events to AVS.

◆ m_mockFactory

std::unique_ptr<alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockFactory

MediaPlayerFactory to generate MockMediaPlayers for testing;

◆ m_mockFocusManager

std::shared_ptr<MockFocusManager> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockFocusManager

FocusManager to request focus to the DIALOG channel.

◆ m_mockMediaPlayer

std::shared_ptr<MockMediaPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMediaPlayer

Player to send the audio to.

◆ m_mockMediaPlayerTrack2

std::shared_ptr<MockMediaPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMediaPlayerTrack2

Another Player to send the audio to.

◆ m_mockMediaPlayerTrack3

std::shared_ptr<MockMediaPlayer> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMediaPlayerTrack3

Another Player to send the audio to.

◆ m_mockMessageSender

std::shared_ptr<MockMessageSender> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMessageSender

A message sender used to send events to AVS.

◆ m_mockMetricRecorder

std::shared_ptr<MockMetricRecorder> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockMetricRecorder

The mock MetricRecorderInterface.

◆ m_mockPlaybackRouter

std::shared_ptr<MockPlaybackRouter> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockPlaybackRouter

A playback router to notify when AudioPlayer becomes active.

◆ m_mockSpeaker

std::shared_ptr<MockChannelVolumeInterface> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mockSpeaker

Speaker to send the audio to.

◆ m_mutex

std::mutex alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_mutex

General purpose mutex.

◆ m_sourceId

MediaPlayerInterface::SourceId alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_sourceId

Identifier for the currently selected audio source.

◆ m_testAudioPlayerObserver

std::shared_ptr<TestAudioPlayerObserver> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_testAudioPlayerObserver

A test observer to wait for AudioPlayer state changes

◆ m_wakeAcquireChannelFuture

std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeAcquireChannelFuture

Future to notify when acquireChannel is called.

◆ m_wakeAcquireChannelPromise

std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeAcquireChannelPromise

Promise to be fulfilled when acquireChannel is called.

◆ m_wakeReleaseChannelFuture

std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeReleaseChannelFuture

Future to notify when releaseChannel is called.

◆ m_wakeReleaseChannelPromise

std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeReleaseChannelPromise

Promise to be fulfilled when acquireChannel is called.

◆ m_wakeSendMessageFuture

std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSendMessageFuture

Future to notify when sendMessage is called.

◆ m_wakeSendMessagePromise

std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSendMessagePromise

Promise to be fulfilled when sendMessage is called.

◆ m_wakeSetStateFuture

std::future<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSetStateFuture

Future to notify when setState is called.

◆ m_wakeSetStatePromise

std::promise<void> alexaClientSDK::capabilityAgents::audioPlayer::test::AudioPlayerTest::m_wakeSetStatePromise

Promise to be fulfilled when setState is called.


The documentation for this class was generated from the following file:

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