AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Macros | Functions | Variables
ExternalMediaPlayerTest.cpp File Reference
#include <chrono>
#include <future>
#include <map>
#include <memory>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <AVSCommon/AVS/Attachment/AttachmentManager.h>
#include <AVSCommon/SDKInterfaces/MockExceptionEncounteredSender.h>
#include <AVSCommon/SDKInterfaces/MockChannelVolumeInterface.h>
#include <AVSCommon/SDKInterfaces/MockContextManager.h>
#include <AVSCommon/SDKInterfaces/MockDirectiveHandlerResult.h>
#include <AVSCommon/SDKInterfaces/MockDirectiveSequencer.h>
#include <AVSCommon/SDKInterfaces/MockFocusManager.h>
#include <AVSCommon/SDKInterfaces/MockMessageSender.h>
#include <AVSCommon/SDKInterfaces/MockPlaybackRouter.h>
#include <AVSCommon/SDKInterfaces/MockRenderPlayerInfoCardsObserverInterface.h>
#include <AVSCommon/SDKInterfaces/MockSpeakerManager.h>
#include <AVSCommon/SDKInterfaces/Endpoints/MockEndpointCapabilitiesRegistrar.h>
#include <AVSCommon/Utils/JSON/JSONUtils.h>
#include <AVSCommon/Utils/MediaPlayer/MockMediaPlayer.h>
#include <AVSCommon/Utils/Metrics/MockMetricRecorder.h>
#include <MockCertifiedSender.h>
#include <acsdkApplicationAudioPipelineFactoryInterfaces/MockApplicationAudioPipelineFactory.h>
#include <acsdkShutdownManagerInterfaces/MockShutdownNotifier.h>
#include <acsdkStartupManagerInterfaces/MockStartupNotifier.h>
#include <acsdkStartupManagerInterfaces/StartupNotifierInterface.h>
#include "acsdkExternalMediaPlayer/ExternalMediaPlayer.h"
#include "acsdkExternalMediaPlayer/ExternalMediaAdapterHandler.h"
#include "acsdkExternalMediaPlayer/MockExternalMediaAdapterHandler.h"
#include <acsdkExternalMediaPlayerInterfaces/MockExternalMediaPlayerAdapter.h>
#include <acsdkExternalMediaPlayerInterfaces/MockExternalMediaPlayerObserver.h>
Include dependency graph for ExternalMediaPlayerTest.cpp:

Classes

class  alexaClientSDK::acsdkExternalMediaPlayer::test::MockRenderPlayerInfoCardsProviderRegistrar
 
class  alexaClientSDK::acsdkExternalMediaPlayer::test::ExternalMediaPlayerTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::acsdkExternalMediaPlayer
 
 alexaClientSDK::acsdkExternalMediaPlayer::test
 

Macros

#define LX(event)   alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
 

Functions

static std::chrono::milliseconds alexaClientSDK::acsdkExternalMediaPlayer::test::MY_WAIT_TIMEOUT (5000)
 Plenty of time for a test to complete. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MESSAGE_ID_TEST ("MessageId_Test")
 Message Id for testing. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MESSAGE_ID_TEST2 ("MessageId_Test2")
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::DIALOG_REQUEST_ID_TEST ("DialogId_Test")
 Dialog Request Id for testing. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::TAG ("ExternalMediaPlayerTest")
 String to identify log entries originating from this file. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MSP1_LOCAL_PLAYER_ID ("MSP1_LOCAL_PLAYER_ID")
 Music service provider id 1. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MSP1_PLAYER_ID ("MSP1_PLAYERID")
 Cloud assigned playerId for this MSP. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MSP1_SKILLTOKEN ("MSP1_SKILLTOKEN")
 Associated skillToken for this MSP. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MSP2_LOCAL_PLAYER_ID ("MSP2_LOCAL_PLAYER_ID")
 Music service provider id 2. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MSP2_PLAYER_ID ("MSP2_PLAYERID")
 Cloud assigned playerId for this MSP. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::MSP2_SKILLTOKEN ("MSP2_SKILLTOKEN")
 Associated skillToken for this MSP. More...
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::MATCHER_P2 (EventNamed, expectedNameSpace, expectedName, "")
 
static AdapterState alexaClientSDK::acsdkExternalMediaPlayer::test::createAdapterState ()
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createAuthorizeDiscoveredPlayersPayload (std::unordered_set< std::string > players=std::unordered_set< std::string >())
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayerJson (const std::string &localPlayerId, bool authorized, const std::string &playerId, const std::string &skillToken)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::getIdleSessionStateJson (std::string agent)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayloadWithParseError (const std::string &playContext, int index, int64_t offsetInMilliseconds, const std::string &playerId, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPayloadWithPlayerId (const std::string &playerId)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayload (const std::string &playContext, int index, int64_t offsetInMilliseconds, const std::string &playerId, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayloadWithPlayRequestor (const std::string &playContext, int index, int64_t offsetInMilliseconds, const std::string &playerId, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload, const PlayRequestor &playRequestor)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayloadNoContext (int index, int64_t offsetInMilliseconds, const std::string &playerId, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayloadNoPlayerId (const std::string &playContext, int index, int64_t offsetInMilliseconds, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayloadNoIndex (const std::string &playContext, int64_t offsetInMilliseconds, const std::string &playerId, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createPlayPayloadNoOffset (const std::string &playContext, int index, const std::string &playerId, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createLoginPayload (const std::string &accessToken, const std::string &userName, int64_t refreshInterval, bool forceLogin, const std::string &playerId)
 
static std::string alexaClientSDK::acsdkExternalMediaPlayer::test::createSeekPayload (int64_t timeOffset, const std::string &playerId, bool adjustSeek)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_createWithNullPointers)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_getConfiguration)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_callingProvideSessionState)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_callingProvidePlaybackState)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playParserError)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playNoAdapter)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playNoPlayContext)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playNoPlayerId)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playNoOffset)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testPlaywithPlayRequestor)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playNoIndex)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_logout)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_login)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_loginStateChangeObserverIsNotified)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playbackStateChangeObserverIsNotified)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_loginStateChangeObserverRemoval)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_playbackStateChangeObserverRemoval)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_play)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_pause)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testStop)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_stop)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_next)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_previous)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_startOver)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_rewind)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_fastForward)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_enableRepeatOne)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_enableRepeat)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_disableRepeat)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_enableShuffle)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_disableShuffle)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_favorite)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_unfavorite)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_incorrectDirective)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_seekFailure)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_seekSuccess)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_adjustSeekFailure)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_adjustSeekFailure2)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, test_adjustSeekSuccess)
 
static void alexaClientSDK::acsdkExternalMediaPlayer::test::verifyAuthorizationCompletePayload (std::shared_ptr< MessageRequest > request, std::unordered_map< std::string, std::string > expectedAuthorized, std::unordered_set< std::string > expectedDeauthorized=std::unordered_set< std::string >())
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testReportDiscoveredPlayers)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testTimer_AuthorizeDiscoveredPlayersSuccess)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testMultipleAuthorizeDiscoveredPlayersSuccess)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testSetPlayerInFocusSucceedsForAuthorized)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testSetPlayerInFocusFailsForAuthorized)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testSetPlayerInFocusNotfiesTemplateRuntimeObserver)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testSamePlayerIdWhenHandleAuthorizedSuccess)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testAddAdapterHandlerDiscovery)
 
 alexaClientSDK::acsdkExternalMediaPlayer::test::TEST_F (ExternalMediaPlayerTest, testAddAdapterHandlerDiscoveryAggregatedUntilStartup)
 

Variables

static const unsigned int alexaClientSDK::acsdkExternalMediaPlayer::test::PROVIDE_STATE_TOKEN_TEST {1}
 Provide State Token for testing. More...
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::EXTERNALMEDIAPLAYER_STATE_NAMESPACE = "ExternalMediaPlayer"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYBACKSTATEREPORTER_STATE_NAMESPACE = "Alexa.PlaybackStateReporter"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::EXTERNALMEDIAPLAYER_NAME = "ExternalMediaPlayerState"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYBACKSTATEREPORTER_NAME = "playbackState"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::EXTERNALMEDIAPLAYER_NAMESPACE = "ExternalMediaPlayer"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYBACKCONTROLLER_NAMESPACE = "Alexa.PlaybackController"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYLISTCONTROLLER_NAMESPACE = "Alexa.PlaylistController"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::SEEKCONTROLLER_NAMESPACE = "Alexa.SeekController"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::FAVORITESCONTROLLER_NAMESPACE = "Alexa.FavoritesController"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYER_USER_NAME = "userName"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYER_TRACK = "testTrack"
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYER_STATE = "IDLE"
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::PLAY_DIRECTIVE {EXTERNALMEDIAPLAYER_NAMESPACE, "Play"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::LOGIN_DIRECTIVE {EXTERNALMEDIAPLAYER_NAMESPACE, "Login"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::LOGOUT_DIRECTIVE {EXTERNALMEDIAPLAYER_NAMESPACE, "Logout"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::AUTHORIZEDISCOVEREDPLAYERS_DIRECTIVE
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::RESUME_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "Play"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::PAUSE_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "Pause"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::STOP_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "Stop"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::NEXT_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "Next"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::PREVIOUS_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "Previous"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::STARTOVER_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "StartOver"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::REWIND_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "Rewind"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::FASTFORWARD_DIRECTIVE {PLAYBACKCONTROLLER_NAMESPACE, "FastForward"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::ENABLEREPEATONE_DIRECTIVE {PLAYLISTCONTROLLER_NAMESPACE, "EnableRepeatOne"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::ENABLEREPEAT_DIRECTIVE {PLAYLISTCONTROLLER_NAMESPACE, "EnableRepeat"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::DISABLEREPEAT_DIRECTIVE {PLAYLISTCONTROLLER_NAMESPACE, "DisableRepeat"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::ENABLESHUFFLE_DIRECTIVE {PLAYLISTCONTROLLER_NAMESPACE, "EnableShuffle"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::DISABLESHUFFLE_DIRECTIVE {PLAYLISTCONTROLLER_NAMESPACE, "DisableShuffle"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::SEEK_DIRECTIVE {SEEKCONTROLLER_NAMESPACE, "SetSeekPosition"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::ADJUSTSEEK_DIRECTIVE {SEEKCONTROLLER_NAMESPACE, "AdjustSeekPosition"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::FAVORITE_DIRECTIVE {FAVORITESCONTROLLER_NAMESPACE, "Favorite"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::UNFAVORITE_DIRECTIVE {FAVORITESCONTROLLER_NAMESPACE, "Unfavorite"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::SESSION_STATE {EXTERNALMEDIAPLAYER_STATE_NAMESPACE, EXTERNALMEDIAPLAYER_NAME}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::PLAYBACK_STATE {PLAYBACKSTATEREPORTER_STATE_NAMESPACE, PLAYBACKSTATEREPORTER_NAME}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::REPORT_DISCOVERED_PLAYERS {EXTERNALMEDIAPLAYER_NAMESPACE, "ReportDiscoveredPlayers"}
 
static const NamespaceAndName alexaClientSDK::acsdkExternalMediaPlayer::test::AUTHORIZATION_COMPLETE {EXTERNALMEDIAPLAYER_NAMESPACE, "AuthorizationComplete"}
 
static const PlayRequestor alexaClientSDK::acsdkExternalMediaPlayer::test::testPlayRequestor {.type = "ALERT", .id = "123"}
 
static const std::string alexaClientSDK::acsdkExternalMediaPlayer::test::IDLE_PLAYBACK_STATE
 

Macro Definition Documentation

◆ LX

#define LX (   event)    alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

Create a LogEntry using this file's TAG and the specified event string.

Parameters
Theevent string for this LogEntry.

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