# ScrubbingModeContractTest

Artifact: [androidx.media3:media3-test-utils-robolectric](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.java+class:androidx.media3.test.utils.robolectric.ScrubbingModeContractTest)

*** ** * ** ***


```
@UnstableApi
public abstract class ScrubbingModeContractTest
```

<br />

*** ** * ** ***

A collection of contract tests for `https://developer.android.com/reference/androidx/media3/common/Player` implementations that support `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_AUDIO_ATTRIBUTES()` and `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setScrubbingModeEnabled(boolean)`.

Subclasses should only include the logic necessary to construct the `https://developer.android.com/reference/androidx/media3/common/Player` and provide access to relevant methods and internals by overriding `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#createPlayerInfo()`.

Subclasses shouldn't include any new `https://junit.org/junit4/javadoc/latest/org/junit/Test.html` methods - implementation-specific tests should be in a separate class.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo` Interface that allows access to a `https://developer.android.com/reference/androidx/media3/common/Player` instance, relevant internals, and other methods not implemented within the `https://developer.android.com/reference/androidx/media3/common/Player` interface required for testing. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#ScrubbingModeContractTest()()` |

| ### Public methods |
|---|---|
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#audioFocusLoss_whileScrubbing_setsPlayWhenReadyToFalse()()` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_afterLossOfAudioFocusWhileScrubbing_handlesDeniedFocusRequest()( )` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_afterTransientAudioFocusLoss_handlesDeniedFocusRequest()( )` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_afterTransientAudioFocusLoss_requestsAudioFocus()()` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_audioFocusLostWhileScrubbingWhenPreviouslyPlaying_playsWithGrantedAudioFocus()( )` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_whilePaused_updatesSuppressionReasonAndDoesNotPlay()()` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_whilePlaying_updatesPlaybackSuppressionReason()()` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#enableScrubbingMode_updatesPlaybackSuppressionReason()()` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#recoverAudioFocus_afterTransientLossWhileScrubbing_returnsToScrubbingSuppression()( )` |
| `final void` | `@https://junit.org/junit4/javadoc/latest/org/junit/After.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#tearDown()()` |
| `void` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#transientAudioFocusLoss_whileScrubbing_onlyUpdatesSuppressionReason()()` |

| ### Protected methods |
|---|---|
| `abstract https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo` | `@https://checkerframework.org/api/com/google/errorprone/annotations/ForOverride.html https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#createPlayerInfo()()` Creates and returns the `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo` with which to run the tests. |

## Public constructors

### ScrubbingModeContractTest

```
public ScrubbingModeContractTest()
```

## Public methods

### audioFocusLoss_whileScrubbing_setsPlayWhenReadyToFalse

```
@Test
public void audioFocusLoss_whileScrubbing_setsPlayWhenReadyToFalse()
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### disableScrubbing_afterLossOfAudioFocusWhileScrubbing_handlesDeniedFocusRequest

```
@Test
public void disableScrubbing_afterLossOfAudioFocusWhileScrubbing_handlesDeniedFocusRequest(

)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### disableScrubbing_afterTransientAudioFocusLoss_handlesDeniedFocusRequest

```
@Test
public void disableScrubbing_afterTransientAudioFocusLoss_handlesDeniedFocusRequest(

)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### disableScrubbing_afterTransientAudioFocusLoss_requestsAudioFocus

```
@Test
public void disableScrubbing_afterTransientAudioFocusLoss_requestsAudioFocus()
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### disableScrubbing_audioFocusLostWhileScrubbingWhenPreviouslyPlaying_playsWithGrantedAudioFocus

```
@Test
public void disableScrubbing_audioFocusLostWhileScrubbingWhenPreviouslyPlaying_playsWithGrantedAudioFocus(

)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### disableScrubbing_whilePaused_updatesSuppressionReasonAndDoesNotPlay

```
@Test
public void disableScrubbing_whilePaused_updatesSuppressionReasonAndDoesNotPlay()
```

### disableScrubbing_whilePlaying_updatesPlaybackSuppressionReason

```
@Test
public void disableScrubbing_whilePlaying_updatesPlaybackSuppressionReason()
```

### enableScrubbingMode_updatesPlaybackSuppressionReason

```
@Test
public void enableScrubbingMode_updatesPlaybackSuppressionReason()
```

### recoverAudioFocus_afterTransientLossWhileScrubbing_returnsToScrubbingSuppression

```
@Test
public void recoverAudioFocus_afterTransientLossWhileScrubbing_returnsToScrubbingSuppression(

)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### tearDown

```
@After
public final void tearDown()
```

### transientAudioFocusLoss_whileScrubbing_onlyUpdatesSuppressionReason

```
@Test
public void transientAudioFocusLoss_whileScrubbing_onlyUpdatesSuppressionReason()
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

## Protected methods

### createPlayerInfo

```
@ForOverride
protected abstract ScrubbingModeContractTest.PlayerInfo createPlayerInfo()
```

Creates and returns the `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo` with which to run the tests.

The `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo#getPlayer()` must have `https://developer.android.com/reference/androidx/media3/common/Player#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)` and `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo#setScrubbingModeEnabled(boolean)` initially disabled.