Limit tests with specific SDK level to max=TARGET_SDK.
The unspecified default is the highest available SDK which may be larger than TARGET_SDK (as specified by the manifest). PiperOrigin-RevId: 249064173
This commit is contained in:
parent
33c677846a
commit
07c4569b5f
@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.audio.AudioFocusManager.PLAYER_COMMA
|
||||
import static com.google.android.exoplayer2.audio.AudioFocusManager.PLAYER_COMMAND_WAIT_FOR_CALLBACK;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.robolectric.annotation.Config.TARGET_SDK;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioFocusRequest;
|
||||
@ -99,7 +100,7 @@ public class AudioFocusManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(minSdk = 26)
|
||||
@Config(minSdk = 26, maxSdk = TARGET_SDK)
|
||||
public void setAudioAttributes_withNullUsage_releasesAudioFocus_v26() {
|
||||
// Create attributes and request audio focus.
|
||||
AudioAttributes media = new AudioAttributes.Builder().setUsage(C.USAGE_MEDIA).build();
|
||||
@ -301,7 +302,7 @@ public class AudioFocusManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(minSdk = 26)
|
||||
@Config(minSdk = 26, maxSdk = TARGET_SDK)
|
||||
public void onAudioFocusChange_withAudioFocusLost_sendsDoNotPlayAndAbandondsFocus_v26() {
|
||||
// Ensure that AUDIOFOCUS_LOSS causes AudioFocusManager to pause playback and abandon audio
|
||||
// focus.
|
||||
@ -351,7 +352,7 @@ public class AudioFocusManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(minSdk = 26)
|
||||
@Config(minSdk = 26, maxSdk = TARGET_SDK)
|
||||
public void handleStop_withAudioFocus_abandonsAudioFocus_v26() {
|
||||
// Ensure that handleStop causes AudioFocusManager to abandon audio focus.
|
||||
AudioAttributes media =
|
||||
@ -421,7 +422,7 @@ public class AudioFocusManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(minSdk = 26)
|
||||
@Config(minSdk = 26, maxSdk = TARGET_SDK)
|
||||
public void handleStop_withoutHandlingAudioFocus_isNoOp_v26() {
|
||||
// Ensure that handleStop is a no-op if audio focus isn't handled.
|
||||
Shadows.shadowOf(audioManager)
|
||||
|
@ -16,8 +16,8 @@
|
||||
package com.google.android.exoplayer2.audio;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.robolectric.annotation.Config.NEWEST_SDK;
|
||||
import static org.robolectric.annotation.Config.OLDEST_SDK;
|
||||
import static org.robolectric.annotation.Config.TARGET_SDK;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.C;
|
||||
@ -185,7 +185,7 @@ public final class DefaultAudioSinkTest {
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Config(minSdk = 21, maxSdk = NEWEST_SDK)
|
||||
@Config(minSdk = 21, maxSdk = TARGET_SDK)
|
||||
@Test
|
||||
public void supportsFloatOutputFromApi21() {
|
||||
assertThat(defaultAudioSink.supportsOutput(CHANNEL_COUNT_STEREO, C.ENCODING_PCM_FLOAT))
|
||||
|
Loading…
x
Reference in New Issue
Block a user