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
33360513
authored
Jul 29, 2020
by
christosts
Committed by
Oliver Woodman
Aug 01, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Migrate ExoPlayerTest.readAheadToEndDoesNotResetRenderer to TestExoplayer
PiperOrigin-RevId: 323758590
parent
075ef824
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java
library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java
View file @
33360513
...
@@ -317,7 +317,6 @@ public final class ExoPlayerTest {
...
@@ -317,7 +317,6 @@ public final class ExoPlayerTest {
final
FakeRenderer
videoRenderer
=
new
FakeRenderer
(
C
.
TRACK_TYPE_VIDEO
);
final
FakeRenderer
videoRenderer
=
new
FakeRenderer
(
C
.
TRACK_TYPE_VIDEO
);
FakeMediaClockRenderer
audioRenderer
=
FakeMediaClockRenderer
audioRenderer
=
new
FakeMediaClockRenderer
(
C
.
TRACK_TYPE_AUDIO
)
{
new
FakeMediaClockRenderer
(
C
.
TRACK_TYPE_AUDIO
)
{
@Override
@Override
public
long
getPositionUs
()
{
public
long
getPositionUs
()
{
// Simulate the playback position lagging behind the reading position: the renderer
// Simulate the playback position lagging behind the reading position: the renderer
...
@@ -340,21 +339,31 @@ public final class ExoPlayerTest {
...
@@ -340,21 +339,31 @@ public final class ExoPlayerTest {
return
videoRenderer
.
isEnded
();
return
videoRenderer
.
isEnded
();
}
}
};
};
ExoPlayerTestRunner
testRunner
=
SimpleExoPlayer
player
=
new
ExoPlayerTestRunner
.
Builder
(
context
)
new
TestExoPlayer
.
Builder
(
context
).
setRenderers
(
videoRenderer
,
audioRenderer
).
build
();
.
setTimeline
(
timeline
)
EventListener
mockEventListener
=
mock
(
EventListener
.
class
);
.
setRenderers
(
videoRenderer
,
audioRenderer
)
player
.
addListener
(
mockEventListener
);
.
setSupportedFormats
(
ExoPlayerTestRunner
.
VIDEO_FORMAT
,
ExoPlayerTestRunner
.
AUDIO_FORMAT
)
.
build
()
player
.
setMediaSource
(
.
start
()
new
FakeMediaSource
(
.
blockUntilEnded
(
TIMEOUT_MS
);
timeline
,
ExoPlayerTestRunner
.
VIDEO_FORMAT
,
ExoPlayerTestRunner
.
AUDIO_FORMAT
));
testRunner
.
assertPositionDiscontinuityReasonsEqual
(
player
.
prepare
();
Player
.
DISCONTINUITY_REASON_PERIOD_TRANSITION
,
player
.
play
();
Player
.
DISCONTINUITY_REASON_PERIOD_TRANSITION
);
runUntilPlaybackState
(
player
,
Player
.
STATE_ENDED
);
testRunner
.
assertTimelinesSame
(
new
FakeMediaSource
.
InitialTimeline
(
timeline
),
timeline
);
testRunner
.
assertTimelineChangeReasonsEqual
(
InOrder
inOrder
=
inOrder
(
mockEventListener
);
Player
.
TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED
,
inOrder
Player
.
TIMELINE_CHANGE_REASON_SOURCE_UPDATE
);
.
verify
(
mockEventListener
)
.
onTimelineChanged
(
argThat
(
noUid
(
new
FakeMediaSource
.
InitialTimeline
(
timeline
))),
eq
(
Player
.
TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED
));
inOrder
.
verify
(
mockEventListener
)
.
onTimelineChanged
(
argThat
(
noUid
(
timeline
)),
eq
(
Player
.
TIMELINE_CHANGE_REASON_SOURCE_UPDATE
));
inOrder
.
verify
(
mockEventListener
,
times
(
2
))
.
onPositionDiscontinuity
(
Player
.
DISCONTINUITY_REASON_PERIOD_TRANSITION
);
assertThat
(
audioRenderer
.
positionResetCount
).
isEqualTo
(
1
);
assertThat
(
audioRenderer
.
positionResetCount
).
isEqualTo
(
1
);
assertThat
(
videoRenderer
.
isEnded
).
isTrue
();
assertThat
(
videoRenderer
.
isEnded
).
isTrue
();
assertThat
(
audioRenderer
.
isEnded
).
isTrue
();
assertThat
(
audioRenderer
.
isEnded
).
isTrue
();
...
...
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