Annotate tests to use Robolectric's LEGACY LooperMode.

The default Robolectric Looper simulation mode is changing to PAUSED from LEGACY.
The following tests fail in this new mode, and are thus being defaulted to LEGACY.

For more details see ​go/robolectric-legacy-looper-mode-lsc

Cleanup change automatically generated by error-prone refactoring
//third_party/android/androidx_test/tools/errorprone/java/androidx/test/tools/errorprone:LegacyLooperModeConverter_refactoring

Tested:
    TAP train for global presubmit queue
    http://test/OCL:297627974:BASE:298600828:1583273401491:7d94dbaa
PiperOrigin-RevId: 298809656
This commit is contained in:
olly 2020-03-04 11:04:39 +00:00 committed by Oliver Woodman
parent 63256a48d4
commit d8ea1f60af
5 changed files with 15 additions and 0 deletions

View file

@ -21,6 +21,7 @@ import static com.google.android.exoplayer2.AudioFocusManager.PLAYER_COMMAND_WAI
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import static org.robolectric.annotation.Config.TARGET_SDK;
import static org.robolectric.annotation.LooperMode.Mode.LEGACY;
import android.content.Context;
import android.media.AudioFocusRequest;
@ -36,9 +37,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;
import org.robolectric.shadows.ShadowAudioManager;
/** Unit tests for {@link AudioFocusManager}. */
@LooperMode(LEGACY)
@RunWith(AndroidJUnit4.class)
public class AudioFocusManagerTest {
private static final int NO_COMMAND_RECEIVED = ~PLAYER_COMMAND_WAIT_FOR_CALLBACK;

View file

@ -18,6 +18,7 @@ package com.google.android.exoplayer2;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.robolectric.annotation.LooperMode.Mode.LEGACY;
import android.net.Uri;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@ -37,8 +38,10 @@ import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.LooperMode;
/** Unit tests for {@link MediaPeriodQueue}. */
@LooperMode(LEGACY)
@RunWith(AndroidJUnit4.class)
public final class MediaPeriodQueueTest {

View file

@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.testutil.TestUtil.assertBufferInfosE
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.robolectric.Shadows.shadowOf;
import static org.robolectric.annotation.LooperMode.Mode.LEGACY;
import android.media.MediaCodec;
import android.media.MediaFormat;
@ -36,9 +37,11 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Shadows;
import org.robolectric.annotation.LooperMode;
import org.robolectric.shadows.ShadowLooper;
/** Unit tests for {@link DedicatedThreadAsyncMediaCodecAdapter}. */
@LooperMode(LEGACY)
@RunWith(AndroidJUnit4.class)
public class DedicatedThreadAsyncMediaCodecAdapterTest {
private DedicatedThreadAsyncMediaCodecAdapter adapter;

View file

@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.testutil.TestUtil.assertBufferInfosE
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.robolectric.Shadows.shadowOf;
import static org.robolectric.annotation.LooperMode.Mode.LEGACY;
import android.media.MediaCodec;
import android.media.MediaFormat;
@ -36,9 +37,11 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Shadows;
import org.robolectric.annotation.LooperMode;
import org.robolectric.shadows.ShadowLooper;
/** Unit tests for {@link MultiLockAsyncMediaCodecAdapter}. */
@LooperMode(LEGACY)
@RunWith(AndroidJUnit4.class)
public class MultiLockAsyncMediaCodecAdapterTest {
private MultiLockAsyncMediaCodecAdapter adapter;

View file

@ -18,6 +18,7 @@ package com.google.android.exoplayer2.upstream.cache;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.copyOfRange;
import static org.robolectric.annotation.LooperMode.Mode.LEGACY;
import android.content.Context;
import android.net.Uri;
@ -39,8 +40,10 @@ import java.io.IOException;
import java.util.Random;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.LooperMode;
/** Additional tests for {@link CacheDataSource}. */
@LooperMode(LEGACY)
@RunWith(AndroidJUnit4.class)
public final class CacheDataSourceTest2 {