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
f94d3cf6
authored
Mar 06, 2023
by
tofunmi
Committed by
Rohit Singh
Mar 07, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
ImageAssetLoaderTest minor fixes
PiperOrigin-RevId: 514436359
parent
61889526
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/ImageAssetLoaderTest.java
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/ImageAssetLoaderTest.java
View file @
f94d3cf6
...
...
@@ -22,12 +22,10 @@ import android.graphics.Bitmap;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
android.os.Looper
;
import
androidx.annotation.Nullable
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
java.time.Duration
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicReference
;
...
...
@@ -35,7 +33,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.robolectric.shadows.ShadowSystemClock
;
/** Unit tests for {@link
ExoPlayer
AssetLoader}. */
/** Unit tests for {@link
Image
AssetLoader}. */
@RunWith
(
AndroidJUnit4
.
class
)
public
class
ImageAssetLoaderTest
{
...
...
@@ -55,6 +53,7 @@ public class ImageAssetLoaderTest {
@Override
public
void
onDurationUs
(
long
durationUs
)
{
// Sleep to increase the chances of the test failing.
sleep
();
isDurationSet
=
true
;
}
...
...
@@ -72,7 +71,10 @@ public class ImageAssetLoaderTest {
@AssetLoader
.
SupportedOutputTypes
int
supportedOutputTypes
,
long
streamStartPositionUs
,
long
streamOffsetUs
)
{
if
(!
isTrackCountSet
)
{
if
(!
isDurationSet
)
{
exceptionRef
.
set
(
new
IllegalStateException
(
"onTrackAdded() called before onDurationUs()"
));
}
else
if
(!
isTrackCountSet
)
{
exceptionRef
.
set
(
new
IllegalStateException
(
"onTrackAdded() called before onTrackCount()"
));
}
...
...
@@ -83,11 +85,7 @@ public class ImageAssetLoaderTest {
@Override
public
SampleConsumer
onOutputFormat
(
Format
format
)
{
if
(!
isDurationSet
)
{
exceptionRef
.
set
(
new
IllegalStateException
(
"onTrackAdded() called before onDurationUs()"
));
}
else
if
(!
isTrackAdded
)
{
if
(!
isTrackAdded
)
{
exceptionRef
.
set
(
new
IllegalStateException
(
"onOutputFormat() called before onTrackAdded()"
));
}
...
...
@@ -100,7 +98,7 @@ public class ImageAssetLoaderTest {
exceptionRef
.
set
(
e
);
}
void
sleep
()
{
private
void
sleep
()
{
try
{
Thread
.
sleep
(
10
);
}
catch
(
InterruptedException
e
)
{
...
...
@@ -134,15 +132,6 @@ public class ImageAssetLoaderTest {
private
static
final
class
FakeSampleConsumer
implements
SampleConsumer
{
@Nullable
@Override
public
DecoderInputBuffer
getInputBuffer
()
{
return
null
;
}
@Override
public
void
queueInputBuffer
()
{}
@Override
public
void
queueInputBitmap
(
Bitmap
inputBitmap
,
long
durationUs
,
int
frameRate
)
{}
...
...
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