AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Typedefs | Functions | Variables
alexaClientSDK::applicationUtilities::androidUtilities::test Namespace Reference

Classes

class  AndroidSLESBufferQueueTest
 
class  AndroidSLESMicrophoneTest
 
class  AndroidSLESObjectTest
 
class  MockAndroidSLESObject
 
class  MockInterface
 
class  MockInterfaceImpl
 

Typedefs

using MockSlSimpleBufferQueue = MockInterfaceImpl< SLAndroidSimpleBufferQueueItf_ >
 

Functions

 TEST (AndroidLoggerTest, test_sanityTestOk)
 Test a valid log entry. More...
 
 TEST (AndroidLoggerTest, test_sanityTestNullThreadMoniker)
 Test a log entry with null threadMoniker. More...
 
 TEST (AndroidLoggerTest, test_sanityTestNullText)
 Test a log entry with null text. More...
 
 TEST (AndroidLoggerTest, test_sanityTestLevels)
 Test all levels. More...
 
static SLresult mockRegisterCallbackOk (SLAndroidSimpleBufferQueueItf self, slAndroidSimpleBufferQueueCallback callback, void *pCallbackContext)
 
static SLresult mockRegisterCallbackFailure (SLAndroidSimpleBufferQueueItf self, slAndroidSimpleBufferQueueCallback callback, void *pCallbackContext)
 
static SLresult mockClear (SLAndroidSimpleBufferQueueItf self)
 
SLresult mockEnqueue (SLAndroidSimpleBufferQueueItf self, const void *pBuffer, SLuint32 size)
 
SLresult mockEnqueueFailed (SLAndroidSimpleBufferQueueItf self, const void *pBuffer, SLuint32 size)
 
SLresult mockEnqueueHalf (SLAndroidSimpleBufferQueueItf self, const void *pBuffer, SLuint32 size)
 
SLresult mockGetState (SLAndroidSimpleBufferQueueItf self, SLAndroidSimpleBufferQueueState *pState)
 
 TEST_F (AndroidSLESBufferQueueTest, test_registerCallbackSucceeded)
 
 TEST_F (AndroidSLESBufferQueueTest, test_registerCallbackFailed)
 
 TEST_F (AndroidSLESBufferQueueTest, test_enqueueOK)
 
 TEST_F (AndroidSLESBufferQueueTest, test_enqueueFailed)
 
 TEST_F (AndroidSLESBufferQueueTest, test_enqueuePartial)
 
 TEST_F (AndroidSLESBufferQueueTest, test_onBufferCompleted)
 
 TEST_F (AndroidSLESMicrophoneTest, test_startRecording)
 
 TEST_F (AndroidSLESMicrophoneTest, test_pauseRecording)
 
 TEST_F (AndroidSLESMicrophoneTest, test_unPauseRecording)
 
 TEST_F (AndroidSLESMicrophoneTest, test_longRecording)
 
SLresult mockRealizeSucceed (SLObjectItf self, SLboolean async)
 Mock realize that succeeds. More...
 
SLresult mockRealizeFail (SLObjectItf self, SLboolean async)
 Mock realize that fails. More...
 
void mockDestroy (SLObjectItf self)
 Mock destroy and keep track that the method was called once. More...
 
SLresult mockGetInterface (SLObjectItf self, const SLInterfaceID iid, void *pInterface)
 Mock get interface. More...
 
 TEST_F (AndroidSLESObjectTest, test_createDestroySucceed)
 
 TEST_F (AndroidSLESObjectTest, test_createFailed)
 
 TEST_F (AndroidSLESObjectTest, test_getInterface)
 
 TEST_F (AndroidSLESObjectTest, test_getInterfaceFailed)
 
SLresult realizeSucceed (SLObjectItf self, SLboolean async)
 
SLresult realizeFailed (SLObjectItf self, SLboolean async)
 
SLresult getMockInterface (SLObjectItf self, SLInterfaceID id, void *interface)
 

Variables

static constexpr size_t SAMPLE_RATE_HZ {16000}
 The sample rate of microphone audio data. More...
 
static constexpr std::chrono::seconds AMOUNT_OF_AUDIO_DATA_IN_BUFFER {10}
 The amount of audio data to keep in the ring buffer. More...
 
static const auto NUMBER_OF_BUFFERS = AndroidSLESBufferQueue::NUMBER_OF_BUFFERS
 
static constexpr size_t SDS_BUFFER_SIZE = (SAMPLE_RATE_HZ)*AMOUNT_OF_AUDIO_DATA_IN_BUFFER.count()
 The size of the ring buffer. More...
 
static constexpr size_t SAMPLE_RATE_HZ {16000}
 The sample rate of microphone audio data. More...
 
static constexpr std::chrono::seconds AMOUNT_OF_AUDIO_DATA_IN_BUFFER {10}
 The amount of audio data to keep in the ring buffer. More...
 
static constexpr size_t SDS_BUFFER_SIZE = (SAMPLE_RATE_HZ)*AMOUNT_OF_AUDIO_DATA_IN_BUFFER.count()
 The size of the ring buffer. More...
 
static constexpr std::chrono::milliseconds TIMEOUT {1100}
 Reader timeout. More...
 
static constexpr size_t TEST_BUFFER_SIZE {4096u}
 The size of reader buffer is one page long. More...
 
static std::unordered_map< SLInterfaceID, std::shared_ptr< MockInterface > > g_interfaces
 

Typedef Documentation

◆ MockSlSimpleBufferQueue

Function Documentation

◆ getMockInterface()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::getMockInterface ( SLObjectItf  self,
SLInterfaceID  id,
void *  interface 
)

◆ mockClear()

static SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockClear ( SLAndroidSimpleBufferQueueItf  self)
static

◆ mockDestroy()

void alexaClientSDK::applicationUtilities::androidUtilities::test::mockDestroy ( SLObjectItf  self)

Mock destroy and keep track that the method was called once.

◆ mockEnqueue()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockEnqueue ( SLAndroidSimpleBufferQueueItf  self,
const void *  pBuffer,
SLuint32  size 
)

Mock enqueue success.

Parameters
selfignored.
pBufferignored.
sizeignored.
Returns
SL_RESULT_SUCCESS.

◆ mockEnqueueFailed()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockEnqueueFailed ( SLAndroidSimpleBufferQueueItf  self,
const void *  pBuffer,
SLuint32  size 
)

Mock enqueue failure.

Parameters
selfignored.
pBufferignored.
sizeignored.
Returns
Internal error.

◆ mockEnqueueHalf()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockEnqueueHalf ( SLAndroidSimpleBufferQueueItf  self,
const void *  pBuffer,
SLuint32  size 
)

Mock partial enqueue.

Parameters
selfignored.
pBufferignored.
sizeignored.
Returns
Success for half of the buffers, and false after.

◆ mockGetInterface()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockGetInterface ( SLObjectItf  self,
const SLInterfaceID  iid,
void *  pInterface 
)

Mock get interface.

◆ mockGetState()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockGetState ( SLAndroidSimpleBufferQueueItf  self,
SLAndroidSimpleBufferQueueState *  pState 
)

◆ mockRealizeFail()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockRealizeFail ( SLObjectItf  self,
SLboolean  async 
)

Mock realize that fails.

◆ mockRealizeSucceed()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockRealizeSucceed ( SLObjectItf  self,
SLboolean  async 
)

Mock realize that succeeds.

◆ mockRegisterCallbackFailure()

static SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockRegisterCallbackFailure ( SLAndroidSimpleBufferQueueItf  self,
slAndroidSimpleBufferQueueCallback  callback,
void *  pCallbackContext 
)
static

◆ mockRegisterCallbackOk()

static SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::mockRegisterCallbackOk ( SLAndroidSimpleBufferQueueItf  self,
slAndroidSimpleBufferQueueCallback  callback,
void *  pCallbackContext 
)
static

◆ realizeFailed()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::realizeFailed ( SLObjectItf  self,
SLboolean  async 
)

◆ realizeSucceed()

SLresult alexaClientSDK::applicationUtilities::androidUtilities::test::realizeSucceed ( SLObjectItf  self,
SLboolean  async 
)

◆ TEST() [1/4]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST ( AndroidLoggerTest  ,
test_sanityTestOk   
)

Test a valid log entry.

◆ TEST() [2/4]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST ( AndroidLoggerTest  ,
test_sanityTestNullThreadMoniker   
)

Test a log entry with null threadMoniker.

◆ TEST() [3/4]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST ( AndroidLoggerTest  ,
test_sanityTestNullText   
)

Test a log entry with null text.

◆ TEST() [4/4]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST ( AndroidLoggerTest  ,
test_sanityTestLevels   
)

Test all levels.

◆ TEST_F() [1/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESObjectTest  ,
test_createDestroySucceed   
)

Test create method when the provided object can be realized.

◆ TEST_F() [2/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESMicrophoneTest  ,
test_startRecording   
)

Test if recording works.

◆ TEST_F() [3/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESMicrophoneTest  ,
test_pauseRecording   
)

Test if the stopStreamingMicrophoneData will stop writing to the buffer.

◆ TEST_F() [4/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESObjectTest  ,
test_createFailed   
)

Test create method when the provided object cannot be realized.

◆ TEST_F() [5/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESMicrophoneTest  ,
test_unPauseRecording   
)

Test if recording works after mute / unmute.

◆ TEST_F() [6/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESObjectTest  ,
test_getInterface   
)

Test get interface when method succeeds.

◆ TEST_F() [7/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESMicrophoneTest  ,
test_longRecording   
)

Test recording for a full iteration on the buffer circular queue.

◆ TEST_F() [8/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESObjectTest  ,
test_getInterfaceFailed   
)

Test get interface when method fails.

◆ TEST_F() [9/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESBufferQueueTest  ,
test_registerCallbackSucceeded   
)

Test successful creation.

◆ TEST_F() [10/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESBufferQueueTest  ,
test_registerCallbackFailed   
)

Test the callback register failure.

◆ TEST_F() [11/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESBufferQueueTest  ,
test_enqueueOK   
)

Test enqueue succeeded.

◆ TEST_F() [12/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESBufferQueueTest  ,
test_enqueueFailed   
)

Test enqueue failed.

◆ TEST_F() [13/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESBufferQueueTest  ,
test_enqueuePartial   
)

Test enqueue succeeded to enqueue a few buffers.

◆ TEST_F() [14/14]

alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_F ( AndroidSLESBufferQueueTest  ,
test_onBufferCompleted   
)

Test onBufferCompleted.

Variable Documentation

◆ AMOUNT_OF_AUDIO_DATA_IN_BUFFER [1/2]

constexpr std::chrono::seconds alexaClientSDK::applicationUtilities::androidUtilities::test::AMOUNT_OF_AUDIO_DATA_IN_BUFFER {10}
static

The amount of audio data to keep in the ring buffer.

◆ AMOUNT_OF_AUDIO_DATA_IN_BUFFER [2/2]

constexpr std::chrono::seconds alexaClientSDK::applicationUtilities::androidUtilities::test::AMOUNT_OF_AUDIO_DATA_IN_BUFFER {10}
static

The amount of audio data to keep in the ring buffer.

◆ g_interfaces

std::unordered_map<SLInterfaceID, std::shared_ptr<MockInterface> > alexaClientSDK::applicationUtilities::androidUtilities::test::g_interfaces
static

◆ NUMBER_OF_BUFFERS

const auto alexaClientSDK::applicationUtilities::androidUtilities::test::NUMBER_OF_BUFFERS = AndroidSLESBufferQueue::NUMBER_OF_BUFFERS
static

The number of buffers used by the AndroidSLESBufferQueue object. Redefine it here because of the ODR (one definition rule) use by EXPECT.

◆ SAMPLE_RATE_HZ [1/2]

constexpr size_t alexaClientSDK::applicationUtilities::androidUtilities::test::SAMPLE_RATE_HZ {16000}
static

The sample rate of microphone audio data.

◆ SAMPLE_RATE_HZ [2/2]

constexpr size_t alexaClientSDK::applicationUtilities::androidUtilities::test::SAMPLE_RATE_HZ {16000}
static

The sample rate of microphone audio data.

◆ SDS_BUFFER_SIZE [1/2]

constexpr size_t alexaClientSDK::applicationUtilities::androidUtilities::test::SDS_BUFFER_SIZE = (SAMPLE_RATE_HZ)*AMOUNT_OF_AUDIO_DATA_IN_BUFFER.count()
static

The size of the ring buffer.

◆ SDS_BUFFER_SIZE [2/2]

constexpr size_t alexaClientSDK::applicationUtilities::androidUtilities::test::SDS_BUFFER_SIZE = (SAMPLE_RATE_HZ)*AMOUNT_OF_AUDIO_DATA_IN_BUFFER.count()
static

The size of the ring buffer.

◆ TEST_BUFFER_SIZE

constexpr size_t alexaClientSDK::applicationUtilities::androidUtilities::test::TEST_BUFFER_SIZE {4096u}
static

The size of reader buffer is one page long.

◆ TIMEOUT

constexpr std::chrono::milliseconds alexaClientSDK::applicationUtilities::androidUtilities::test::TIMEOUT {1100}
static

Reader timeout.

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