AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Functions | Variables
alexaClientSDK::capabilityAgents::playbackController::test Namespace Reference

Classes

class  PlaybackControllerTest
 Test harness for StateSynchronizer class. More...
 
class  PlaybackRouterTest
 

Functions

static std::string checkMessageRequest (std::shared_ptr< MessageRequest > messageRequest, const std::string &expected_payload_name, const std::string &expected_payload_action)
 
 TEST_F (PlaybackControllerTest, test_createSuccessfully)
 
 TEST_F (PlaybackControllerTest, test_createWithError)
 
 TEST_F (PlaybackControllerTest, test_playButtonPressed)
 
 TEST_F (PlaybackControllerTest, test_pauseButtonPressed)
 
 TEST_F (PlaybackControllerTest, test_nextButtonPressed)
 
 TEST_F (PlaybackControllerTest, test_previousButtonPressed)
 
 TEST_F (PlaybackControllerTest, test_skipForwardButtonPressed)
 
 TEST_F (PlaybackControllerTest, test_skipBackwardButtonPressed)
 
 TEST_F (PlaybackControllerTest, test_shuffleTogglePressed)
 
 TEST_F (PlaybackControllerTest, test_loopTogglePressed)
 
 TEST_F (PlaybackControllerTest, test_repeatTogglePressed)
 
 TEST_F (PlaybackControllerTest, test_thumbsUpTogglePressed)
 
 TEST_F (PlaybackControllerTest, test_thumbsDownTogglePressed)
 
 TEST_F (PlaybackControllerTest, test_getContextFailure)
 
 TEST_F (PlaybackControllerTest, test_sendMessageFailure)
 
 TEST_F (PlaybackControllerTest, test_sendMessageException)
 
 TEST_F (PlaybackRouterTest, test_defaultHandler)
 
 TEST_F (PlaybackRouterTest, test_secondHandler)
 
 TEST_F (PlaybackRouterTest, test_switchToDefaultHandler)
 

Variables

static const std::string PLAYBACK_CONTROLLER_NAMESPACE = "PlaybackController"
 String to identify the AVS namespace of the event we send. More...
 
static const std::string PLAYBACK_PLAY_NAME = "PlayCommandIssued"
 String to identify the AVS name of the event on the 'Play' button pressed. More...
 
static const std::string PLAYBACK_PAUSE_NAME = "PauseCommandIssued"
 String to identify the AVS name of the event on the 'Pause' button pressed. More...
 
static const std::string PLAYBACK_NEXT_NAME = "NextCommandIssued"
 String to identify the AVS name of the event on the 'Next' button pressed. More...
 
static const std::string PLAYBACK_PREVIOUS_NAME = "PreviousCommandIssued"
 String to identify the AVS name of the event on the 'Previous' button pressed. More...
 
static const std::string PLAYBACK_BUTTON_NAME = "ButtonCommandIssued"
 String to identify the AVS name of the event on a PlaybackController button pressed. More...
 
static const std::string PLAYBACK_SKIPFORWARD_NAME = "SKIPFORWARD"
 String to identify the AVS name inside the event payload on the 'SKIPFORWARD' button pressed. More...
 
static const std::string PLAYBACK_SKIPBACKWARD_NAME = "SKIPBACKWARD"
 String to identify the AVS name inside the event payload on the 'SKIPBACKWARD' button pressed. More...
 
static const std::string PLAYBACK_TOGGLE_NAME = "ToggleCommandIssued"
 String to identify the AVS name of the event on a PlaybackController toggle button toggled. More...
 
static const std::string PLAYBACK_SHUFFLE_NAME = "SHUFFLE"
 String to identify the AVS name inside the event payload on the 'SHUFFLE' button toggled. More...
 
static const std::string PLAYBACK_LOOP_NAME = "LOOP"
 String to identify the AVS name inside the event payload on the 'LOOP' button toggled. More...
 
static const std::string PLAYBACK_REPEAT_NAME = "REPEAT"
 String to identify the AVS name inside the event payload on the 'REPEAT' button toggled. More...
 
static const std::string PLAYBACK_THUMBSUP_NAME = "THUMBSUP"
 String to identify the AVS name inside the event payload on the 'THUMBSUP' button toggled. More...
 
static const std::string PLAYBACK_THUMBSDOWN_NAME = "THUMBSDOWN"
 String to identify the AVS name inside the event payload on the 'THUMBSDOWN' button toggled. More...
 
static const std::string PLAYBACK_SELECTED_NAME = "SELECT"
 String to identify the AVS name for 'SELECT' action on a toggle button. More...
 
static const std::string PLAYBACK_DESELECTED_NAME = "DESELECT"
 String to identify the AVS name for 'DESELECT' action on a toggle button. More...
 
static const std::string TEST_EXCEPTION_TEXT = "Exception test"
 String to test for MessageRequest exceptionReceived() More...
 
static const std::chrono::milliseconds TEST_RESULT_WAIT_PERIOD {100}
 A short period of time to wait for the m_contextTrigger or m_messageTrigger. More...
 
static const ContextRequestToken CONTEXT_REQUEST_TOKEN {1}
 
static const std::string MOCK_CONTEXT
 A mock context returned by MockContextManager. More...
 

Function Documentation

◆ checkMessageRequest()

static std::string alexaClientSDK::capabilityAgents::playbackController::test::checkMessageRequest ( std::shared_ptr< MessageRequest messageRequest,
const std::string &  expected_payload_name,
const std::string &  expected_payload_action 
)
static

Check if message request has errors.

Parameters
messageRequestThe message requests to be checked.
Returns
"ERROR" if parsing the JSON has any unexpected results.

◆ TEST_F() [1/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackRouterTest  ,
test_defaultHandler   
)

Test default handler is called.

◆ TEST_F() [2/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackRouterTest  ,
test_secondHandler   
)

Test 2nd handler is called after registration.

◆ TEST_F() [3/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackRouterTest  ,
test_switchToDefaultHandler   
)

Test default handler is called again after switchToDefaultHandler has been called.

◆ TEST_F() [4/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_createSuccessfully   
)

This case tests if StateSynchronizer basic create function works properly

◆ TEST_F() [5/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_createWithError   
)

This case tests if possible nullptr parameters passed to StateSynchronizer::create are handled properly.

◆ TEST_F() [6/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_playButtonPressed   
)

This case tests if buttonPressed will send the correct PlaybackButton::PLAY event message.

◆ TEST_F() [7/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_pauseButtonPressed   
)

This case tests if buttonPressed will send the correct PlaybackButton::PAUSE event message.

◆ TEST_F() [8/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_nextButtonPressed   
)

This case tests if buttonPressed will send the correct PlaybackButton::NEXT event message.

◆ TEST_F() [9/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_previousButtonPressed   
)

This case tests if buttonPressed will send the correct PlaybackButton::PREVIOUS event message.

◆ TEST_F() [10/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_skipForwardButtonPressed   
)

This case tests if buttonPressed will send the correct PlaybackButton::SKIP_FORWARD event message.

◆ TEST_F() [11/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_skipBackwardButtonPressed   
)

This case tests if buttonPressed will send the correct PlaybackButton::SKIP_BACKWARD event message.

◆ TEST_F() [12/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_shuffleTogglePressed   
)

This case tests if togglePressed will send the correct PlaybackToggle::SHUFFLE event message.

◆ TEST_F() [13/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_loopTogglePressed   
)

This case tests if togglePressed will send the correct PlaybackToggle::LOOP event message.

◆ TEST_F() [14/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_repeatTogglePressed   
)

This case tests if togglePressed will send the correct PlaybackToggle::REPEAT event message.

◆ TEST_F() [15/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_thumbsUpTogglePressed   
)

This case tests if togglePressed will send the correct PlaybackToggle::THUMBS_UP event message.

◆ TEST_F() [16/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_thumbsDownTogglePressed   
)

This case tests if togglePressed will send the correct PlaybackToggle::THUMBS_DOWN event message.

◆ TEST_F() [17/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_getContextFailure   
)

This case tests if getContext() returns failure, the button on the top of the queue will be dropped and getContext will be called for the next button on the queue.

◆ TEST_F() [18/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_sendMessageFailure   
)

This case tests if sendMessage() returns failure, an error log should be logged with the button pressed and reason for failure.

◆ TEST_F() [19/19]

alexaClientSDK::capabilityAgents::playbackController::test::TEST_F ( PlaybackControllerTest  ,
test_sendMessageException   
)

This case tests if exceptionReceived() is received, an error log should be logged with with the exception description.

Variable Documentation

◆ CONTEXT_REQUEST_TOKEN

const ContextRequestToken alexaClientSDK::capabilityAgents::playbackController::test::CONTEXT_REQUEST_TOKEN {1}
static

◆ MOCK_CONTEXT

const std::string alexaClientSDK::capabilityAgents::playbackController::test::MOCK_CONTEXT
static
Initial value:
= "{"
"\"context\":[{"
"\"header\":{"
"\"name\":\"SpeechState\","
"\"namespace\":\"SpeechSynthesizer\""
"},"
"\"payload\":{"
"\"playerActivity\":\"FINISHED\","
"\"offsetInMilliseconds\":0,"
"\"token\":\"\""
"}"
"}]}"

A mock context returned by MockContextManager.

◆ PLAYBACK_BUTTON_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_BUTTON_NAME = "ButtonCommandIssued"
static

String to identify the AVS name of the event on a PlaybackController button pressed.

◆ PLAYBACK_CONTROLLER_NAMESPACE

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_CONTROLLER_NAMESPACE = "PlaybackController"
static

String to identify the AVS namespace of the event we send.

◆ PLAYBACK_DESELECTED_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_DESELECTED_NAME = "DESELECT"
static

String to identify the AVS name for 'DESELECT' action on a toggle button.

◆ PLAYBACK_LOOP_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_LOOP_NAME = "LOOP"
static

String to identify the AVS name inside the event payload on the 'LOOP' button toggled.

◆ PLAYBACK_NEXT_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_NEXT_NAME = "NextCommandIssued"
static

String to identify the AVS name of the event on the 'Next' button pressed.

◆ PLAYBACK_PAUSE_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_PAUSE_NAME = "PauseCommandIssued"
static

String to identify the AVS name of the event on the 'Pause' button pressed.

◆ PLAYBACK_PLAY_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_PLAY_NAME = "PlayCommandIssued"
static

String to identify the AVS name of the event on the 'Play' button pressed.

◆ PLAYBACK_PREVIOUS_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_PREVIOUS_NAME = "PreviousCommandIssued"
static

String to identify the AVS name of the event on the 'Previous' button pressed.

◆ PLAYBACK_REPEAT_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_REPEAT_NAME = "REPEAT"
static

String to identify the AVS name inside the event payload on the 'REPEAT' button toggled.

◆ PLAYBACK_SELECTED_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_SELECTED_NAME = "SELECT"
static

String to identify the AVS name for 'SELECT' action on a toggle button.

◆ PLAYBACK_SHUFFLE_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_SHUFFLE_NAME = "SHUFFLE"
static

String to identify the AVS name inside the event payload on the 'SHUFFLE' button toggled.

◆ PLAYBACK_SKIPBACKWARD_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_SKIPBACKWARD_NAME = "SKIPBACKWARD"
static

String to identify the AVS name inside the event payload on the 'SKIPBACKWARD' button pressed.

◆ PLAYBACK_SKIPFORWARD_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_SKIPFORWARD_NAME = "SKIPFORWARD"
static

String to identify the AVS name inside the event payload on the 'SKIPFORWARD' button pressed.

◆ PLAYBACK_THUMBSDOWN_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_THUMBSDOWN_NAME = "THUMBSDOWN"
static

String to identify the AVS name inside the event payload on the 'THUMBSDOWN' button toggled.

◆ PLAYBACK_THUMBSUP_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_THUMBSUP_NAME = "THUMBSUP"
static

String to identify the AVS name inside the event payload on the 'THUMBSUP' button toggled.

◆ PLAYBACK_TOGGLE_NAME

const std::string alexaClientSDK::capabilityAgents::playbackController::test::PLAYBACK_TOGGLE_NAME = "ToggleCommandIssued"
static

String to identify the AVS name of the event on a PlaybackController toggle button toggled.

◆ TEST_EXCEPTION_TEXT

const std::string alexaClientSDK::capabilityAgents::playbackController::test::TEST_EXCEPTION_TEXT = "Exception test"
static

String to test for MessageRequest exceptionReceived()

◆ TEST_RESULT_WAIT_PERIOD

const std::chrono::milliseconds alexaClientSDK::capabilityAgents::playbackController::test::TEST_RESULT_WAIT_PERIOD {100}
static

A short period of time to wait for the m_contextTrigger or m_messageTrigger.

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