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