![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
Test harness for AudioInputProcessor
class.
More...
Public Member Functions | |
void | SetUp () override |
Set up the test harness for running a test. More... | |
void | TearDown () override |
Clean up the test harness after running a test. More... | |
![]() | |
virtual | ~Test () |
Protected Types | |
enum | RecognizeStopPoint { RecognizeStopPoint::AFTER_RECOGNIZE, RecognizeStopPoint::AFTER_CONTEXT, RecognizeStopPoint::AFTER_FOCUS, RecognizeStopPoint::AFTER_SEND, RecognizeStopPoint::NONE } |
Enumerate different points to call stopCapture() during testRecognizeSucceeds() . More... | |
enum | StopCaptureDirectiveSchedule { StopCaptureDirectiveSchedule::BEFORE_RESPONSE_STATUS_RECEIVED, StopCaptureDirectiveSchedule::AFTER_RESPONSE_CODE_RECEIVED, StopCaptureDirectiveSchedule::AFTER_EVENT_STREAM_CLOSE, StopCaptureDirectiveSchedule::NONE } |
Protected Member Functions | |
bool | testRecognizeFails (AudioProvider audioProvider, Initiator initiator, avsCommon::avs::AudioInputStream::Index begin=AudioInputProcessor::INVALID_INDEX, avsCommon::avs::AudioInputStream::Index keywordEnd=AudioInputProcessor::INVALID_INDEX, std::string keyword="") |
bool | testRecognizeSucceeds (AudioProvider audioProvider, Initiator initiator, avsCommon::avs::AudioInputStream::Index begin=AudioInputProcessor::INVALID_INDEX, avsCommon::avs::AudioInputStream::Index keywordEnd=AudioInputProcessor::INVALID_INDEX, std::string keyword="", RecognizeStopPoint stopPoint=RecognizeStopPoint::NONE, std::shared_ptr< std::string > avsInitiator=nullptr, const std::shared_ptr< std::vector< char >> KWDMetadata=nullptr, std::string expectedFormat="", std::map< std::string, std::string > encodingFormats={}) |
bool | testStopCaptureSucceeds () |
bool | testContextFailure (avsCommon::sdkInterfaces::ContextRequestError error) |
bool | testStopCaptureDirectiveSucceeds (bool withDialogRequestId) |
bool | testStopCaptureDirectiveFails (bool withDialogRequestId) |
bool | testExpectSpeechSucceeds (bool withDialogRequestId) |
bool | testExpectSpeechWaits (bool withDialogRequestId, bool verifyTimeout) |
bool | testExpectSpeechExternalHandling (bool notifyBackOfTimeout) |
bool | testExpectSpeechFails (bool withDialogRequestId) |
bool | testRecognizeWithExpectSpeechInitiator (bool withInitiator) |
void | testRequestEncodingAudioFormatsSucceeds () |
std::shared_ptr< avsCommon::avs::AVSDirective > | createAVSDirective (const avsCommon::avs::NamespaceAndName &directive, bool withDialogRequestId, bool withInitiator=true) |
std::shared_ptr< avsCommon::avs::AVSDirective > | createAVSDirective (const avsCommon::avs::NamespaceAndName &directive, bool withDialogRequestId, bool withInitiator, rapidjson::Document &document, rapidjson::Value &payloadJson) |
void | removeDefaultAudioProvider () |
This function replace m_audioInputProcessor with a new one that does not have a default AudioProvider . More... | |
void | makeDefaultAudioProviderNotAlwaysReadable () |
void | addExpectSpeechTimeoutHandler () |
bool | testFocusChange (avsCommon::avs::FocusState state, avsCommon::avs::MixingBehavior behavior) |
void | testAIPStateTransitionOnEventResponse (avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status responseStatus, StopCaptureDirectiveSchedule stopCaptureSchedule, AudioInputProcessorObserverInterface::State expectedAIPFinalState, bool expectFocusReleased, bool closeRequest=true) |
void | setupEncoderTest () |
void | resetAudioInputProcessor () |
![]() | |
Test () | |
Static Protected Member Functions | |
static void | verifyExpectSpeechTimedOut (std::shared_ptr< avsCommon::avs::MessageRequest > request) |
Additional Inherited Members | |
![]() | |
typedef internal::SetUpTestCaseFunc | SetUpTestCaseFunc |
typedef internal::TearDownTestCaseFunc | TearDownTestCaseFunc |
![]() | |
static void | SetUpTestCase () |
static void | TearDownTestCase () |
static bool | HasFatalFailure () |
static bool | HasNonfatalFailure () |
static bool | HasFailure () |
static void | RecordProperty (const std::string &key, const std::string &value) |
static void | RecordProperty (const std::string &key, int value) |
Test harness for AudioInputProcessor
class.
|
strongprotected |
Enumerate different points to call stopCapture()
during testRecognizeSucceeds()
.
|
strongprotected |
Enumerates the different points when to pass a stop capture directive to AIP via AudioInputProcessor::handleDirectiveImmediately()
)
|
protected |
This function adds a custom ExpectSpeechHandler.
|
protected |
Function to construct an AVSDirective
for the specified namespace/name.
directive | The namespace and name to use for this directive. |
withDialogRequestId | A flag indicating whether to include a dialog request ID. |
withInitiator | A flag indicating whether the directive should have an initiator. |
AVSDirective
.
|
protected |
Function to construct an AVSDirective
for the specified namespace/name, with the given payload.
directive | The namespace and name to use for this directive. |
withDialogRequestId | A flag indicating whether to include a dialog request ID. |
withInitiator | A flag indicating whether the directive should have an initiator. |
document | The root document object to use. |
document | The payload to use. |
AVSDirective
.
|
protected |
This function replace m_audioInputProcessor
with a new one that has an AudioProvider
that is not alwaysReadable
.
|
protected |
This function replace m_audioInputProcessor
with a new one that does not have a default AudioProvider
.
|
protected |
Resets the audio input processor, call after any test.
|
overridevirtual |
Set up the test harness for running a test.
Reimplemented from testing::Test.
|
protected |
Function which does encoder specific setup
|
overridevirtual |
Clean up the test harness after running a test.
Reimplemented from testing::Test.
|
protected |
Performs a test to check the AIP correctly transitions to a state after getting notified of the response to the recognize event and/or receiving a stop capture directive.
responseStatus | The response status for the recognize request. |
stopCaptureSchedule | Specify the point when to pass a stop capture directive to AIP. |
expectedAIPFinalState | The expected final state of the AIP. |
expectFocusReleased | If true, it is expected that AIP will release the channel focus in the final state, and false otherwise. |
closeRequest | Whether onSendCompleted() should be called to simulate a stream close. |
|
protected |
Function to call AudioInputProcessor::onContextFailure() and verify that AudioInputProcessor
responds to it correctly.
error | The failure type to test. |
true
if the call works correctly, else false
.
|
protected |
Function to send an expect speech event and verify that that external handling does not result in an internal timeout.
notifyBackOfTimeout | Whether to notify the AIP of the ExpectSpeech timing out |
true
if the call works correctly, else false
.
|
protected |
Function to send an expect speech event and optionally verify that it fails.
withDialogRequestId | A flag indicating whether to send the event with a dialog request ID. |
true
if the call fails as expected, else false
.
|
protected |
Function to send an expect speech event and verify that it succeeds.
withDialogRequestId | A flag indicating whether to send the directive with a dialog request ID. |
true
if the call works correctly, else false
.
|
protected |
Function to send an expect speech event and optionally verify that it times out.
withDialogRequestId | A flag indicating whether to send the event with a dialog request ID. |
verifyTimeout | A flag indicating whether to wait for a timeout. |
true
if the call works correctly, else false
.
|
protected |
Function to call onFocusChanged()
and verify that AudioInputProcessor
responds correctly.
state | The focus state to test with. |
behavior | The MixingBehavior to test with. |
true
if the AudioInputProcessor
responds as expected, else false
.
|
protected |
Function to send a recognize event and verify that it fails. Parameters are passed through to RecognizeEvent::RecognizeEvent()
.
true
if the recognize event failed to send correctly, else false
.
|
protected |
Function to send a recognize event and verify that it succeeds. All parameters except stopPoint
are passed through to RecognizeEvent::RecognizeEvent()
.
stopPoint | Where (if at all) to call stopCapture() during this test. |
true
if the recognize event sent correctly, else false
.
|
protected |
Function to send an ExpectSpeech directive and verify the initiator is handled correctly on the subsequent Recognize.
withInitiator | A flag indicating whether the ExpectSpeech will contain the initiator. |
true
if the call succeeds, else false
.
|
protected |
Function to request AIP to produce multiple audio streams of different encodings for upcoming RecognizeEvent
|
protected |
Function to receive a StopCapture directive and verify that AudioInputProcessor
rejects it.
withDialogRequestId | A flag indicating whether to send the directive with a dialog request ID. |
true
if the call fails as expected, else false
.
|
protected |
Function to receive a StopCapture directive and verify that AudioInputProcessor
responds to it correctly.
withDialogRequestId | A flag indicating whether to send the directive with a dialog request ID. |
true
if the call works correctly, else false
.
|
protected |
Function to call AudioInputProcessor::stopCapture()
and verify that it succeeds.
true
if the call works correctly, else false
.
|
staticprotected |
This function verifies that JSON content of an ExpectSpeechTimedOut MessageRequest
is correct, and that it does not have an attachment. This function signature matches that of MessageSenderInterface::sendMessage()
so that an EXPECT_CALL()
can Invoke()
this function directly.
request | The MessageRequest to verify. |
|
protected |
The audio encoder object.
|
protected |
The AudioInputProcessor
to test.
|
protected |
The AudioProvider
to test with.
|
protected |
The CapabilityChangeNotifierInterface
.
|
protected |
|
protected |
The DialogUXStateAggregator
to test with.
|
protected |
A TestDialogUXStateObserver
track when the DialogUXStateAggregator
is thinking.
|
protected |
Message ID in directive.
|
protected |
The metric recorder.
|
protected |
|
protected |
The mock BlockAudioEncoderInterface
.
|
protected |
The mock CapabilityconfigurationChangeObserverInterface
.
|
protected |
The mock ContextManagerInterface
.
|
protected |
The mock DirectiveSequencerInterface
.
|
protected |
The mock ExceptionEncounteredSenderInterface
.
|
protected |
A mock ExpectSpeechHandler
to test with.
|
protected |
The mock FocusManagerInterface
.
|
protected |
The mock MessageSenderInterface
for AIP.
|
protected |
The mock ObserverInterface
.
|
protected |
The mock PowerResourceManagerInterface
.
|
protected |
Mock speech confirmation setting.
|
protected |
A mock of the SystemSoundPlayerInterface
.
|
protected |
The mock UserInactivityMonitorInterface
.
|
protected |
Mock wake word confirmation setting.
|
protected |
The locale and wake words settings.
|
protected |
Vector of samples holding a test pattern to feed through the AudioInputStream
.
|
protected |
The RecognizeEvent
from the last testRecognizeSucceeds()
call.
|
protected |
A AudioInputStream::Writer
to write audio data to m_audioProvider.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0