Loading services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java +21 −9 Original line number Diff line number Diff line Loading @@ -20,7 +20,12 @@ import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC import static com.google.common.truth.Truth.assertThat; import android.content.Context; import android.os.Handler; import android.os.IPowerManager; import android.os.IThermalService; import android.os.Looper; import android.os.PowerManager; import android.os.test.TestLooper; import android.view.KeyEvent; Loading @@ -32,6 +37,8 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.ArrayList; Loading @@ -50,8 +57,17 @@ public class HdmiCecLocalDevicePlaybackTest { private int mPlaybackPhysicalAddress; private boolean mWokenUp; @Mock private IPowerManager mIPowerManagerMock; @Mock private IThermalService mIThermalServiceMock; @Before public void setUp() { MockitoAnnotations.initMocks(this); Context context = InstrumentationRegistry.getTargetContext(); mMyLooper = mTestLooper.getLooper(); PowerManager powerManager = new PowerManager(context, mIPowerManagerMock, mIThermalServiceMock, new Handler(mMyLooper)); mHdmiControlService = new HdmiControlService(InstrumentationRegistry.getTargetContext()) { @Override Loading @@ -68,9 +84,13 @@ public class HdmiCecLocalDevicePlaybackTest { void writeStringSystemProperty(String key, String value) { // do nothing } @Override PowerManager getPowerManager() { return powerManager; } }; mMyLooper = mTestLooper.getLooper(); mHdmiCecLocalDevicePlayback = new HdmiCecLocalDevicePlayback(mHdmiControlService); mHdmiCecLocalDevicePlayback.init(); mHdmiControlService.setIoLooper(mMyLooper); Loading Loading @@ -140,7 +160,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void doNotWakeUpOnHotPlug_PlugIn() { mWokenUp = false; mHdmiCecLocalDevicePlayback.onHotplug(0, true); Loading @@ -148,7 +167,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void doNotWakeUpOnHotPlug_PlugOut() { mWokenUp = false; mHdmiCecLocalDevicePlayback.onHotplug(0, false); Loading @@ -156,7 +174,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_up_volumeEnabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(true); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_UP, true); Loading @@ -166,7 +183,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_down_volumeEnabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(true); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_DOWN, true); Loading @@ -176,7 +192,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_mute_volumeEnabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(true); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_MUTE, true); Loading @@ -186,7 +201,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_up_volumeDisabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(false); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_UP, true); Loading @@ -196,7 +210,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_down_volumeDisabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(false); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_DOWN, true); Loading @@ -206,7 +219,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_mute_volumeDisabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(false); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_MUTE, true); Loading Loading
services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java +21 −9 Original line number Diff line number Diff line Loading @@ -20,7 +20,12 @@ import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC import static com.google.common.truth.Truth.assertThat; import android.content.Context; import android.os.Handler; import android.os.IPowerManager; import android.os.IThermalService; import android.os.Looper; import android.os.PowerManager; import android.os.test.TestLooper; import android.view.KeyEvent; Loading @@ -32,6 +37,8 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.ArrayList; Loading @@ -50,8 +57,17 @@ public class HdmiCecLocalDevicePlaybackTest { private int mPlaybackPhysicalAddress; private boolean mWokenUp; @Mock private IPowerManager mIPowerManagerMock; @Mock private IThermalService mIThermalServiceMock; @Before public void setUp() { MockitoAnnotations.initMocks(this); Context context = InstrumentationRegistry.getTargetContext(); mMyLooper = mTestLooper.getLooper(); PowerManager powerManager = new PowerManager(context, mIPowerManagerMock, mIThermalServiceMock, new Handler(mMyLooper)); mHdmiControlService = new HdmiControlService(InstrumentationRegistry.getTargetContext()) { @Override Loading @@ -68,9 +84,13 @@ public class HdmiCecLocalDevicePlaybackTest { void writeStringSystemProperty(String key, String value) { // do nothing } @Override PowerManager getPowerManager() { return powerManager; } }; mMyLooper = mTestLooper.getLooper(); mHdmiCecLocalDevicePlayback = new HdmiCecLocalDevicePlayback(mHdmiControlService); mHdmiCecLocalDevicePlayback.init(); mHdmiControlService.setIoLooper(mMyLooper); Loading Loading @@ -140,7 +160,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void doNotWakeUpOnHotPlug_PlugIn() { mWokenUp = false; mHdmiCecLocalDevicePlayback.onHotplug(0, true); Loading @@ -148,7 +167,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void doNotWakeUpOnHotPlug_PlugOut() { mWokenUp = false; mHdmiCecLocalDevicePlayback.onHotplug(0, false); Loading @@ -156,7 +174,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_up_volumeEnabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(true); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_UP, true); Loading @@ -166,7 +183,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_down_volumeEnabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(true); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_DOWN, true); Loading @@ -176,7 +192,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_mute_volumeEnabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(true); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_MUTE, true); Loading @@ -186,7 +201,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_up_volumeDisabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(false); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_UP, true); Loading @@ -196,7 +210,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_down_volumeDisabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(false); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_DOWN, true); Loading @@ -206,7 +219,6 @@ public class HdmiCecLocalDevicePlaybackTest { } @Test @Ignore("b/151147315") public void sendVolumeKeyEvent_mute_volumeDisabled() { mHdmiControlService.setHdmiCecVolumeControlEnabled(false); mHdmiCecLocalDevicePlayback.sendVolumeKeyEvent(KeyEvent.KEYCODE_VOLUME_MUTE, true); Loading