Add null check for worker

Add null check to avoid crash when worker cannot get through uri.

Bug: 128492874
Test: make -j42 RunSettingsRoboTests
Change-Id: I789ce0bfa98c0b0b145a8605c58c88a77eeb76a9
This commit is contained in:
hughchen
2019-03-14 11:29:32 +08:00
parent d4ab14969f
commit 8f76b44410
2 changed files with 16 additions and 2 deletions

View File

@@ -93,6 +93,13 @@ public class MediaOutputSliceTest {
mMediaOutputSlice.init(TEST_PACKAGE_NAME, mMediaDeviceUpdateWorker);
}
@Test
public void getSlice_workerIsNull_shouldNotCrash() {
mMediaOutputSlice.init(TEST_PACKAGE_NAME, null);
mMediaOutputSlice.getSlice();
}
@Test
public void getSlice_shouldHaveActiveDeviceName() {
mDevices.clear();