Skip to content

Commit 4d00682

Browse files
committed
NO MERGE: AVInput COM-RPC Support: Unit tests: Added implementation support to L1-tests.yml
1 parent cf39fbb commit 4d00682

File tree

1 file changed

+103
-2
lines changed

1 file changed

+103
-2
lines changed

Tests/L1Tests/tests/test_AVInput.cpp

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// <pca>
2424
#include "AVInputImplementation.h"
2525
#include "COMLinkMock.h"
26+
#include "WorkerPoolImplementation.h"
2627
// </pca>
2728

2829
#include "CompositeInputMock.h"
@@ -42,27 +43,127 @@ class AVInputTest : public ::testing::Test {
4243
Core::ProxyType<Plugin::AVInput> plugin;
4344
// <pca>
4445
Core::ProxyType<Plugin::AVInputImplementation> AVInputImpl;
46+
Core::ProxyType<WorkerPoolImplementation> workerPool;
4547
NiceMock<COMLinkMock> comLinkMock;
48+
NiceMock<ServiceMock> service;
49+
WrapsImplMock *p_wrapsImplMock = nullptr;
50+
ServiceMock *p_serviceMock = nullptr;
51+
AVInputMock *p_avInputMock = nullptr;
52+
53+
Exchange::IAVInput::IDevicesChangedNotification *OnDevicesChangedNotification = nullptr;
54+
Exchange::IAVInput::ISignalChangedNotification *OnSignalChangedNotification = nullptr;
55+
Exchange::IAVInput::IInputStatusChangedNotification *OnInputStatusChangedNotification = nullptr;
56+
Exchange::IAVInput::IVideoStreamInfoUpdateNotification *OnVideoStreamInfoUpdateNotification = nullptr;
57+
Exchange::IAVInput::IGameFeatureStatusUpdateNotification *OnGameFeatureStatusUpdateNotification = nullptr;
58+
Exchange::IAVInput::IHdmiContentTypeUpdateNotification *OnHdmiContentTypeUpdateNotification = nullptr;
4659
// </pca>
60+
4761
Core::JSONRPC::Handler& handler;
4862
DECL_CORE_JSONRPC_CONX connection;
4963
string response;
5064

5165
AVInputTest()
5266
: plugin(Core::ProxyType<Plugin::AVInput>::Create())
5367
, handler(*(plugin))
54-
, INIT_CONX(1, 0)
68+
// <pca>
69+
//, INIT_CONX(1, 0)
70+
, INIT_CONX(1, 0) , workerPool(Core::ProxyType<WorkerPoolImplementation>::Create(
71+
2, Core::Thread::DefaultStackSize(), 16))
72+
// </pca>
5573
{
5674
// <pca>
75+
p_serviceMock = new NiceMock <ServiceMock>;
76+
77+
p_avInputMock = new NiceMock <AVInputMock>;
78+
79+
p_wrapsImplMock = new NiceMock <WrapsImplMock>;
80+
Wraps::setImpl(p_wrapsImplMock);
81+
82+
ON_CALL(*p_avInputMock, Register(::testing::_))
83+
.WillByDefault(::testing::Invoke(
84+
[&](Exchange::IDevicesChangedNotification::OnDevicesChangedNotification *notification){
85+
OnDevicesChangedNotification = notification;
86+
return Core::ERROR_NONE;;
87+
}));
88+
89+
ON_CALL(*p_avInputMock, Register(::testing::_))
90+
.WillByDefault(::testing::Invoke(
91+
[&](Exchange::ISignalChangedNotification *notification){
92+
OnSignalChangedNotification = notification;
93+
return Core::ERROR_NONE;;
94+
}));
95+
96+
ON_CALL(*p_avInputMock, Register(::testing::_))
97+
.WillByDefault(::testing::Invoke(
98+
[&](Exchange::IInputStatusChangedNotification *notification){
99+
OnInputStatusChangedNotification = notification;
100+
return Core::ERROR_NONE;;
101+
}));
102+
103+
ON_CALL(*p_avInputMock, Register(::testing::_))
104+
.WillByDefault(::testing::Invoke(
105+
[&](Exchange::IVideoStreamInfoUpdateNotification *notification){
106+
OnVideoStreamInfoUpdateNotification = notification;
107+
return Core::ERROR_NONE;;
108+
}));
109+
110+
ON_CALL(*p_avInputMock, Register(::testing::_))
111+
.WillByDefault(::testing::Invoke(
112+
[&](Exchange::IGameFeatureStatusUpdateNotification *notification){
113+
OnGameFeatureStatusUpdateNotification = notification;
114+
return Core::ERROR_NONE;;
115+
}));
116+
117+
ON_CALL(*p_avInputMock, Register(::testing::_))
118+
.WillByDefault(::testing::Invoke(
119+
[&](Exchange::IHdmiContentTypeUpdateNotification *notification){
120+
OnHdmiContentTypeUpdateNotification = notification;
121+
return Core::ERROR_NONE;;
122+
}));
123+
57124
ON_CALL(comLinkMock, Instantiate(::testing::_, ::testing::_, ::testing::_))
58125
.WillByDefault(::testing::Invoke(
59126
[&](const RPC::Object& object, const uint32_t waitTime, uint32_t& connectionId) {
60127
AVInputImpl = Core::ProxyType<Plugin::AVInputImplementation>::Create();
61128
return &AVInputImpl;
62129
}));
130+
131+
Core::IWorkerPool::Assign(&(*workerPool));
132+
workerPool->Run();
133+
134+
plugin->Initialize(&service);
63135
// </pca>
64136
}
65-
virtual ~AVInputTest() = default;
137+
138+
// <pca>
139+
//virtual ~AVInputTest() = default;
140+
virtual ~AVInputTest()
141+
{
142+
plugin->Deinitialize(&service);
143+
144+
Core::IWorkerPool::Assign(nullptr);
145+
workerPool.Release();
146+
147+
if (p_serviceMock != nullptr)
148+
{
149+
delete p_serviceMock;
150+
p_serviceMock = nullptr;
151+
}
152+
153+
if (p_avInputMock != nullptr)
154+
{
155+
delete p_avInputMock;
156+
p_avInputMock = nullptr;
157+
}
158+
159+
Wraps::setImpl(nullptr);
160+
if (p_wrapsImplMock != nullptr)
161+
{
162+
delete p_wrapsImplMock;
163+
p_wrapsImplMock = nullptr;
164+
}
165+
}
166+
// </pca>
66167
};
67168

68169
class AVInputDsTest : public AVInputTest {

0 commit comments

Comments
 (0)