23
23
// <pca>
24
24
#include " AVInputImplementation.h"
25
25
#include " COMLinkMock.h"
26
+ #include " WorkerPoolImplementation.h"
26
27
// </pca>
27
28
28
29
#include " CompositeInputMock.h"
@@ -42,27 +43,127 @@ class AVInputTest : public ::testing::Test {
42
43
Core::ProxyType<Plugin::AVInput> plugin;
43
44
// <pca>
44
45
Core::ProxyType<Plugin::AVInputImplementation> AVInputImpl;
46
+ Core::ProxyType<WorkerPoolImplementation> workerPool;
45
47
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 ;
46
59
// </pca>
60
+
47
61
Core::JSONRPC::Handler& handler;
48
62
DECL_CORE_JSONRPC_CONX connection;
49
63
string response;
50
64
51
65
AVInputTest ()
52
66
: plugin(Core::ProxyType<Plugin::AVInput>::Create())
53
67
, 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>
55
73
{
56
74
// <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
+
57
124
ON_CALL (comLinkMock, Instantiate (::testing::_, ::testing::_, ::testing::_))
58
125
.WillByDefault (::testing::Invoke (
59
126
[&](const RPC::Object& object, const uint32_t waitTime, uint32_t & connectionId) {
60
127
AVInputImpl = Core::ProxyType<Plugin::AVInputImplementation>::Create ();
61
128
return &AVInputImpl;
62
129
}));
130
+
131
+ Core::IWorkerPool::Assign (&(*workerPool));
132
+ workerPool->Run ();
133
+
134
+ plugin->Initialize (&service);
63
135
// </pca>
64
136
}
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>
66
167
};
67
168
68
169
class AVInputDsTest : public AVInputTest {
0 commit comments