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

Public Member Functions

 ~MockNotificationRenderer ()
 
 MockNotificationRenderer ()
 
void addObserver (std::shared_ptr< NotificationRendererObserverInterface > observer) override
 
void removeObserver (std::shared_ptr< NotificationRendererObserverInterface > observer) override
 
bool renderNotification (std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, const std::string &url) override
 
bool cancelNotificationRendering () override
 
 MOCK_METHOD2 (renderNotificationShim, bool(std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, const std::string &url))
 
 MOCK_METHOD0 (cancelNotificationRenderingShim, bool())
 
bool mockRender (std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, const std::string &url)
 
bool mockCancel ()
 
bool waitForRenderCall ()
 
bool waitForRenderCallDone ()
 
bool waitUntilRenderingStarted (std::chrono::milliseconds timeout=MY_WAIT_TIMEOUT)
 
bool waitUntilRenderingFinished (std::chrono::milliseconds timeout=MY_WAIT_TIMEOUT)
 
- Public Member Functions inherited from alexaClientSDK::capabilityAgents::notifications::NotificationRendererInterface
virtual ~NotificationRendererInterface ()=default
 
virtual bool renderNotification (std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, const std::string &url)=0
 

Static Public Member Functions

static std::shared_ptr< NiceMock< MockNotificationRenderer > > create ()
 

Constructor & Destructor Documentation

◆ ~MockNotificationRenderer()

alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::~MockNotificationRenderer ( )

◆ MockNotificationRenderer()

alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::MockNotificationRenderer ( )

Member Function Documentation

◆ addObserver()

void alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::addObserver ( std::shared_ptr< NotificationRendererObserverInterface observer)
overridevirtual

Add an observer to receive a notifications about rendering notification audio clips.

Parameters
observerThe observer to call back.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationRendererInterface.

◆ cancelNotificationRendering()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::cancelNotificationRendering ( )
overridevirtual

Cancel any ongoing rendering of a notification audio clip. Further render requests will be refused until an observer callback is made to indicate that rendering has finished (i.e. cancellation is complete).

Returns
Whether or not the cancellation was allowed.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationRendererInterface.

◆ create()

static std::shared_ptr<NiceMock<MockNotificationRenderer> > alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::create ( )
inlinestatic

◆ MOCK_METHOD0()

alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::MOCK_METHOD0 ( cancelNotificationRenderingShim  ,
bool()   
)

◆ MOCK_METHOD2()

alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::MOCK_METHOD2 ( renderNotificationShim  ,
bool(std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, const std::string &url)   
)

◆ mockCancel()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::mockCancel ( )

A method mocking cancelRenderingNotification(). This method attempts to sneak in between waitForRenderCall() and waitForRenderCallDone() by triggering m_renderTrigger before m_finishedRendering has been set to true;

◆ mockRender()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::mockRender ( std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()>  audioFactory,
const std::string &  url 
)

A method mocking renderNotification(). This method kicks off two threads (for waitForRenderCall() and waitForRenderCallDone()) and then notifies those threads. This method may be interrupted by mockCancel().

Both params are ignored in this mock implementation.

◆ removeObserver()

void alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::removeObserver ( std::shared_ptr< NotificationRendererObserverInterface observer)
overridevirtual

Remove an observer from the set of observers to receive a notifications about rendering notification audio clips.

Parameters
observerThe observer to call back.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationRendererInterface.

◆ renderNotification()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::renderNotification ( std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()>  audioFactory,
const std::string &  url 
)
override

◆ waitForRenderCall()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::waitForRenderCall ( )

Waits for mockRender() to set m_startedRendering to true.

◆ waitForRenderCallDone()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::waitForRenderCallDone ( )

Waits for mockRender() to set m_finishedRendering to true.

◆ waitUntilRenderingFinished()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::waitUntilRenderingFinished ( std::chrono::milliseconds  timeout = MY_WAIT_TIMEOUT)

Waits for the fulfillment of m_renderFinishedPromise, then resets any needed variables.

◆ waitUntilRenderingStarted()

bool alexaClientSDK::capabilityAgents::notifications::test::MockNotificationRenderer::waitUntilRenderingStarted ( std::chrono::milliseconds  timeout = MY_WAIT_TIMEOUT)

Waits for the fulfillment of m_renderStartedPromise, then resets any needed variables.


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