Skip to content

Commit 15da096

Browse files
committed
Update HdmiCecSink_L2Test.cpp
1 parent ab29ccd commit 15da096

File tree

1 file changed

+50
-5
lines changed

1 file changed

+50
-5
lines changed

Tests/L2Tests/tests/HdmiCecSink_L2Test.cpp

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,6 +3074,33 @@ TEST_F(HdmiCecSink_L2Test, InjectGetCECVersionFrame)
30743074
}
30753075
}
30763076

3077+
TEST_F(HdmiCecSink_L2Test, InjectGetCECVersionFrameroadcastIgnoreTest)
3078+
{
3079+
// No event is fired, plugin should send CECVersion in response
3080+
uint8_t buffer[] = { 0x4F, 0x9F }; // From device 4 to broadcast
3081+
CECFrame frame(buffer, sizeof(buffer));
3082+
for (auto* listener : listeners) {
3083+
if (listener)
3084+
listener->notify(frame);
3085+
}
3086+
}
3087+
3088+
TEST_F(HdmiCecSink_L2Test, InjectGetCECVersionFrameException)
3089+
{
3090+
EXPECT_CALL(*p_connectionMock, sendToAsync(::testing::_, ::testing::_))
3091+
.WillRepeatedly(::testing::Invoke(
3092+
[&](const LogicalAddress& to, const CECFrame& frame) {
3093+
throw Exception();
3094+
}));
3095+
// No event is fired, plugin should send CECVersion in response
3096+
uint8_t buffer[] = { 0x40, 0x9F }; // From device 4 to TV (0)
3097+
CECFrame frame(buffer, sizeof(buffer));
3098+
for (auto* listener : listeners) {
3099+
if (listener)
3100+
listener->notify(frame);
3101+
}
3102+
}
3103+
30773104
// GiveOSDName (0x46)
30783105
TEST_F(HdmiCecSink_L2Test, InjectGiveOSDNameFrame)
30793106
{
@@ -3123,6 +3150,23 @@ TEST_F(HdmiCecSink_L2Test, InjectGivePhysicalAddressFrame)
31233150
}
31243151
}
31253152

3153+
TEST_F(HdmiCecSink_L2Test, InjectGivePhysicalAddressFrameException)
3154+
{
3155+
EXPECT_CALL(*p_connectionMock, sendTo(::testing::_, ::testing::_))
3156+
.WillRepeatedly(::testing::Invoke(
3157+
[&](const LogicalAddress& to, const CECFrame& frame) {
3158+
throw Exception();
3159+
}));
3160+
3161+
uint8_t buffer[] = { 0x40, 0x83 }; // From device 4 to TV (0)
3162+
CECFrame frame(buffer, sizeof(buffer));
3163+
for (auto* listener : listeners) {
3164+
if (listener)
3165+
listener->notify(frame);
3166+
}
3167+
}
3168+
3169+
31263170
// GiveDeviceVendorID (0x8C)
31273171
TEST_F(HdmiCecSink_L2Test, InjectGiveDeviceVendorIDFrame)
31283172
{
@@ -3373,11 +3417,6 @@ TEST_F(HdmiCecSink_L2Test, InjectGiveFeaturesFrame)
33733417

33743418
TEST_F(HdmiCecSink_L2Test, InjectGiveFeaturesFrameBroadcastIgnoreTest)
33753419
{
3376-
EXPECT_CALL(*p_connectionMock, sendToAsync(::testing::_, ::testing::_))
3377-
.WillRepeatedly(::testing::Invoke(
3378-
[&](const LogicalAddress& to, const CECFrame& frame) {
3379-
throw Exception();
3380-
}));
33813420

33823421
// Simulate a CECVersion message from logical address 4 to us (0)
33833422
uint8_t buffer1[] = { 0x40, 0x9E, 0x06 }; // 0x06 = Version 2.0
@@ -3387,6 +3426,12 @@ TEST_F(HdmiCecSink_L2Test, InjectGiveFeaturesFrameBroadcastIgnoreTest)
33873426
listener->notify(frame1);
33883427
}
33893428

3429+
EXPECT_CALL(*p_connectionMock, sendToAsync(::testing::_, ::testing::_))
3430+
.WillRepeatedly(::testing::Invoke(
3431+
[&](const LogicalAddress& to, const CECFrame& frame) {
3432+
throw Exception();
3433+
}));
3434+
33903435
uint8_t buffer2[] = { 0x4F, 0xA5 }; // From device 4 to TV (0)
33913436
CECFrame frame2(buffer2, sizeof(buffer2));
33923437
for (auto* listener : listeners) {

0 commit comments

Comments
 (0)