summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-02-08 08:55:23 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-02-08 08:55:23 +0000
commit6e775d03c994b2f7e3b2f7dee05ed46c01b28731 (patch)
tree0ae2a25467af50dca378f7ad3f4e30a2d1883fd0
parentf0ec52e178b8e1df9d3a41b4b558904754cd1283 (diff)
parente26b39c9b0a8e0d476182f44159d97d113ea17e7 (diff)
downloadcts-6e775d03c994b2f7e3b2f7dee05ed46c01b28731.tar.gz
Merge "CEC: Add CTS test hf4_10_5"
-rw-r--r--hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java92
1 files changed, 92 insertions, 0 deletions
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
new file mode 100644
index 00000000000..718ae56b66a
--- /dev/null
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hdmicec.cts.playback;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.hdmicec.cts.BaseHdmiCecCtsTest;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.CecOperand;
+import android.hdmicec.cts.HdmiCecConstants;
+import android.hdmicec.cts.LogicalAddress;
+
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+
+import org.junit.Rule;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.runner.RunWith;
+
+/** HDMI CEC test verifying system audio control commands (CEC 2.0 CTS Section 7.6) */
+@RunWith(DeviceJUnit4ClassRunner.class)
+public final class HdmiCecSystemAudioControlTest extends BaseHdmiCecCtsTest {
+
+ public HdmiCecSystemAudioControlTest() {
+ super("-t", "a", "-t", "x");
+ }
+
+ @Rule
+ public RuleChain ruleChain =
+ RuleChain.outerRule(CecRules.requiresCec(this))
+ .around(CecRules.requiresLeanback(this))
+ .around(
+ CecRules.requiresDeviceType(
+ this, HdmiCecConstants.CEC_DEVICE_TYPE_PLAYBACK_DEVICE))
+ .around(hdmiCecClient);
+
+ /**
+ * Test HF4-10-5
+ *
+ * <p>Tests that a device forwards all remote control commands to the device that is providing
+ * the audio rendering.
+ */
+ @Test
+ @Ignore("b/218266432")
+ public void cect_hf4_10_5_RemoteControlCommandsWithSystemAudioControlProperty()
+ throws Exception {
+ setCec20();
+
+ ITestDevice device = getDevice();
+ // Broadcast <Set System Audio Mode> ["off"].
+ broadcastSystemAudioModeMessage(false);
+ // All remote control commands should forward to the TV.
+ sendVolumeUpCommandAndCheckForUcp(LogicalAddress.TV);
+
+ // Broadcast <Set System Audio Mode> ["on"].
+ broadcastSystemAudioModeMessage(true);
+ // All remote control commands should forward to the audio rendering device.
+ sendVolumeUpCommandAndCheckForUcp(LogicalAddress.AUDIO_SYSTEM);
+ }
+
+ private void broadcastSystemAudioModeMessage(boolean val) throws Exception {
+ hdmiCecClient.sendCecMessage(
+ hdmiCecClient.getSelfDevice(),
+ LogicalAddress.BROADCAST,
+ CecOperand.SET_SYSTEM_AUDIO_MODE,
+ CecMessage.formatParams(val ? 1 : 0));
+ }
+
+ private void sendVolumeUpCommandAndCheckForUcp(LogicalAddress toDevice) throws Exception {
+ getDevice().executeShellCommand("input keyevent KEYCODE_VOLUME_UP");
+ String message =
+ hdmiCecClient.checkExpectedOutput(toDevice, CecOperand.USER_CONTROL_PRESSED);
+ assertThat(CecMessage.getParams(message)).isEqualTo(HdmiCecConstants.CEC_KEYCODE_VOLUME_UP);
+ hdmiCecClient.checkExpectedOutput(toDevice, CecOperand.USER_CONTROL_RELEASED);
+ }
+}