Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5144b740
authored
Feb 02, 2022
by
samrobinson
Committed by
Ian Baker
Feb 04, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove the need for a test runner TransformationResult.
PiperOrigin-RevId: 425882755
parent
032df64f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/TransformerTestRunner.java
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/TransformerTestRunner.java
View file @
5144b740
...
@@ -22,6 +22,9 @@ import androidx.annotation.Nullable;
...
@@ -22,6 +22,9 @@ import androidx.annotation.Nullable;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.robolectric.RobolectricUtil
;
import
com.google.android.exoplayer2.robolectric.RobolectricUtil
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicReference
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
/** Helper class to run a {@link Transformer} test. */
/** Helper class to run a {@link Transformer} test. */
public
final
class
TransformerTestRunner
{
public
final
class
TransformerTestRunner
{
...
@@ -68,28 +71,27 @@ public final class TransformerTestRunner {
...
@@ -68,28 +71,27 @@ public final class TransformerTestRunner {
@Nullable
@Nullable
private
static
TransformationException
runUntilListenerCalled
(
Transformer
transformer
)
private
static
TransformationException
runUntilListenerCalled
(
Transformer
transformer
)
throws
TimeoutException
{
throws
TimeoutException
{
TransformationResult
transformationResult
=
new
TransformationResult
();
AtomicBoolean
transformationCompleted
=
new
AtomicBoolean
();
AtomicReference
<
@NullableType
TransformationException
>
transformationException
=
new
AtomicReference
<>();
transformer
.
addListener
(
transformer
.
addListener
(
new
Transformer
.
Listener
()
{
new
Transformer
.
Listener
()
{
@Override
@Override
public
void
onTransformationCompleted
(
MediaItem
inputMediaItem
)
{
public
void
onTransformationCompleted
(
MediaItem
inputMediaItem
)
{
transformation
Result
.
isCompleted
=
true
;
transformation
Completed
.
set
(
true
)
;
}
}
@Override
@Override
public
void
onTransformationError
(
public
void
onTransformationError
(
MediaItem
inputMediaItem
,
TransformationException
exception
)
{
MediaItem
inputMediaItem
,
TransformationException
exception
)
{
transformation
Result
.
exception
=
exception
;
transformation
Exception
.
set
(
exception
)
;
}
}
});
});
runLooperUntil
(
runLooperUntil
(
transformer
.
getApplicationLooper
(),
transformer
.
getApplicationLooper
(),
()
->
transformationResult
.
isCompleted
||
transformationResult
.
exception
!=
null
);
()
->
transformationCompleted
.
get
()
||
transformationException
.
get
()
!=
null
);
return
transformationResult
.
exception
;
}
private
static
class
TransformationResult
{
return
transformationException
.
get
();
public
boolean
isCompleted
;
@Nullable
public
TransformationException
exception
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment