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

Classes

class  BlueZAVRCPTargetTest
 
class  Environment
 Class used to properly initialize and tear down g_connection. More...
 
class  MockDBusProxy
 
class  MockListener
 A mock listener for the BluetoothEventBus. More...
 
class  MPRISPlayerSupportedMediaTest
 Parameterized test fixture for supported org.mpris.MediaPlayer2.Player DBus Media Methods. More...
 
class  MPRISPlayerTest
 
class  MPRISPlayerUnsupportedTest
 Parameterized test fixture for unsupported DBus Media Methods. More...
 

Functions

 TEST (BlueZA2DPSinkTest, test_createSucceeds)
 Test that a valid object is returned. More...
 
 TEST (BlueZA2DPSinkTest, test_checkSDPRecord)
 Test the correct SDP record is returned. More...
 
 TEST (BlueZAVRCPControllerTest, test_createSucceeds)
 Test that a valid object is returned. More...
 
 TEST (BlueZAVRCPControllerTest, test_checkSDPRecord)
 Test the correct SDP record is returned. More...
 
 TEST_F (BlueZAVRCPTargetTest, test_createNullFails)
 Test create() with a null proxy. Should return nullptr. More...
 
 TEST_F (BlueZAVRCPTargetTest, test_createSucceeds)
 Test create() and expect success. More...
 
 TEST_F (BlueZAVRCPTargetTest, test_playSuceeds)
 Test that play() calls the correct method. More...
 
 TEST_F (BlueZAVRCPTargetTest, test_pauseSuceeds)
 Test that pause() calls the correct method. More...
 
 TEST_F (BlueZAVRCPTargetTest, test_nextSuceeds)
 Test that next() calls the correct method. More...
 
 TEST_F (BlueZAVRCPTargetTest, test_previousSuceeds)
 Test that previous() calls the correct method. More...
 
 TEST (BlueZHFPTest, test_createSucceeds)
 Test that a valid object is returned. More...
 
 TEST (BlueZHFPTest, test_checkSDPRecord)
 Test the correct SDP record is returned. More...
 
 TEST (BlueZHIDTest, test_createSucceeds)
 Test that a valid object is returned. More...
 
 TEST (BlueZHIDTest, test_checkSDPRecord)
 Test the correct SDP record is returned. More...
 
 TEST (BlueZSPPTest, test_createSucceeds)
 Test that a valid object is returned. More...
 
 TEST (BlueZSPPTest, test_checkSDPRecord)
 Test the correct SDP record is returned. More...
 
static void onNameAcquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
 Callback passed to GDBus for when a bus name is acquired. More...
 
static void onNameLost (GDBusConnection *connection, const gchar *name, gpointer user_data)
 Callback passed to GDBus for when a bus name is lost. More...
 
 TEST_F (MPRISPlayerTest, test_createSucceeds)
 Test that the happy create() case succeeds. More...
 
 TEST_F (MPRISPlayerTest, test_createWithNullFails)
 Tests that missing parameters result in a nullptr. More...
 
 TEST_F (MPRISPlayerTest, test_playerRegistration)
 Tests that the MPRISPlayer properly registers and unregisters throughout its life time. More...
 
 INSTANTIATE_TEST_CASE_P (Parameterized, MPRISPlayerSupportedMediaTest, ::testing::Values(std::make_pair< std::string, MediaCommand >("Play", MediaCommand::PLAY), std::make_pair< std::string, MediaCommand >("Pause", MediaCommand::PAUSE), std::make_pair< std::string, MediaCommand >("Next", MediaCommand::NEXT), std::make_pair< std::string, MediaCommand >("Previous", MediaCommand::PREVIOUS)), [](testing::TestParamInfo< std::pair< std::string, MediaCommand >> info) { return info.param.first;})
 
 MATCHER_P (ContainsMediaCommand, cmd, "")
 
 TEST_P (MPRISPlayerSupportedMediaTest, test_mediaCommand)
 Test that a supported DBus method sends the correct corresponding MediaCommand. More...
 
 INSTANTIATE_TEST_CASE_P (Parameterized, MPRISPlayerUnsupportedTest, ::testing::Values("PlayPause", "Stop", "Seek", "SetPosition", "OpenUri"), [](testing::TestParamInfo< std::string > info) { return info.param;})
 
 TEST_P (MPRISPlayerUnsupportedTest, test_unsupportedMethod)
 Test that unsupported DBus methods do not send any Bluetooth events. More...
 

Variables

static std::shared_ptr< DBusConnectiong_connection
 
static const std::string UNIQUE_BUS = "org.avscppsdk.test.unique"
 Unique bus name to allow DBus method invocations. More...
 
static const std::string MPRIS_PLAYER_INTERFACE = "org.mpris.MediaPlayer2.Player"
 The interface name. More...
 

Function Documentation

◆ INSTANTIATE_TEST_CASE_P() [1/2]

alexaClientSDK::bluetoothImplementations::blueZ::test::INSTANTIATE_TEST_CASE_P ( Parameterized  ,
MPRISPlayerSupportedMediaTest  ,
::testing::Values(std::make_pair< std::string, MediaCommand >("Play", MediaCommand::PLAY), std::make_pair< std::string, MediaCommand >("Pause", MediaCommand::PAUSE), std::make_pair< std::string, MediaCommand >("Next", MediaCommand::NEXT), std::make_pair< std::string, MediaCommand >("Previous", MediaCommand::PREVIOUS))  ,
[] (testing::TestParamInfo< std::pair< std::string, MediaCommand >> info) { return info.param.first;}   
)

◆ INSTANTIATE_TEST_CASE_P() [2/2]

alexaClientSDK::bluetoothImplementations::blueZ::test::INSTANTIATE_TEST_CASE_P ( Parameterized  ,
MPRISPlayerUnsupportedTest  ,
::testing::Values("PlayPause", "Stop", "Seek", "SetPosition", "OpenUri")  ,
[] (testing::TestParamInfo< std::string > info) { return info.param;}   
)

◆ MATCHER_P()

alexaClientSDK::bluetoothImplementations::blueZ::test::MATCHER_P ( ContainsMediaCommand  ,
cmd  ,
""   
)

Custom matcher for MediaCommand expectations. This matcher is only used for BluetoothEvent objects.

Returns true if the event is of type MEDIA_COMMAND_RECEIVED and contains the expected MediaCommand.

◆ onNameAcquired()

static void alexaClientSDK::bluetoothImplementations::blueZ::test::onNameAcquired ( GDBusConnection *  connection,
const gchar *  name,
gpointer  user_data 
)
static

Callback passed to GDBus for when a bus name is acquired.

◆ onNameLost()

static void alexaClientSDK::bluetoothImplementations::blueZ::test::onNameLost ( GDBusConnection *  connection,
const gchar *  name,
gpointer  user_data 
)
static

Callback passed to GDBus for when a bus name is lost.

◆ TEST() [1/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZA2DPSinkTest  ,
test_createSucceeds   
)

Test that a valid object is returned.

◆ TEST() [2/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZHFPTest  ,
test_createSucceeds   
)

Test that a valid object is returned.

◆ TEST() [3/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZAVRCPControllerTest  ,
test_createSucceeds   
)

Test that a valid object is returned.

◆ TEST() [4/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZHIDTest  ,
test_createSucceeds   
)

Test that a valid object is returned.

◆ TEST() [5/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZSPPTest  ,
test_createSucceeds   
)

Test that a valid object is returned.

◆ TEST() [6/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZAVRCPControllerTest  ,
test_checkSDPRecord   
)

Test the correct SDP record is returned.

◆ TEST() [7/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZSPPTest  ,
test_checkSDPRecord   
)

Test the correct SDP record is returned.

◆ TEST() [8/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZA2DPSinkTest  ,
test_checkSDPRecord   
)

Test the correct SDP record is returned.

◆ TEST() [9/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZHFPTest  ,
test_checkSDPRecord   
)

Test the correct SDP record is returned.

◆ TEST() [10/10]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST ( BlueZHIDTest  ,
test_checkSDPRecord   
)

Test the correct SDP record is returned.

◆ TEST_F() [1/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( BlueZAVRCPTargetTest  ,
test_createNullFails   
)

Test create() with a null proxy. Should return nullptr.

◆ TEST_F() [2/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( BlueZAVRCPTargetTest  ,
test_createSucceeds   
)

Test create() and expect success.

◆ TEST_F() [3/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( BlueZAVRCPTargetTest  ,
test_playSuceeds   
)

Test that play() calls the correct method.

◆ TEST_F() [4/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( BlueZAVRCPTargetTest  ,
test_pauseSuceeds   
)

Test that pause() calls the correct method.

◆ TEST_F() [5/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( BlueZAVRCPTargetTest  ,
test_nextSuceeds   
)

Test that next() calls the correct method.

◆ TEST_F() [6/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( BlueZAVRCPTargetTest  ,
test_previousSuceeds   
)

Test that previous() calls the correct method.

◆ TEST_F() [7/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( MPRISPlayerTest  ,
test_createSucceeds   
)

Test that the happy create() case succeeds.

◆ TEST_F() [8/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( MPRISPlayerTest  ,
test_createWithNullFails   
)

Tests that missing parameters result in a nullptr.

◆ TEST_F() [9/9]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_F ( MPRISPlayerTest  ,
test_playerRegistration   
)

Tests that the MPRISPlayer properly registers and unregisters throughout its life time.

◆ TEST_P() [1/2]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_P ( MPRISPlayerSupportedMediaTest  ,
test_mediaCommand   
)

Test that a supported DBus method sends the correct corresponding MediaCommand.

◆ TEST_P() [2/2]

alexaClientSDK::bluetoothImplementations::blueZ::test::TEST_P ( MPRISPlayerUnsupportedTest  ,
test_unsupportedMethod   
)

Test that unsupported DBus methods do not send any Bluetooth events.

Variable Documentation

◆ g_connection

std::shared_ptr<DBusConnection> alexaClientSDK::bluetoothImplementations::blueZ::test::g_connection
static

The global dbus connection object for the tests.

The connection object is global because the bus name was being lost when we try to create/destroy temporary connection instances for each test case.

G_BUS_TYPE_SESSION is being used because G_BUS_TYPE_SYSTEM has stricter permissions.

◆ MPRIS_PLAYER_INTERFACE

const std::string alexaClientSDK::bluetoothImplementations::blueZ::test::MPRIS_PLAYER_INTERFACE = "org.mpris.MediaPlayer2.Player"
static

The interface name.

◆ UNIQUE_BUS

const std::string alexaClientSDK::bluetoothImplementations::blueZ::test::UNIQUE_BUS = "org.avscppsdk.test.unique"
static

Unique bus name to allow DBus method invocations.

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