@@ -223,21 +223,71 @@ TEST_F(AVInputInit, getInputDevices)
223223 EXPECT_EQ (response, string (" {\" devices\" :[{\" id\" :0,\" connected\" :false,\" locator\" :\" hdmiin:\\ /\\ /localhost\\ /deviceid\\ /0\" },{\" id\" :0,\" connected\" :false,\" locator\" :\" cvbsin:\\ /\\ /localhost\\ /deviceid\\ /0\" }],\" success\" :true}" ));
224224}
225225
226+ TEST_F (AVInputInit, getInputDevices_HDMI)
227+ {
228+ EXPECT_CALL (*p_hdmiInputImplMock, getNumberOfInputs ())
229+ .WillOnce (::testing::Return (1 ));
230+ EXPECT_CALL (*p_hdmiInputImplMock, isPortConnected (::testing::_))
231+ .WillOnce (::testing::Return (true ));
232+ EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" getInputDevices" ), _T (" {\" typeOfInput\" : \" HDMI\" }" ), response));
233+ EXPECT_EQ (response, string (" {\" devices\" :[{\" id\" :0,\" connected\" :true,\" locator\" :\" hdmiin:\\ /\\ /localhost\\ /deviceid\\ /0\" }],\" success\" :true}" ));
234+ }
235+
236+ TEST_F (AVInputInit, getInputDevices_COMPOSITE)
237+ {
238+ EXPECT_CALL (*p_compositeInputImplMock, getNumberOfInputs ())
239+ .WillOnce (::testing::Return (1 ));
240+ EXPECT_CALL (*p_compositeInputImplMock, isPortConnected (::testing::_))
241+ .WillOnce (::testing::Return (true ));
242+ EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" getInputDevices" ), _T (" {\" typeOfInput\" : \" COMPOSITE\" }" ), response));
243+ EXPECT_EQ (response, string (" {\" devices\" :[{\" id\" :0,\" connected\" :true,\" locator\" :\" cvbsin:\\ /\\ /localhost\\ /deviceid\\ /0\" }],\" success\" :true}" ));
244+ }
245+
246+ TEST_F (AVInputInit, getInputDevices_InvalidParameters)
247+ {
248+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getInputDevices" ), _T (" {\" typeOfInput\" : \" Test\" }" ), response));
249+ EXPECT_EQ (response, string (" " ));
250+ }
251+
226252TEST_F (AVInputInit, writeEDID)
227253{
228254 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" writeEDID" ), _T (" {\" portId\" : \" 1\" ,\" message\" :\" Test\" }" ), response));
229255 EXPECT_EQ (response, string (" {\" success\" :true}" ));
230256}
231257
258+ TEST_F (AVInputInit, writeEDID_InvalidParameters)
259+ {
260+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" writeEDID" ), _T (" {}" ), response));
261+ EXPECT_EQ (response, string (" " ));
262+ }
263+
232264TEST_F (AVInputInit, readEDID)
233265{
234266 EXPECT_CALL (*p_hdmiInputImplMock, getEDIDBytesInfo (::testing::_, ::testing::_))
235267 .WillOnce ([](int port, std::vector<uint8_t >& edid) {
236- edid = { 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 };
268+ EXPECT_EQ (port,1 );
269+ edid = { 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF };
237270 });
238271
239272 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" readEDID" ), _T (" {\" portId\" : \" 1\" }" ), response));
240- EXPECT_EQ (response, string (" {\" EDID\" :\" AP\\ /\\ /\\ /\\ /\\ /\\ /\\ /wA=\" ,\" success\" :true}" ));
273+ EXPECT_EQ (response, string (" {\" EDID\" :\" AP\\ /\\ /\\ /\\ /\\ /\\ /\\ /w==\" ,\" success\" :true}" ));
274+ }
275+
276+ TEST_F (AVInputInit, readEDIDFailure)
277+ {
278+ EXPECT_CALL (*p_hdmiInputImplMock, getEDIDBytesInfo (::testing::_, ::testing::_))
279+ .WillOnce ([](int port, std::vector<uint8_t >& edid) {
280+ edid = {};
281+ });
282+
283+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" readEDID" ), _T (" {\" portId\" : \" 1\" }" ), response));
284+ EXPECT_EQ (response, string (" " ));
285+ }
286+
287+ TEST_F (AVInputInit, readEDID_InvalidParameters)
288+ {
289+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" readEDID" ), _T (" {\" portId\" : \" test\" }" ), response));
290+ EXPECT_EQ (response, string (" " ));
241291}
242292
243293TEST_F (AVInputInit, getRawSPD)
@@ -251,6 +301,12 @@ TEST_F(AVInputInit, getRawSPD)
251301 EXPECT_EQ (response, string (" {\" HDMISPD\" :\" U1BEAA\" ,\" success\" :true}" ));
252302}
253303
304+ TEST_F (AVInputInit, getRawSPD_InvalidParameters)
305+ {
306+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getRawSPD" ), _T (" {\" portId\" : \" test\" }" ), response));
307+ EXPECT_EQ (response, string (" " ));
308+ }
309+
254310TEST_F (AVInputInit, getSPD)
255311{
256312 EXPECT_CALL (*p_hdmiInputImplMock, getHDMISPDInfo (::testing::_, ::testing::_))
@@ -262,6 +318,12 @@ TEST_F(AVInputInit, getSPD)
262318 EXPECT_EQ (response, string (" {\" HDMISPD\" :\" Packet Type:53,Version:80,Length:68,vendor name:wn,product des:,source info:00\" ,\" success\" :true}" ));
263319}
264320
321+ TEST_F (AVInputInit, getSPD_InvalidParameters)
322+ {
323+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getSPD" ), _T (" {\" portId\" : \" test\" }" ), response));
324+ EXPECT_EQ (response, string (" " ));
325+ }
326+
265327TEST_F (AVInputInit, setEdidVersion)
266328{
267329 EXPECT_CALL (*p_hdmiInputImplMock, setEdidVersion (::testing::_, ::testing::_))
@@ -274,15 +336,40 @@ TEST_F(AVInputInit, setEdidVersion)
274336 EXPECT_EQ (response, string (" {\" success\" :true}" ));
275337}
276338
277- TEST_F (AVInputInit, getEdidVersion)
339+ TEST_F (AVInputInit, setEdidVersion_InvalidParameters)
340+ {
341+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" setEdidVersion" ), _T (" {\" portId\" : \" test\" , \" edidVersion\" :\" test\" }" ), response));
342+ EXPECT_EQ (response, string (" " ));
343+ }
344+
345+ TEST_F (AVInputInit, getEdidVersion1)
346+ {
347+ EXPECT_CALL (*p_hdmiInputImplMock, getEdidVersion (::testing::_, ::testing::_))
348+ .WillOnce ([](int port, int * edidVersion) {
349+ EXPECT_EQ (port,0 );
350+ *edidVersion = 0 ;
351+ });
352+
353+ EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" getEdidVersion" ), _T (" {\" portId\" : \" 0\" }" ), response));
354+ EXPECT_EQ (response, string (" {\" edidVersion\" :\" HDMI1.4\" ,\" success\" :true}" ));
355+ }
356+
357+ TEST_F (AVInputInit, getEdidVersion2)
278358{
279359 EXPECT_CALL (*p_hdmiInputImplMock, getEdidVersion (::testing::_, ::testing::_))
280360 .WillOnce ([](int port, int * edidVersion) {
281- *edidVersion = 4 ;
361+ EXPECT_EQ (port,1 );
362+ *edidVersion = 1 ;
282363 });
283364
284365 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" getEdidVersion" ), _T (" {\" portId\" : \" 1\" }" ), response));
285- EXPECT_EQ (response, string (" {\" success\" :true}" ));
366+ EXPECT_EQ (response, string (" {\" edidVersion\" :\" HDMI2.0\" ,\" success\" :true}" ));
367+ }
368+
369+ TEST_F (AVInputInit, getEdidVersion_InvalidParameters)
370+ {
371+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getEdidVersion" ), _T (" {\" portId\" : \" test\" }}" ), response));
372+ EXPECT_EQ (response, string (" " ));
286373}
287374
288375TEST_F (AVInputInit, getHdmiVersion)
@@ -298,6 +385,12 @@ TEST_F(AVInputInit, getHdmiVersion)
298385 EXPECT_EQ (response, string (" {\" HdmiCapabilityVersion\" :\" 2.1\" ,\" success\" :true}" ));
299386}
300387
388+ TEST_F (AVInputInit, getHdmiVersion_InvalidParameters)
389+ {
390+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getHdmiVersion" ), _T (" {\" portId\" : \" test\" }" ), response));
391+ EXPECT_EQ (response, string (" " ));
392+ }
393+
301394TEST_F (AVInputInit, setMixerLevels)
302395{
303396 EXPECT_CALL (*p_HostImplMock, setAudioMixerLevels (dsAUDIO_INPUT_PRIMARY, ::testing::_))
@@ -316,6 +409,12 @@ TEST_F(AVInputInit, setMixerLevels)
316409 EXPECT_EQ (response, string (" {\" success\" :true}" ));
317410}
318411
412+ TEST_F (AVInputInit, setMixerLevelsErrorCase)
413+ {
414+ EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" setMixerLevels" ), _T (" {\" primaryVolume\" : 110 ,\" inputVolume\" :110}" ), response));
415+ EXPECT_EQ (response, string (" {\" success\" :true}" ));
416+ }
417+
319418TEST_F (AVInputInit, startInput_HDMI)
320419{
321420 EXPECT_CALL (*p_hdmiInputImplMock, selectPort (::testing::_, ::testing::_, ::testing::_, ::testing::_))
@@ -341,6 +440,12 @@ TEST_F(AVInputInit, startInput_COMPOSITE)
341440 EXPECT_EQ (response, string (" {\" success\" :true}" ));
342441}
343442
443+ TEST_F (AVInputInit, startInput_InvalidParameters)
444+ {
445+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" startInput" ), _T (" {\" portId\" : \" test\" ,\" typeOfInput\" :\" HDMI\" , \" requestAudioMix\" : true, \" plane\" : 1, \" topMost\" : true}" ), response));
446+ EXPECT_EQ (response, string (" " ));
447+ }
448+
344449TEST_F (AVInputInit, stopInput_HDMI)
345450{
346451 EXPECT_CALL (*p_hdmiInputImplMock, selectPort (::testing::_, ::testing::_, ::testing::_, ::testing::_))
@@ -363,6 +468,12 @@ TEST_F(AVInputInit, stopInput_COMPOSITE)
363468 EXPECT_EQ (response, string (" {\" success\" :true}" ));
364469}
365470
471+ TEST_F (AVInputInit, stopInput_COMPOSITE_InvalidParameters)
472+ {
473+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" stopInput" ), _T (" {\" typeOfInput\" :\" DP\" }" ), response));
474+ EXPECT_EQ (response, string (" " ));
475+ }
476+
366477TEST_F (AVInputInit, setVideoRectangle_HDMI)
367478{
368479 EXPECT_CALL (*p_hdmiInputImplMock, scaleVideo (::testing::_, ::testing::_, ::testing::_, ::testing::_))
@@ -391,6 +502,12 @@ TEST_F(AVInputInit, setVideoRectangle_COMPOSITE)
391502 EXPECT_EQ (response, string (" {\" success\" :true}" ));
392503}
393504
505+ TEST_F (AVInputInit, setVideoRectangle_InvalidParameters)
506+ {
507+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" setVideoRectangle" ), _T (" {\" x\" : 0, \" y\" : 0, \" w\" : 720, \" h\" : 480 ,\" typeOfInput\" :\" DP\" }" ), response));
508+ EXPECT_EQ (response, string (" " ));
509+ }
510+
394511TEST_F (AVInputInit, getSupportedGameFeatures)
395512{
396513 EXPECT_CALL (*p_hdmiInputImplMock, getSupportedGameFeatures (::testing::_))
@@ -402,6 +519,17 @@ TEST_F(AVInputInit, getSupportedGameFeatures)
402519 EXPECT_EQ (response, string (" {\" supportedGameFeatures\" :[\" ALLM\" ,\" VRR\" ,\" QMS\" ],\" success\" :true}" ));
403520}
404521
522+ TEST_F (AVInputInit, getSupportedGameFeatures_ErrorCase)
523+ {
524+ EXPECT_CALL (*p_hdmiInputImplMock, getSupportedGameFeatures (::testing::_))
525+ .WillOnce ([](std::vector<std::string>& featureList) {
526+ featureList = {};
527+ });
528+
529+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getSupportedGameFeatures" ), _T (" {}" ), response));
530+ EXPECT_EQ (response, string (" " ));
531+ }
532+
405533TEST_F (AVInputInit, getGameFeatureStatus_ALLM)
406534{
407535 EXPECT_CALL (*p_hdmiInputImplMock, getHdmiALLMStatus (::testing::_, ::testing::_))
@@ -466,6 +594,12 @@ TEST_F(AVInputInit, getGameFeatureStatus_VRR_FREESYNC_PREMIUM_PRO)
466594 EXPECT_EQ (response, string (" {\" mode\" :true,\" success\" :true}" ));
467595}
468596
597+ TEST_F (AVInputInit, getGameFeatureStatus_InvalidParameters)
598+ {
599+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getGameFeatureStatus" ), _T (" {\" portId\" : \" test\" , \" gameFeature\" : \" VRR-FREESYNC-PREMIUM-PRO\" }" ), response));
600+ EXPECT_EQ (response, string (" " ));
601+ }
602+
469603TEST_F (AVInputInit, onDevicesChangedHDMI)
470604{
471605 ASSERT_TRUE (dsAVEventHandler != nullptr );
@@ -1094,28 +1228,56 @@ TEST_F(AVInputDsTest, getEdid2AllmSupport)
10941228 EXPECT_EQ (response, string (" {\" allmSupport\" :true,\" success\" :true}" ));
10951229}
10961230
1231+ TEST_F (AVInputDsTest, getEdid2AllmSupport_ErrorCase)
1232+ {
1233+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getEdid2AllmSupport" ), _T (" {\" portId\" : \" test\" ,\" allmSupport\" :true}" ), response));
1234+ EXPECT_EQ (response, string (" " ));
1235+ }
10971236
10981237TEST_F (AVInputDsTest, setEdid2AllmSupport)
10991238{
11001239 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" setEdid2AllmSupport" ), _T (" {\" portId\" : \" 0\" ,\" allmSupport\" :true}" ), response));
11011240 EXPECT_EQ (response, string (" {\" success\" :true}" ));
11021241}
11031242
1243+ TEST_F (AVInputDsTest, setEdid2AllmSupport_ErrorCase)
1244+ {
1245+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" setEdid2AllmSupport" ), _T (" {\" portId\" : \" test\" ,\" allmSupport\" :true}" ), response));
1246+ EXPECT_EQ (response, string (" " ));
1247+ }
1248+
11041249TEST_F (AVInputDsTest, getVRRSupport)
11051250{
11061251 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" getVRRSupport" ), _T (" {\" portId\" : \" 0\" ,\" vrrSupport\" :true}" ), response));
11071252 EXPECT_EQ (response, string (" {\" vrrSupport\" :true,\" success\" :true}" ));
11081253}
11091254
1255+ TEST_F (AVInputDsTest, getVRRSupport_ErrorCase)
1256+ {
1257+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getVRRSupport" ), _T (" {\" portId\" : \" test\" ,\" vrrSupport\" :true}" ), response));
1258+ EXPECT_EQ (response, string (" " ));
1259+ }
1260+
11101261TEST_F (AVInputDsTest, setVRRSupport)
11111262{
11121263 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" setVRRSupport" ), _T (" {\" portId\" : \" 0\" ,\" vrrSupport\" :true}" ), response));
11131264 EXPECT_EQ (response, string (" {\" success\" :true}" ));
11141265}
11151266
1267+ TEST_F (AVInputDsTest, setVRRSupport_ErrorCase)
1268+ {
1269+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" setVRRSupport" ), _T (" {\" portId\" : \" test\" ,\" vrrSupport\" :true}" ), response));
1270+ EXPECT_EQ (response, string (" " ));
1271+ }
1272+
11161273TEST_F (AVInputDsTest, getVRRFrameRate)
11171274{
11181275 EXPECT_EQ (Core::ERROR_NONE, handler.Invoke (connection, _T (" getVRRFrameRate" ), _T (" {\" portId\" : \" 0\" }" ), response));
11191276 EXPECT_EQ (response, string (" {\" currentVRRVideoFrameRate\" :0,\" success\" :true}" ));
11201277}
11211278
1279+ TEST_F (AVInputDsTest, getVRRFrameRate_ErrorCase)
1280+ {
1281+ EXPECT_EQ (Core::ERROR_GENERAL, handler.Invoke (connection, _T (" getVRRFrameRate" ), _T (" {\" portId\" : \" test\" }" ), response));
1282+ EXPECT_EQ (response, string (" " ));
1283+ }
0 commit comments