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
e71ce067
authored
Dec 23, 2020
by
olly
Committed by
Oliver Woodman
Dec 23, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add e2e test for playing SilenceMediaSource
PiperOrigin-RevId: 348789555
parent
cc6638d1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
library/core/src/test/java/com/google/android/exoplayer2/e2etest/SilencePlaybackTest.java
testdata/src/test/assets/playbackdumps/silence/500ms.dump
library/core/src/test/java/com/google/android/exoplayer2/e2etest/SilencePlaybackTest.java
0 → 100644
View file @
e71ce067
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer2
.
e2etest
;
import
android.content.Context
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.robolectric.PlaybackOutput
;
import
com.google.android.exoplayer2.robolectric.TestPlayerRunHelper
;
import
com.google.android.exoplayer2.source.SilenceMediaSource
;
import
com.google.android.exoplayer2.testutil.AutoAdvancingFakeClock
;
import
com.google.android.exoplayer2.testutil.CapturingRenderersFactory
;
import
com.google.android.exoplayer2.testutil.DumpFileAsserts
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.robolectric.annotation.Config
;
/** End-to-end tests using {@link SilenceMediaSource}. */
// TODO(b/143232359): Remove once https://issuetracker.google.com/143232359 is resolved.
@Config
(
sdk
=
29
)
@RunWith
(
AndroidJUnit4
.
class
)
public
final
class
SilencePlaybackTest
{
@Test
public
void
test_500ms
()
throws
Exception
{
Context
applicationContext
=
ApplicationProvider
.
getApplicationContext
();
CapturingRenderersFactory
capturingRenderersFactory
=
new
CapturingRenderersFactory
(
applicationContext
);
SimpleExoPlayer
player
=
new
SimpleExoPlayer
.
Builder
(
applicationContext
,
capturingRenderersFactory
)
.
setClock
(
new
AutoAdvancingFakeClock
())
.
build
();
PlaybackOutput
playbackOutput
=
PlaybackOutput
.
register
(
player
,
capturingRenderersFactory
);
player
.
setMediaSource
(
new
SilenceMediaSource
(
/* durationUs= */
500_000
));
player
.
prepare
();
player
.
play
();
TestPlayerRunHelper
.
runUntilPlaybackState
(
player
,
Player
.
STATE_ENDED
);
player
.
release
();
DumpFileAsserts
.
assertOutput
(
applicationContext
,
playbackOutput
,
"playbackdumps/silence/500ms.dump"
);
}
}
testdata/src/test/assets/playbackdumps/silence/500ms.dump
0 → 100644
View file @
e71ce067
File mode changed
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