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

Classes

class  MockGui
 
class  MockMediaPropertiesFetcher
 
class  MockRenderInfoCardsPlayer
 
class  MockRenderInfoCardsPlayerRegistrar
 
class  MockRenderPlayerInfoCardProvider
 
class  TemplateRuntimeTest
 Test harness for TemplateRuntime class. More...
 

Functions

 TEST (RenderPlayerInfoCardsProviderTest, test_getProviders)
 
 TEST (PostConnectOperationProviderRegistrarTest, test_registerDuplicateProviderFails)
 
 TEST (PostConnectOperationProviderRegistrarTest, test_registerNullProviderFails)
 
static std::chrono::milliseconds TIMEOUT (1000)
 Timeout when waiting for futures to be set. More...
 
static std::chrono::milliseconds TEMPLATE_TIMEOUT (5000)
 Timeout when waiting for clearTemplateCard. More...
 
static std::chrono::milliseconds TEMPLATE_NOT_CLEAR_TIMEOUT (2500)
 Timeout when waiting for clearTemplateCard not called. More...
 
static std::chrono::milliseconds PLAYER_FINISHED_TIMEOUT (5000)
 Timeout when waiting for clearTemplateCard. More...
 
static const std::string MESSAGE_ID ("messageId")
 The MessageId identifer. More...
 
static const std::string AUDIO_ITEM_ID ("AudioItemId abcdefgh")
 An audioItemId for the RenderPlayerInfo directive. More...
 
static const std::string AUDIO_ITEM_ID_1 ("AudioItemId 12345678")
 An audioItemId without a corresponding RenderPlayerInfo directive. More...
 
 TEST_F (TemplateRuntimeTest, test_nullAudioPlayerInterface)
 
 TEST_F (TemplateRuntimeTest, test_nullProviderRegistrar)
 
 TEST_F (TemplateRuntimeTest, test_nullFocusManagerInterface)
 
 TEST_F (TemplateRuntimeTest, test_nullExceptionSender)
 
 TEST_F (TemplateRuntimeTest, test_renderInfoCardsPlayersFromRegistrarAddRemoveObserver)
 
 TEST_F (TemplateRuntimeTest, test_renderInfoCardsPlayersAddRemoveObserver)
 
 TEST_F (TemplateRuntimeTest, test_unknownDirective)
 
 TEST_F (TemplateRuntimeTest, testSlow_renderTemplateDirective)
 
 TEST_F (TemplateRuntimeTest, testRenderTemplateDirectiveWillNotClearCardAfterGoingToExpectingStateAfterGoingToIDLESlowTest)
 
 TEST_F (TemplateRuntimeTest, test_handleDirectiveImmediately)
 
 TEST_F (TemplateRuntimeTest, testSlow_renderPlayerInfoDirectiveBefore)
 
 TEST_F (TemplateRuntimeTest, test_renderPlayerInfoDirectiveAfter)
 
 TEST_F (TemplateRuntimeTest, test_renderPlayerInfoDirectiveWithoutAudioItemId)
 
 TEST_F (TemplateRuntimeTest, test_malformedRenderPlayerInfoDirective)
 
 TEST_F (TemplateRuntimeTest, test_renderPlayerInfoDirectiveDifferentAudioItemId)
 
 TEST_F (TemplateRuntimeTest, test_renderPlayerInfoDirectiveWithTwoProviders)
 
 TEST_F (TemplateRuntimeTest, test_renderPlayerInfoDirectiveAudioStateUpdate)
 
 TEST_F (TemplateRuntimeTest, test_focusNone)
 
 TEST_F (TemplateRuntimeTest, test_displayCardCleared)
 
 TEST_F (TemplateRuntimeTest, test_reacquireChannel)
 
 TEST_F (TemplateRuntimeTest, testTimer_RenderPlayerInfoAfterPlayerActivityChanged)
 

Variables

static const std::string NAMESPACE {"TemplateRuntime"}
 The namespace for this capability agent. More...
 
static const std::string UNKNOWN_DIRECTIVE {"Unknown"}
 An unknown directive signature. More...
 
static const NamespaceAndName TEMPLATE {NAMESPACE, "RenderTemplate"}
 The RenderTemplate directive signature. More...
 
static const NamespaceAndName PLAYER_INFO {NAMESPACE, "RenderPlayerInfo"}
 The RenderPlayerInfo directive signature. More...
 
static const std::string TEMPLATE_PAYLOAD
 A RenderTemplate directive payload. More...
 
static const std::string PLAYERINFO_PAYLOAD
 A RenderPlayerInfo directive payload. More...
 
static const std::string MALFORM_PLAYERINFO_PAYLOAD
 A malformed RenderPlayerInfo directive payload. More...
 

Function Documentation

◆ AUDIO_ITEM_ID()

static const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::AUDIO_ITEM_ID ( "AudioItemId abcdefgh"  )
static

An audioItemId for the RenderPlayerInfo directive.

◆ AUDIO_ITEM_ID_1()

static const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::AUDIO_ITEM_ID_1 ( "AudioItemId 12345678"  )
static

An audioItemId without a corresponding RenderPlayerInfo directive.

◆ MESSAGE_ID()

static const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::MESSAGE_ID ( "messageId"  )
static

The MessageId identifer.

◆ PLAYER_FINISHED_TIMEOUT()

static std::chrono::milliseconds alexaClientSDK::capabilityAgents::templateRuntime::test::PLAYER_FINISHED_TIMEOUT ( 5000  )
static

Timeout when waiting for clearTemplateCard.

◆ TEMPLATE_NOT_CLEAR_TIMEOUT()

static std::chrono::milliseconds alexaClientSDK::capabilityAgents::templateRuntime::test::TEMPLATE_NOT_CLEAR_TIMEOUT ( 2500  )
static

Timeout when waiting for clearTemplateCard not called.

◆ TEMPLATE_TIMEOUT()

static std::chrono::milliseconds alexaClientSDK::capabilityAgents::templateRuntime::test::TEMPLATE_TIMEOUT ( 5000  )
static

Timeout when waiting for clearTemplateCard.

◆ TEST() [1/3]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST ( PostConnectOperationProviderRegistrarTest  ,
test_registerDuplicateProviderFails   
)

Verify registering a provider fails if it is a duplicate.

◆ TEST() [2/3]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST ( PostConnectOperationProviderRegistrarTest  ,
test_registerNullProviderFails   
)

Verify registering a null provider fails.

◆ TEST() [3/3]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST ( RenderPlayerInfoCardsProviderTest  ,
test_getProviders   
)

Verify getProviders() returns the set of registered providers.

◆ TEST_F() [1/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_displayCardCleared   
)

Tests that if displayCardCleared() is called, the clearTemplateCard() will not be called.

◆ TEST_F() [2/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_focusNone   
)

Tests that if focus is changed to none, the clearTemplateCard() will be called.

◆ TEST_F() [3/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_handleDirectiveImmediately   
)

Tests RenderTemplate Directive using the handleDirectiveImmediately. Expect that the renderTemplateCard callback will be called.

◆ TEST_F() [4/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_malformedRenderPlayerInfoDirective   
)

Tests when a malformed RenderTemplate Directive is received. Expect that the sendExceptionEncountered and setFailed will be called.

◆ TEST_F() [5/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_nullAudioPlayerInterface   
)

Tests creating the TemplateRuntime with a null audioPlayerInterface.

◆ TEST_F() [6/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_nullExceptionSender   
)

Tests creating the TemplateRuntime with a null exceptionSender.

◆ TEST_F() [7/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_nullFocusManagerInterface   
)

Tests creating the TemplateRuntime with a null focusManagerInterface.

◆ TEST_F() [8/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_nullProviderRegistrar   
)

Tests creating the TemplateRuntime with a null provider registrar.

◆ TEST_F() [9/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_reacquireChannel   
)

Tests that if another displayCard event is sent before channel's focus is set to none, the state machine would transition to REACQUIRING state and acquireChannel again to display the card.

◆ TEST_F() [10/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderInfoCardsPlayersAddRemoveObserver   
)

Tests that the TemplateRuntime successfully add itself with the RenderInfoCardsPlayers at constructor time, and successfully remove itself with the RenderPlayerInfoCardsPlayers during shutdown.

◆ TEST_F() [11/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderInfoCardsPlayersFromRegistrarAddRemoveObserver   
)

Tests that the TemplateRuntime will add itself to the providers registered with the RenderInfoCardsPlayerRegistrar at constructor time, and remove itself from them during shutdown.

◆ TEST_F() [12/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderPlayerInfoDirectiveAfter   
)

Tests RenderTemplate Directive received after the corresponding AudioPlayer call. Expect that the renderTemplateCard callback will be called.

◆ TEST_F() [13/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderPlayerInfoDirectiveAudioStateUpdate   
)

Tests AudioPlayer callbacks will trigger the correct renderPlayerInfoCard callbacks. Expect the payload, audioPlayerState and offset to match to the ones passed in by the RenderPlayerInfoCardsObserverInterface.

◆ TEST_F() [14/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderPlayerInfoDirectiveDifferentAudioItemId   
)

Tests AudioPlayer notified the handling of AUDIO_ITEM_ID_1, and then RenderTemplate Directive with AUDIO_ITEM_ID is received. Expect that the renderTemplateCard callback will not be called until the AudioPlayer notified the handling of AUDIO_ITEM_ID later.

◆ TEST_F() [15/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderPlayerInfoDirectiveWithoutAudioItemId   
)

Tests RenderTemplate Directive received without an audioItemId. Expect that the sendExceptionEncountered and setFailed will be called.

◆ TEST_F() [16/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_renderPlayerInfoDirectiveWithTwoProviders   
)

Tests Provider notified the handling of AUDIO_ITEM_ID_1, and another provider notified the handling of AUDIO_ITEM_ID, and then RenderTemplate Directive with AUDIO_ITEM_ID is received. Expect that the renderTemplateCard callback will be called and the correct getAudioItemOffset is called.

◆ TEST_F() [17/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
test_unknownDirective   
)

Tests unknown Directive. Expect that the sendExceptionEncountered and setFailed will be called.

◆ TEST_F() [18/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
testRenderTemplateDirectiveWillNotClearCardAfterGoingToExpectingStateAfterGoingToIDLESlowTest   
)

Tests RenderTemplate Directive. Expect that the renderTemplateCard callback will be called and clearTemplateCard will not be called if DialogUXState goes to IDLE state and then goes EXPECTING and SPEAKING state.

◆ TEST_F() [19/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
testSlow_renderPlayerInfoDirectiveBefore   
)

Tests RenderTemplate Directive received before the corresponding AudioPlayer call. Expect that the renderTemplateCard callback will be called and clearPlayerInfoCard will be called after 2s after Audio State is changed to FINISHED state.

◆ TEST_F() [20/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
testSlow_renderTemplateDirective   
)

Tests RenderTemplate Directive. Expect that the renderTemplateCard callback will be called and clearTemplateCard will be called after 2s after DialogUXState is changed to IDLE state.

◆ TEST_F() [21/21]

alexaClientSDK::capabilityAgents::templateRuntime::test::TEST_F ( TemplateRuntimeTest  ,
testTimer_RenderPlayerInfoAfterPlayerActivityChanged   
)

Test that we should skip rendering a player info card if the audio has already changed.

◆ TIMEOUT()

static std::chrono::milliseconds alexaClientSDK::capabilityAgents::templateRuntime::test::TIMEOUT ( 1000  )
static

Timeout when waiting for futures to be set.

Variable Documentation

◆ MALFORM_PLAYERINFO_PAYLOAD

const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::MALFORM_PLAYERINFO_PAYLOAD
static
Initial value:
= "{"
"\"audioItemId\"::::\"" + AUDIO_ITEM_ID + "\","
"\"content\":{{{{"
"\"title\":\"TITLE\","
"\"header\":\"HEADER\""
"}"
"}"

A malformed RenderPlayerInfo directive payload.

◆ NAMESPACE

const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::NAMESPACE {"TemplateRuntime"}
static

The namespace for this capability agent.

◆ PLAYER_INFO

const NamespaceAndName alexaClientSDK::capabilityAgents::templateRuntime::test::PLAYER_INFO {NAMESPACE, "RenderPlayerInfo"}
static

The RenderPlayerInfo directive signature.

◆ PLAYERINFO_PAYLOAD

const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::PLAYERINFO_PAYLOAD
static
Initial value:
= "{"
"\"audioItemId\":\"" + AUDIO_ITEM_ID + "\","
"\"content\":{"
"\"title\":\"TITLE\","
"\"header\":\"HEADER\""
"}"
"}"

A RenderPlayerInfo directive payload.

◆ TEMPLATE

const NamespaceAndName alexaClientSDK::capabilityAgents::templateRuntime::test::TEMPLATE {NAMESPACE, "RenderTemplate"}
static

The RenderTemplate directive signature.

◆ TEMPLATE_PAYLOAD

const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::TEMPLATE_PAYLOAD
static
Initial value:
= "{"
"\"token\":\"TOKEN1\","
"\"type\":\"BodyTemplate1\","
"\"title\":{"
"\"mainTitle\":\"MAIN_TITLE\","
"\"subTitle\":\"SUB_TITLE\""
"}"
"}"

A RenderTemplate directive payload.

◆ UNKNOWN_DIRECTIVE

const std::string alexaClientSDK::capabilityAgents::templateRuntime::test::UNKNOWN_DIRECTIVE {"Unknown"}
static

An unknown directive signature.

alexaClientSDK::capabilityAgents::templateRuntime::test::AUDIO_ITEM_ID
static const std::string AUDIO_ITEM_ID("AudioItemId abcdefgh")
An audioItemId for the RenderPlayerInfo directive.

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