Merge "Fix HdmiCecLocalDevicePlaybackTest" into rvc-dev am: 6b6cf16740 am: a77e246d63
Change-Id: I4f66ab4f3086cfbee432756af6992f3aed1cec40
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -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);
|
||||
@@ -140,7 +160,6 @@ public class HdmiCecLocalDevicePlaybackTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("b/151147315")
|
||||
public void doNotWakeUpOnHotPlug_PlugIn() {
|
||||
mWokenUp = false;
|
||||
mHdmiCecLocalDevicePlayback.onHotplug(0, true);
|
||||
@@ -148,7 +167,6 @@ public class HdmiCecLocalDevicePlaybackTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("b/151147315")
|
||||
public void doNotWakeUpOnHotPlug_PlugOut() {
|
||||
mWokenUp = false;
|
||||
mHdmiCecLocalDevicePlayback.onHotplug(0, false);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user