@@ -465,4 +465,65 @@ internal class TwoMediaProductsPlayLogTest {
465465 eq(emptyMap()),
466466 )
467467 }
468+
469+ @Suppress(" CyclomaticComplexMethod" , " LongMethod" )
470+ @Test
471+ fun skipToNextWithRepeatOne () = runTest {
472+ val gson = Gson ()
473+
474+ player.playbackEngine.load(mediaProduct1)
475+ player.playbackEngine.setRepeatOne(true )
476+ player.playbackEngine.play()
477+ player.playbackEngine.setNext(mediaProduct2)
478+ withContext(Dispatchers .Default .limitedParallelism(1 )) {
479+ withTimeout(8 .seconds) {
480+ player.playbackEngine.events.filter { it is Event .MediaProductTransition }.first()
481+ }
482+ delay(1 .seconds)
483+ while (player.playbackEngine.assetPosition < 1 ) {
484+ delay(10 .milliseconds)
485+ }
486+ player.playbackEngine.skipToNext()
487+ withTimeout(8 .seconds) {
488+ player.playbackEngine.events.filter { it is Event .MediaProductTransition }.first()
489+ }
490+ delay(1 .seconds)
491+ while (player.playbackEngine.assetPosition < 1 ) {
492+ delay(10 .milliseconds)
493+ }
494+ player.playbackEngine.reset()
495+ }
496+
497+ eventReporterCoroutineScope.advanceUntilIdle()
498+ verify(eventSender).sendEvent(
499+ eq(" playback_session" ),
500+ eq(ConsentCategory .NECESSARY ),
501+ argThat {
502+ with (gson.fromJson(this , JsonObject ::class .java)[" payload" ].asJsonObject) {
503+ get(" startAssetPosition" ).asDouble.isAssetPositionEqualTo(0.0 ) &&
504+ get(" endAssetPosition" ).asDouble.isAssetPositionEqualTo(1.0 ) &&
505+ get(" actualProductId" )?.asString.contentEquals(mediaProduct1.productId) &&
506+ get(" sourceType" )?.asString.contentEquals(mediaProduct1.sourceType) &&
507+ get(" sourceId" )?.asString.contentEquals(mediaProduct1.sourceId) &&
508+ get(" actions" ).asJsonArray.isEmpty
509+ }
510+ },
511+ eq(emptyMap()),
512+ )
513+ verify(eventSender).sendEvent(
514+ eq(" playback_session" ),
515+ eq(ConsentCategory .NECESSARY ),
516+ argThat {
517+ with (gson.fromJson(this , JsonObject ::class .java)[" payload" ].asJsonObject) {
518+ get(" startAssetPosition" ).asDouble.isAssetPositionEqualTo(0.0 ) &&
519+ get(" endAssetPosition" ).asDouble.isAssetPositionEqualTo(1.0 ) &&
520+ get(" actualProductId" )?.asString.contentEquals(mediaProduct2.productId) &&
521+ get(" sourceType" )?.asString.contentEquals(mediaProduct2.sourceType) &&
522+ get(" sourceId" )?.asString.contentEquals(mediaProduct2.sourceId) &&
523+ get(" actions" ).asJsonArray.isEmpty
524+ }
525+ },
526+ eq(emptyMap()),
527+ )
528+ }
468529}
0 commit comments