Add utility testing Player.Listener in transformer tests
PiperOrigin-RevId: 596891721
This commit is contained in:
parent
6f8249184b
commit
4198f7e242
BIN
libraries/test_data/src/test/assets/media/jpeg/white-1x1.jpg
Normal file
BIN
libraries/test_data/src/test/assets/media/jpeg/white-1x1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 518 B |
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.transformer.mh.performance;
|
||||
package androidx.media3.transformer;
|
||||
|
||||
import android.os.ConditionVariable;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -26,8 +26,8 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
/** A listener for testing previewing performance. */
|
||||
/* package */ class PerformanceTestListener implements Player.Listener, AnalyticsListener {
|
||||
/** Utility {@link Player.Listener} for testing. */
|
||||
public final class PlayerTestListener implements Player.Listener, AnalyticsListener {
|
||||
|
||||
private final ConditionVariable playerReady;
|
||||
private final ConditionVariable playerEnded;
|
||||
@ -41,7 +41,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
* @param testTimeoutMs The timeout value in milliseconds for which {@link
|
||||
* #waitUntilPlayerReady()} and {@link #waitUntilPlayerEnded()} waits.
|
||||
*/
|
||||
public PerformanceTestListener(long testTimeoutMs) {
|
||||
public PlayerTestListener(long testTimeoutMs) {
|
||||
playerReady = new ConditionVariable();
|
||||
playerEnded = new ConditionVariable();
|
||||
playbackException = new AtomicReference<>();
|
@ -28,6 +28,7 @@ import androidx.media3.common.PlaybackException;
|
||||
import androidx.media3.exoplayer.DecoderCounters;
|
||||
import androidx.media3.exoplayer.ExoPlayer;
|
||||
import androidx.media3.exoplayer.util.EventLogger;
|
||||
import androidx.media3.transformer.PlayerTestListener;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
@ -66,7 +67,7 @@ public class VideoEffectsPreviewPerformanceTest {
|
||||
*/
|
||||
@Test
|
||||
public void exoplayerEffectsPreviewTest() throws PlaybackException, TimeoutException {
|
||||
PerformanceTestListener listener = new PerformanceTestListener(TEST_TIMEOUT_MS);
|
||||
PlayerTestListener listener = new PlayerTestListener(TEST_TIMEOUT_MS);
|
||||
instrumentation.runOnMainSync(
|
||||
() -> {
|
||||
player = new ExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user