HDMICEC: 11.1.1-5 Test TV response when displaying internal source
Test to check that device broadcasts an <Active Source> message when
changing to an internal source from previously displaying an external
source.
Bug: 173468440
Test: atest cect_11_1_1_5_DutBroadcastsActiveSourceWhenChangingToInternal
Change-Id: I48e56309a763bfa1099cbb8ca545b203ed26ce8f
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/tv/HdmiCecTvOneTouchPlayTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/tv/HdmiCecTvOneTouchPlayTest.java
index ee6fafa..fef8b62 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/tv/HdmiCecTvOneTouchPlayTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/tv/HdmiCecTvOneTouchPlayTest.java
@@ -18,6 +18,7 @@
import android.hdmicec.cts.BaseHdmiCecCtsTest;
import android.hdmicec.cts.CecOperand;
+import android.hdmicec.cts.HdmiControlManagerUtility;
import android.hdmicec.cts.LogicalAddress;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
@@ -94,4 +95,36 @@
.isEqualTo(testDevice);
}
}
+
+ /**
+ * Test 11.1.1-5
+ *
+ * <p>Tests that the DUT broadcasts an {@code <Active Source>} message when changing to an
+ * internal source from previously displaying an external source.
+ */
+ @Test
+ public void cect_11_1_1_5_DutBroadcastsActiveSourceWhenChangingToInternal() throws Exception {
+ // Ensure that an external source is the active source.
+ try {
+ /*
+ * Check for the broadcasted <ACTIVE_SOURCE> message from Recorder_1, which was sent as
+ * a response to <SET_STREAM_PATH> message from the TV.
+ */
+ String message =
+ hdmiCecClient.checkExpectedMessageFromClient(
+ LogicalAddress.RECORDER_1, CecOperand.ACTIVE_SOURCE);
+ } catch (Exception e) {
+ /*
+ * In case the TV does not send <Set Stream Path> to CEC adapter, or the client does
+ * not make recorder active source, broadcast an <Active Source> message from the
+ * adapter.
+ */
+ hdmiCecClient.broadcastActiveSource(
+ LogicalAddress.RECORDER_1, hdmiCecClient.getPhysicalAddress());
+ }
+ // Make the TV device the active source.
+ HdmiControlManagerUtility.setActiveSource(
+ getDevice(), LogicalAddress.TV.getLogicalAddressAsInt());
+ hdmiCecClient.checkExpectedOutput(LogicalAddress.BROADCAST, CecOperand.ACTIVE_SOURCE);
+ }
}