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

Classes

class  ChannelVolumeManagerTest
 
class  MockObserver
 
class  SpeakerManagerTest
 

Functions

static int8_t defaultVolumeCurve (int8_t currentVolume)
 
 TEST_F (ChannelVolumeManagerTest, test_createTest)
 
 TEST_F (ChannelVolumeManagerTest, test_startDuckingCallAttenuatesVolume)
 
 TEST_F (ChannelVolumeManagerTest, test_stopDuckingCallRestoresVolume)
 
 TEST_F (ChannelVolumeManagerTest, test_getSpeakerSettingsReturnsUnduckedVolume)
 
 TEST_F (ChannelVolumeManagerTest, test_volumeIsRestoredToLatestUnduckedVolume)
 
 TEST_F (ChannelVolumeManagerTest, test_startDuckingWhenAlreadyDucked)
 
 TEST_F (ChannelVolumeManagerTest, test_stopDuckingWhenAlreadyUnducked)
 
static std::chrono::milliseconds TIMEOUT (1000)
 Timeout when waiting for futures to be set. More...
 
static const std::string MESSAGE_ID ("messageId")
 The MessageId identifer. More...
 
std::string generateVolumeStateJson (SpeakerInterface::SpeakerSettings settings)
 Helper function to generate the VolumeState in JSON for the ContextManager. More...
 
 TEST_F (SpeakerManagerTest, test_nullContextManager)
 
 TEST_F (SpeakerManagerTest, test_nullMessageSender)
 
 TEST_F (SpeakerManagerTest, test_nullExceptionSender)
 
 TEST_F (SpeakerManagerTest, test_noChannelVolumeInterfaces)
 
 TEST_F (SpeakerManagerTest, test_contextManagerSetStateConstructor)
 
 TEST_F (SpeakerManagerTest, test_setVolumeUnderBounds)
 
 TEST_F (SpeakerManagerTest, test_setVolumeOverBounds)
 
 TEST_F (SpeakerManagerTest, test_adjustVolumeUnderBounds)
 
 TEST_F (SpeakerManagerTest, test_adjustVolumeOverBounds)
 
 TEST_F (SpeakerManagerTest, test_getCachedSettings)
 
 TEST_F (SpeakerManagerTest, test_eventNotSentWhenAdjustVolumeUnchanged)
 
 TEST_F (SpeakerManagerTest, test_eventNotSentWhenSetVolumeUnchanged)
 
 TEST_F (SpeakerManagerTest, test_getConfiguration)
 
 TEST_F (SpeakerManagerTest, test_addDuplicatedChannelVolumeInterfaces)
 
 TEST_F (SpeakerManagerTest, test_addNullObserver)
 
 TEST_F (SpeakerManagerTest, test_removeSpeakerManagerObserver)
 
 TEST_F (SpeakerManagerTest, test_removeNullObserver)
 
 TEST_F (SpeakerManagerTest, test_retryAndApplySettingsForSetVolume)
 
 TEST_F (SpeakerManagerTest, test_retryAndApplySettingsForAdjustVolume)
 
 TEST_F (SpeakerManagerTest, test_retryAndApplySettingsForSetMute)
 
 TEST_F (SpeakerManagerTest, test_retryAndApplySettingsFails)
 
 INSTANTIATE_TEST_CASE_P (Parameterized, SpeakerManagerTest, ::testing::Values(std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME, ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME, }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME, ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME }))
 
 TEST_P (SpeakerManagerTest, test_setVolume)
 
 TEST_P (SpeakerManagerTest, test_adjustVolume)
 
 TEST_P (SpeakerManagerTest, test_setMute)
 
 TEST_P (SpeakerManagerTest, test_getSpeakerSettings)
 
 TEST_P (SpeakerManagerTest, test_setVolumeDirective)
 
 TEST_P (SpeakerManagerTest, test_adjustVolumeDirective)
 
 TEST_P (SpeakerManagerTest, test_setMuteDirective)
 
 TEST_P (SpeakerManagerTest, test_setVolumeDirectiveWhenMuted)
 

Variables

static const SpeakerInterface::SpeakerSettings INITIAL_SETTINGS {AVS_SET_VOLUME_MAX / 2, false}
 Initial Settings for underlying SpeakerInterface. More...
 
static const std::string VOLUME_PAYLOAD
 A SetVolume/AdjustVolume payload. More...
 
static const std::string MUTE_PAYLOAD
 A SetMute payload. More...
 
static const std::string UNMUTE_PAYLOAD
 A SetMute payload to unmute. More...
 
static const int8_t VALID_VOLUME_ADJUSTMENT = 10
 A valid delta to adjust the volume. More...
 

Function Documentation

◆ defaultVolumeCurve()

static int8_t alexaClientSDK::capabilityAgents::speakerManager::test::defaultVolumeCurve ( int8_t  currentVolume)
static

◆ generateVolumeStateJson()

std::string alexaClientSDK::capabilityAgents::speakerManager::test::generateVolumeStateJson ( SpeakerInterface::SpeakerSettings  settings)

Helper function to generate the VolumeState in JSON for the ContextManager.

◆ INSTANTIATE_TEST_CASE_P()

alexaClientSDK::capabilityAgents::speakerManager::test::INSTANTIATE_TEST_CASE_P ( Parameterized  ,
SpeakerManagerTest  ,
::testing::Values(std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME, ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME, }, std::vector< ChannelVolumeInterface::Type >{ ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME, ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, ChannelVolumeInterface::Type::AVS_ALERTS_VOLUME })   
)

Create different combinations of Type for parameterized tests (TEST_P).

◆ MESSAGE_ID()

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

The MessageId identifer.

◆ TEST_F() [1/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_createTest   
)

◆ TEST_F() [2/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_startDuckingCallAttenuatesVolume   
)

◆ TEST_F() [3/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_stopDuckingCallRestoresVolume   
)

◆ TEST_F() [4/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_getSpeakerSettingsReturnsUnduckedVolume   
)

◆ TEST_F() [5/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_volumeIsRestoredToLatestUnduckedVolume   
)

◆ TEST_F() [6/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_startDuckingWhenAlreadyDucked   
)

◆ TEST_F() [7/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( ChannelVolumeManagerTest  ,
test_stopDuckingWhenAlreadyUnducked   
)

◆ TEST_F() [8/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_nullContextManager   
)

Tests creating the SpeakerManager with a null contextManager.

◆ TEST_F() [9/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_nullMessageSender   
)

Tests creating the SpeakerManager with a null messageSender.

◆ TEST_F() [10/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_nullExceptionSender   
)

Tests creating the SpeakerManager with a null exceptionSender.

◆ TEST_F() [11/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_noChannelVolumeInterfaces   
)

Tests creating the SpeakerManager with no channelVolumeInterfaces.

◆ TEST_F() [12/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_contextManagerSetStateConstructor   
)

Tests that the SpeakerManager initially provides the state at constructor time.

◆ TEST_F() [13/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_setVolumeUnderBounds   
)

◆ TEST_F() [14/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_setVolumeOverBounds   
)

◆ TEST_F() [15/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_adjustVolumeUnderBounds   
)

◆ TEST_F() [16/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_adjustVolumeOverBounds   
)

◆ TEST_F() [17/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_getCachedSettings   
)

◆ TEST_F() [18/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_eventNotSentWhenAdjustVolumeUnchanged   
)

◆ TEST_F() [19/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_eventNotSentWhenSetVolumeUnchanged   
)

◆ TEST_F() [20/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_getConfiguration   
)

Test getConfiguration and ensure that all directives are handled.

◆ TEST_F() [21/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_addDuplicatedChannelVolumeInterfaces   
)

Test that adding duplicated ChannelVolumeInterface instances in the SpeakerManager works correctly.

◆ TEST_F() [22/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_addNullObserver   
)

Test that adding a null observer does not cause any errors in the SpeakerManager.

◆ TEST_F() [23/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_removeSpeakerManagerObserver   
)

Test that removing an observer works correctly.

◆ TEST_F() [24/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_removeNullObserver   
)

Test that removing a null observer does not cause any errors in the SpeakerManager.

◆ TEST_F() [25/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_retryAndApplySettingsForSetVolume   
)

◆ TEST_F() [26/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_retryAndApplySettingsForAdjustVolume   
)

◆ TEST_F() [27/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_retryAndApplySettingsForSetMute   
)

◆ TEST_F() [28/28]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_F ( SpeakerManagerTest  ,
test_retryAndApplySettingsFails   
)

◆ TEST_P() [1/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_setVolume   
)

Parameterized test for setVolume. One event should be sent if an AVS_SPEAKER_VOLUME typed speaker is modified.

◆ TEST_P() [2/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_adjustVolume   
)

Parameterized test for adjustVolume. One event should be sent if an AVS_SPEAKER_VOLUME typed speaker is modified.

◆ TEST_P() [3/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_setMute   
)

Parameterized test for setMute. One event should be sent if an AVS_SPEAKER_VOLUME typed speaker is modified.

◆ TEST_P() [4/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_getSpeakerSettings   
)

Parameterized test for getSpeakerSettings. Operation should succeed with default speaker settings.

◆ TEST_P() [5/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_setVolumeDirective   
)

Tests SetVolume Directive. Expect that the volume is unmuted and set, as well at most one event is sent. In the event there are no AVS_SPEAKER_VOLUME speakers registered, no event will be sent. In addition, only AVS_SPEAKER_VOLUME speakers should be affected.

◆ TEST_P() [6/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_adjustVolumeDirective   
)

Tests AdjustVolume Directive. Expect that the volume is unmuted and adjusted, as well at most one event is sent. In the event there are no AVS_SPEAKER_VOLUME speakers registered, no event will be sent. In addition, only AVS_SPEAKER_VOLUME speakers should be affected.

◆ TEST_P() [7/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_setMuteDirective   
)

Tests SetMute Directive. Expect that the volume is muted, as well at most one event is sent. In the event there are no AVS_SPEAKER_VOLUME speakers registered, no event will be sent. In addition, only AVS_SPEAKER_VOLUME speakers should be affected.

◆ TEST_P() [8/8]

alexaClientSDK::capabilityAgents::speakerManager::test::TEST_P ( SpeakerManagerTest  ,
test_setVolumeDirectiveWhenMuted   
)

Test setVolume when unmute Directive sent. Setup test by setting volume to 0 and mute to true. Expect that the volume is unmuted and set to MIN_UNMUTE_VOLUME, as well at most one event is sent. In the event there are no AVS_SPEAKER_VOLUME speakers registered, no event will be sent. In addition, only AVS_SPEAKER_VOLUME speakers should be affected.

◆ TIMEOUT()

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

Timeout when waiting for futures to be set.

Variable Documentation

◆ INITIAL_SETTINGS

const SpeakerInterface::SpeakerSettings alexaClientSDK::capabilityAgents::speakerManager::test::INITIAL_SETTINGS {AVS_SET_VOLUME_MAX / 2, false}
static

Initial Settings for underlying SpeakerInterface.

◆ MUTE_PAYLOAD

const std::string alexaClientSDK::capabilityAgents::speakerManager::test::MUTE_PAYLOAD
static
Initial value:
=
"{"
"\"mute\":" +
""
"}"
static const std::string MUTE_STRING("true")
String value for mute.

A SetMute payload.

◆ UNMUTE_PAYLOAD

const std::string alexaClientSDK::capabilityAgents::speakerManager::test::UNMUTE_PAYLOAD
static
Initial value:
=
"{"
"\"mute\":" +
""
"}"
static const std::string UNMUTE_STRING("false")
String value for unmute.

A SetMute payload to unmute.

◆ VALID_VOLUME_ADJUSTMENT

const int8_t alexaClientSDK::capabilityAgents::speakerManager::test::VALID_VOLUME_ADJUSTMENT = 10
static

A valid delta to adjust the volume.

◆ VOLUME_PAYLOAD

const std::string alexaClientSDK::capabilityAgents::speakerManager::test::VOLUME_PAYLOAD
static
Initial value:
=
"{"
"\"volume\":" +
std::to_string(AVS_SET_VOLUME_MAX) +
""
"}"
const int8_t AVS_SET_VOLUME_MAX
AVS setVolume Maximum.
Definition: SpeakerConstants.h:33

A SetVolume/AdjustVolume payload.

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