Skip to content

Commit

Permalink
RDKTV-32602: Update MiracastService unit test based on getRFCParamete…
Browse files Browse the repository at this point in the history
…r API

Signed-off-by: yuvaramachandran_gurusamy <[email protected]>
  • Loading branch information
yuvaramachandran-gurusamy committed Aug 30, 2024
1 parent 48a2c14 commit 1adde23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Miracast/MiracastService/MiracastController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,13 +1352,11 @@ void MiracastController::set_enable(bool is_enabled)
isMiracastRFCEnabled = true;
}
}

MIRACASTLOG_INFO(" Is Miracast RFC enabled ? %d , call value %d ", isMiracastRFCEnabled, wdmpStatus);
MIRACASTLOG_INFO(" Is Miracast RFC enabled ? %d , call value %d , type value %d", isMiracastRFCEnabled, wdmpStatus, param.type);
#else
isMiracastRFCEnabled = true;
#endif //RFC_ENABLED


if(!isMiracastRFCEnabled)
{
MIRACASTLOG_INFO("----------MIRACAST RFC Disabled---------- ");
Expand Down
22 changes: 21 additions & 1 deletion Tests/L1Tests/tests/test_MiracastService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "WrapsMock.h"
#include "WpaCtrlMock.h"
#include "IarmBusMock.h"
#include "RfcApiMock.h"

using ::testing::NiceMock;
using namespace WPEFramework;
Expand Down Expand Up @@ -77,6 +78,7 @@ class MiracastServiceTest : public ::testing::Test {
WrapsImplMock *p_wrapsImplMock = nullptr;
WpaCtrlApiImplMock *p_wpaCtrlImplMock = nullptr;
IarmBusImplMock *p_iarmBusImplMock = nullptr;
RfcApiImplMock *p_rfcApiImplMock = nullptr;
IARM_EventHandler_t pwrMgrEventHandler;

MiracastServiceTest()
Expand All @@ -93,6 +95,9 @@ class MiracastServiceTest : public ::testing::Test {
p_iarmBusImplMock = new testing::NiceMock <IarmBusImplMock>;
IarmBus::setImpl(p_iarmBusImplMock);

p_rfcApiImplMock = new testing::NiceMock <RfcApiImplMock>;
RfcApi::setImpl(p_rfcApiImplMock);

EXPECT_CALL(service, QueryInterfaceByCallsign(::testing::_, ::testing::_))
.Times(::testing::AnyNumber())
.WillRepeatedly(::testing::Invoke([&](const uint32_t, const string& name) -> void* { return nullptr; }));
Expand Down Expand Up @@ -121,6 +126,14 @@ class MiracastServiceTest : public ::testing::Test {
}
return IARM_RESULT_SUCCESS;
});
ON_CALL(*p_rfcApiImplMock, getRFCParameter)
.WillByDefault([](char* pcCallerID, const char* pcParameterName, RFC_ParamData_t* pstParamData){
EXPECT_EQ(string(pcCallerID), string("MiracastPlugin"));
EXPECT_EQ(string(pcParameterName), string("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Miracast.Enable"));
strncpy(pstParamData->value, "true", sizeof(pstParamData->value));
pstParamData->type = WDMP_BOOLEAN;
return WDMP_SUCCESS;
});
}
virtual ~MiracastServiceTest() override
{
Expand All @@ -144,6 +157,13 @@ class MiracastServiceTest : public ::testing::Test {
delete p_iarmBusImplMock;
p_iarmBusImplMock = nullptr;
}

RfcApi::setImpl(nullptr);
if (p_rfcApiImplMock != nullptr)
{
delete p_rfcApiImplMock;
p_rfcApiImplMock = nullptr;
}
}
};

Expand Down Expand Up @@ -2046,4 +2066,4 @@ TEST_F(MiracastServiceEventTest, wifiStateChange)

removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0");
removeFile("/var/run/wpa_supplicant/p2p0");
}
}

0 comments on commit 1adde23

Please sign in to comment.