Skip to content

Commit b55d845

Browse files
committed
AVInput COM-RPC Support: WIP
1 parent 694aeaf commit b55d845

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

Tests/L1Tests/tests/test_AVInput.cpp

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,129 @@ TEST_F(AVInputTest, contentProtected)
123123
EXPECT_EQ(response, string("{\"isContentProtected\":true,\"success\":true}"));
124124
}
125125

126+
class AVInputDsTest : public AVInputTest {
127+
protected:
128+
HdmiInputImplMock* p_hdmiInputImplMock = nullptr;
129+
CompositeInputImplMock* p_compositeInputImplMock = nullptr;
130+
HostImplMock* p_HostImplMock = nullptr;
131+
IARM_EventHandler_t dsAVGameFeatureStatusEventHandler;
132+
IARM_EventHandler_t dsAVEventHandler;
133+
IARM_EventHandler_t dsAVSignalStatusEventHandler;
134+
IARM_EventHandler_t dsAVStatusEventHandler;
135+
IARM_EventHandler_t dsAVVideoModeEventHandler;
136+
IARM_EventHandler_t dsAviContentTypeEventHandler;
137+
138+
AVInputDsTest()
139+
: AVInputTest()
140+
{
141+
p_hdmiInputImplMock = new NiceMock <HdmiInputImplMock>;
142+
device::HdmiInput::setImpl(p_hdmiInputImplMock);
143+
144+
p_compositeInputImplMock = new NiceMock<CompositeInputImplMock>;
145+
device::CompositeInput::setImpl(p_compositeInputImplMock);
146+
147+
p_HostImplMock = new NiceMock<HostImplMock>;
148+
device::Host::setImpl(p_HostImplMock);
149+
}
150+
virtual ~AVInputDsTest() override
151+
{
152+
device::HdmiInput::setImpl(nullptr);
153+
if (p_hdmiInputImplMock != nullptr)
154+
{
155+
delete p_hdmiInputImplMock;
156+
p_hdmiInputImplMock = nullptr;
157+
}
158+
159+
device::CompositeInput::setImpl(nullptr);
160+
if (p_compositeInputImplMock != nullptr) {
161+
delete p_compositeInputImplMock;
162+
p_compositeInputImplMock = nullptr;
163+
}
164+
165+
device::Host::setImpl(nullptr);
166+
if (p_HostImplMock != nullptr) {
167+
delete p_HostImplMock;
168+
p_HostImplMock = nullptr;
169+
}
170+
}
171+
};
172+
173+
TEST_F(AVInputDsTest, numberOfInputs)
174+
{
175+
ON_CALL(*p_hdmiInputImplMock, getNumberOfInputs())
176+
.WillByDefault(::testing::Return(1));
177+
178+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("numberOfInputs"), _T("{}"), response));
179+
EXPECT_EQ(response, string("{\"numberOfInputs\":1,\"success\":true}"));
180+
}
181+
182+
TEST_F(AVInputDsTest, currentVideoMode)
183+
{
184+
ON_CALL(*p_hdmiInputImplMock, getCurrentVideoMode())
185+
.WillByDefault(::testing::Return(string("unknown")));
186+
187+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("currentVideoMode"), _T("{}"), response));
188+
EXPECT_EQ(response, string("{\"currentVideoMode\":\"unknown\",\"success\":true}"));
189+
}
190+
191+
TEST_F(AVInputDsTest, getEdid2AllmSupport)
192+
{
193+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("getEdid2AllmSupport"), _T("{\"portId\": \"0\",\"allmSupport\":true}"), response));
194+
EXPECT_EQ(response, string("{\"allmSupport\":true,\"success\":true}"));
195+
}
196+
197+
TEST_F(AVInputDsTest, getEdid2AllmSupport_ErrorCase)
198+
{
199+
EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("getEdid2AllmSupport"), _T("{\"portId\": \"test\",\"allmSupport\":true}"), response));
200+
EXPECT_EQ(response, string(""));
201+
}
202+
203+
TEST_F(AVInputDsTest, setEdid2AllmSupport)
204+
{
205+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setEdid2AllmSupport"), _T("{\"portId\": \"0\",\"allmSupport\":true}"), response));
206+
EXPECT_EQ(response, string("{\"success\":true}"));
207+
}
208+
209+
TEST_F(AVInputDsTest, setEdid2AllmSupport_ErrorCase)
210+
{
211+
EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("setEdid2AllmSupport"), _T("{\"portId\": \"test\",\"allmSupport\":true}"), response));
212+
EXPECT_EQ(response, string(""));
213+
}
214+
215+
TEST_F(AVInputDsTest, getVRRSupport)
216+
{
217+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("getVRRSupport"), _T("{\"portId\": \"0\",\"vrrSupport\":true}"), response));
218+
EXPECT_EQ(response, string("{\"vrrSupport\":true,\"success\":true}"));
219+
}
220+
221+
TEST_F(AVInputDsTest, getVRRSupport_ErrorCase)
222+
{
223+
EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("getVRRSupport"), _T("{\"portId\": \"test\",\"vrrSupport\":true}"), response));
224+
EXPECT_EQ(response, string(""));
225+
}
226+
227+
TEST_F(AVInputDsTest, setVRRSupport)
228+
{
229+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setVRRSupport"), _T("{\"portId\": \"0\",\"vrrSupport\":true}"), response));
230+
EXPECT_EQ(response, string("{\"success\":true}"));
231+
}
232+
233+
TEST_F(AVInputDsTest, setVRRSupport_ErrorCase)
234+
{
235+
EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("setVRRSupport"), _T("{\"portId\": \"test\",\"vrrSupport\":true}"), response));
236+
EXPECT_EQ(response, string(""));
237+
}
238+
239+
TEST_F(AVInputDsTest, getVRRFrameRate)
240+
{
241+
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("getVRRFrameRate"), _T("{\"portId\": \"0\"}"), response));
242+
EXPECT_EQ(response, string("{\"currentVRRVideoFrameRate\":0,\"success\":true}"));
243+
}
244+
245+
TEST_F(AVInputDsTest, getVRRFrameRate_ErrorCase)
246+
{
247+
EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("getVRRFrameRate"), _T("{\"portId\": \"test\"}"), response));
248+
EXPECT_EQ(response, string(""));
249+
}
250+
251+

0 commit comments

Comments
 (0)