# 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
abstract class ScrubbingModeContractTest
```

<br />

*** ** * ** ***

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

Subclasses should only include the logic necessary to construct the `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` and provide access to relevant methods and internals by overriding `https://developer.android.com/reference/kotlin/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 |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest.PlayerInfo` Interface that allows access to a `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` instance, relevant internals, and other methods not implemented within the `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` interface required for testing. |

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

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#audioFocusLoss_whileScrubbing_setsPlayWhenReadyToFalse()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_afterLossOfAudioFocusWhileScrubbing_handlesDeniedFocusRequest()( )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_afterTransientAudioFocusLoss_handlesDeniedFocusRequest()( )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_afterTransientAudioFocusLoss_requestsAudioFocus()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_audioFocusLostWhileScrubbingWhenPreviouslyPlaying_playsWithGrantedAudioFocus()( )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_whilePaused_updatesSuppressionReasonAndDoesNotPlay()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#disableScrubbing_whilePlaying_updatesPlaybackSuppressionReason()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#enableScrubbingMode_updatesPlaybackSuppressionReason()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#recoverAudioFocus_afterTransientLossWhileScrubbing_returnsToScrubbingSuppression()( )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/After.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#tearDown()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://junit.org/junit4/javadoc/latest/org/junit/Test.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/ScrubbingModeContractTest#transientAudioFocusLoss_whileScrubbing_onlyUpdatesSuppressionReason()()` |

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

## Public constructors

### ScrubbingModeContractTest

```
ScrubbingModeContractTest()
```

## Public functions

### audioFocusLoss_whileScrubbing_setsPlayWhenReadyToFalse

```
@Test
fun audioFocusLoss_whileScrubbing_setsPlayWhenReadyToFalse(): Unit
```

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

### disableScrubbing_afterLossOfAudioFocusWhileScrubbing_handlesDeniedFocusRequest

```
@Test
fun disableScrubbing_afterLossOfAudioFocusWhileScrubbing_handlesDeniedFocusRequest(

): Unit
```

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

### disableScrubbing_afterTransientAudioFocusLoss_handlesDeniedFocusRequest

```
@Test
fun disableScrubbing_afterTransientAudioFocusLoss_handlesDeniedFocusRequest(

): Unit
```

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

### disableScrubbing_afterTransientAudioFocusLoss_requestsAudioFocus

```
@Test
fun disableScrubbing_afterTransientAudioFocusLoss_requestsAudioFocus(): Unit
```

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

### disableScrubbing_audioFocusLostWhileScrubbingWhenPreviouslyPlaying_playsWithGrantedAudioFocus

```
@Test
fun disableScrubbing_audioFocusLostWhileScrubbingWhenPreviouslyPlaying_playsWithGrantedAudioFocus(

): Unit
```

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

### disableScrubbing_whilePaused_updatesSuppressionReasonAndDoesNotPlay

```
@Test
fun disableScrubbing_whilePaused_updatesSuppressionReasonAndDoesNotPlay(): Unit
```

### disableScrubbing_whilePlaying_updatesPlaybackSuppressionReason

```
@Test
fun disableScrubbing_whilePlaying_updatesPlaybackSuppressionReason(): Unit
```

### enableScrubbingMode_updatesPlaybackSuppressionReason

```
@Test
fun enableScrubbingMode_updatesPlaybackSuppressionReason(): Unit
```

### recoverAudioFocus_afterTransientLossWhileScrubbing_returnsToScrubbingSuppression

```
@Test
fun recoverAudioFocus_afterTransientLossWhileScrubbing_returnsToScrubbingSuppression(

): Unit
```

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

### tearDown

```
@After
fun tearDown(): Unit
```

### transientAudioFocusLoss_whileScrubbing_onlyUpdatesSuppressionReason

```
@Test
fun transientAudioFocusLoss_whileScrubbing_onlyUpdatesSuppressionReason(): Unit
```

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

## Protected functions

### createPlayerInfo

```
@ForOverride
protected abstract fun createPlayerInfo(): ScrubbingModeContractTest.PlayerInfo!
```

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

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