AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Functions | Variables
alexaClientSDK::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 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_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, 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::templateRuntime::test::AUDIO_ITEM_ID ( "AudioItemId abcdefgh"  )
static

An audioItemId for the RenderPlayerInfo directive.

◆ AUDIO_ITEM_ID_1()

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

An audioItemId without a corresponding RenderPlayerInfo directive.

◆ MESSAGE_ID()

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

The MessageId identifer.

◆ TEMPLATE_NOT_CLEAR_TIMEOUT()

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

Timeout when waiting for clearTemplateCard not called.

◆ TEMPLATE_TIMEOUT()

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

Timeout when waiting for clearTemplateCard.

◆ TEST() [1/3]

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

Verify getProviders() returns the set of registered providers.

◆ TEST() [2/3]

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

Verify registering a provider fails if it is a duplicate.

◆ TEST() [3/3]

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

Verify registering a null provider fails.

◆ TEST_F() [1/16]

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

Tests creating the TemplateRuntime with a null audioPlayerInterface.

◆ TEST_F() [2/16]

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

Tests creating the TemplateRuntime with a null exceptionSender.

◆ TEST_F() [3/16]

alexaClientSDK::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() [4/16]

alexaClientSDK::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() [5/16]

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

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

◆ TEST_F() [6/16]

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

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

◆ TEST_F() [7/16]

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

Tests RenderTemplate Directive. Expect that the renderTemplateCard callback will be called and then goes EXPECTING and SPEAKING state.

◆ TEST_F() [8/16]

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

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

◆ TEST_F() [9/16]

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

Tests RenderTemplate Directive received before the corresponding AudioPlayer call. Expect that the renderPlayerInfoCard callback will be called only after media starts playing.

◆ TEST_F() [10/16]

alexaClientSDK::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() [11/16]

alexaClientSDK::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() [12/16]

alexaClientSDK::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() [13/16]

alexaClientSDK::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() [14/16]

alexaClientSDK::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() [15/16]

alexaClientSDK::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() [16/16]

alexaClientSDK::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::templateRuntime::test::TIMEOUT ( 1000  )
static

Timeout when waiting for futures to be set.

Variable Documentation

◆ MALFORM_PLAYERINFO_PAYLOAD

const std::string alexaClientSDK::templateRuntime::test::MALFORM_PLAYERINFO_PAYLOAD
static
Initial value:
=
"{"
"\"audioItemId\"::::\"" +
"\","
"\"content\":{{{{"
"\"title\":\"TITLE\","
"\"header\":\"HEADER\""
"}"
"}"
static const std::string AUDIO_ITEM_ID("AudioItemId abcdefgh")
An audioItemId for the RenderPlayerInfo directive.

A malformed RenderPlayerInfo directive payload.

◆ NAMESPACE

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

The namespace for this capability agent.

◆ PLAYER_INFO

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

The RenderPlayerInfo directive signature.

◆ PLAYERINFO_PAYLOAD

const std::string alexaClientSDK::templateRuntime::test::PLAYERINFO_PAYLOAD
static
Initial value:
=
"{"
"\"audioItemId\":\"" +
"\","
"\"content\":{"
"\"title\":\"TITLE\","
"\"header\":\"HEADER\""
"}"
"}"
static const std::string AUDIO_ITEM_ID("AudioItemId abcdefgh")
An audioItemId for the RenderPlayerInfo directive.

A RenderPlayerInfo directive payload.

◆ TEMPLATE

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

The RenderTemplate directive signature.

◆ TEMPLATE_PAYLOAD

const std::string alexaClientSDK::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::templateRuntime::test::UNKNOWN_DIRECTIVE {"Unknown"}
static

An unknown directive signature.

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