summaryrefslogtreecommitdiff
path: root/PluginRoutingInterfaceCAPI/test
diff options
context:
space:
mode:
Diffstat (limited to 'PluginRoutingInterfaceCAPI/test')
-rw-r--r--PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp105
-rw-r--r--PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h6
2 files changed, 111 insertions, 0 deletions
diff --git a/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp b/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp
index 83fa6e9..7999c73 100644
--- a/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp
+++ b/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp
@@ -719,6 +719,69 @@ TEST_F(CAmRoutingInterfaceCAPITests, deregisterGateway)
EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
}
+MATCHER_P(IsConverterDataEqualTo, value, "") {
+ auto lh = arg;
+ return lh.converterID == value.converterID &&
+ lh.name == value.name &&
+ lh.sinkID == value.sinkID &&
+ lh.sourceID == value.sourceID &&
+ lh.domainID == value.domainID &&
+ lh.listSourceFormats == value.listSourceFormats &&
+ lh.listSinkFormats == value.listSinkFormats &&
+ lh.convertionMatrix == value.convertionMatrix;
+}
+
+TEST_F(CAmRoutingInterfaceCAPITests, registerConverter)
+{
+ ASSERT_TRUE(env->mIsServiceAvailable);
+ if(env->mIsServiceAvailable)
+ {
+ CallStatus callStatus = CallStatus::NOT_AVAILABLE;
+ org::genivi::am::am_Error_e error = org::genivi::am::am_Error_e::E_UNKNOWN;
+
+ org::genivi::am::am_ConnectionFormat_L listSourceFormats;
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+ org::genivi::am::am_ConnectionFormat_L listSinkFormats;
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+ org::genivi::am::am_Convertion_L convertionMatrix;
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+
+ org::genivi::am::am_converterID_t converterID = 0;
+ org::genivi::am::am_Converter_s gateway(converterID, "name", 103, 104, 105, listSourceFormats, listSinkFormats, convertionMatrix);
+ am_Converter_s amGateway;
+ CAmConvertCAPI2AM(gateway, amGateway);
+
+ ON_CALL(*env->mpRoutingReceive, registerConverter(_, _)).WillByDefault(Return(E_OK));
+ EXPECT_CALL(*env->mpRoutingReceive, registerConverter(IsConverterDataEqualTo(amGateway), _)).WillOnce(DoAll(actionRegisterGateway(), Return(E_OK)));
+ env->mProxy->registerConverter(gateway, callStatus, converterID, error);
+ ASSERT_EQ( converterID, TEST_ID_1 );
+ ASSERT_EQ( error, org::genivi::am::am_Error_e::E_OK );
+ ASSERT_EQ( callStatus, CallStatus::SUCCESS );
+ }
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
+}
+
+TEST_F(CAmRoutingInterfaceCAPITests, deregisterConverter)
+{
+ ASSERT_TRUE(env->mIsServiceAvailable);
+ if(env->mIsServiceAvailable)
+ {
+ CallStatus callStatus = CallStatus::NOT_AVAILABLE;
+ org::genivi::am::am_Error_e error = org::genivi::am::am_Error_e::E_UNKNOWN;
+ org::genivi::am::am_converterID_t converterID = TEST_ID_1;
+
+ ON_CALL(*env->mpRoutingReceive, deregisterConverter(_)).WillByDefault(Return(E_OK));
+ EXPECT_CALL(*env->mpRoutingReceive, deregisterConverter(converterID)).WillOnce(Return(E_OK));
+ env->mProxy->deregisterConverter(converterID, callStatus, error);
+ ASSERT_EQ( error, org::genivi::am::am_Error_e::E_OK );
+ ASSERT_EQ( callStatus, CallStatus::SUCCESS );
+ }
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
+}
+
ACTION(actionPeek){
arg1=TEST_ID_1;
}
@@ -1281,6 +1344,48 @@ TEST_F(CAmRoutingInterfaceCAPITests, updateGateway)
EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
}
+TEST_F(CAmRoutingInterfaceCAPITests, updateConverter)
+{
+ ASSERT_TRUE(env->mIsServiceAvailable);
+ if(env->mIsServiceAvailable)
+ {
+ CallStatus callStatus = CallStatus::NOT_AVAILABLE;
+ am_Error_e error = E_OK;
+ org::genivi::am::am_converterID_t testID = TEST_ID_1;
+
+ org::genivi::am::am_ConnectionFormat_L listSourceFormats;
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+
+ org::genivi::am::am_ConnectionFormat_L listSinkFormats;
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+
+ org::genivi::am::am_Convertion_L convertionMatrix;
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+
+ std::vector<am_CustomConnectionFormat_t> am_listSourceFormats;
+ am_listSourceFormats.push_back(CF_GENIVI_ANALOG);
+ am_listSourceFormats.push_back(CF_GENIVI_AUTO);
+
+ std::vector<am_CustomConnectionFormat_t> am_listSinkFormats;
+ am_listSinkFormats.push_back(CF_GENIVI_AUTO);
+ am_listSinkFormats.push_back(CF_GENIVI_ANALOG);
+
+ std::vector<bool> am_convertionMatrix;
+ am_convertionMatrix.push_back(1);
+ am_convertionMatrix.push_back(0);
+ ON_CALL(*env->mpRoutingReceive, updateConverter(_, _, _, _)).WillByDefault(Return(E_OK));
+ EXPECT_CALL(*env->mpRoutingReceive, updateConverter(testID, am_listSourceFormats, am_listSinkFormats, am_convertionMatrix)).Times(1);
+
+ org::genivi::am::am_Error_e CAPIError;
+ env->mProxy->updateConverter(testID, listSourceFormats, listSinkFormats, convertionMatrix, callStatus,CAPIError);
+ ASSERT_EQ( callStatus, CallStatus::SUCCESS );
+ }
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
+}
+
MATCHER_P(IsSoundPropertiesArrayEqualTo, value, "") {
auto lh = arg;
diff --git a/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h b/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h
index c2736d6..1443219 100644
--- a/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h
+++ b/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h
@@ -60,8 +60,12 @@ class MockIAmRoutingReceive : public IAmRoutingReceive {
am_Error_e(const am_domainID_t domainID));
MOCK_METHOD2(registerGateway,
am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD2(registerConverter,
+ am_Error_e(const am_Converter_s& converterData, am_converterID_t& converterID));
MOCK_METHOD1(deregisterGateway,
am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD1(deregisterConverter,
+ am_Error_e(const am_converterID_t converterID));
MOCK_METHOD2(peekSink,
am_Error_e(const std::string& name, am_sinkID_t& sinkID));
MOCK_METHOD2(registerSink,
@@ -106,6 +110,8 @@ class MockIAmRoutingReceive : public IAmRoutingReceive {
void(const uint16_t handle, const am_Error_e error));
MOCK_METHOD4(updateGateway,
am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD4(updateConverter,
+ am_Error_e(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
MOCK_METHOD5(updateSink,
am_Error_e(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties));
MOCK_METHOD5(updateSource,