@@ -659,4 +659,61 @@ internal class TwoMediaProductsPlayLogTest {
659659 },
660660 )
661661 }
662+
663+ @Suppress(" CyclomaticComplexMethod" )
664+ @Test
665+ fun playSequentiallyWithoutRepeatOne () = runTest {
666+ val gson = Gson ()
667+ val payloadCaptor = argumentCaptor<String >()
668+
669+ player.playbackEngine.load(mediaProduct1)
670+ player.playbackEngine.play()
671+ withContext(Dispatchers .Default .limitedParallelism(1 )) {
672+ withTimeout(8 .seconds) {
673+ player.playbackEngine.events.filter { it is Event .MediaProductTransition }.first()
674+ }
675+ delay(2 .seconds)
676+ while (player.playbackEngine.assetPosition < 2 ) {
677+ delay(10 .milliseconds)
678+ }
679+ player.playbackEngine.load(mediaProduct2)
680+ player.playbackEngine.play()
681+ withTimeout(8 .seconds) {
682+ player.playbackEngine.events.filter { it is Event .MediaProductTransition }.first()
683+ }
684+ delay(1 .seconds)
685+ while (player.playbackEngine.assetPosition < 1 ) {
686+ delay(10 .milliseconds)
687+ }
688+ player.playbackEngine.reset()
689+ }
690+
691+ eventReporterCoroutineScope.advanceUntilIdle()
692+ verify(eventSender, times(2 )).sendEvent(
693+ eq(" playback_session" ),
694+ eq(ConsentCategory .NECESSARY ),
695+ payloadCaptor.capture(),
696+ eq(emptyMap()),
697+ )
698+ payloadCaptor.allValues.map {
699+ gson.fromJson(it, JsonObject ::class .java)[" payload" ].asJsonObject
700+ }.combinedPassAllOf(
701+ 1 to {
702+ assertThat(get(" startAssetPosition" ).asDouble).isAssetPositionEqualTo(0.0 )
703+ assertThat(get(" endAssetPosition" ).asDouble).isAssetPositionEqualTo(2.0 )
704+ assertThat(get(" actualProductId" )?.asString).isEqualTo(mediaProduct1.productId)
705+ assertThat(get(" sourceType" )?.asString).isEqualTo(mediaProduct1.sourceType)
706+ assertThat(get(" sourceId" )?.asString).isEqualTo(mediaProduct1.sourceId)
707+ assertThat(get(" actions" ).asJsonArray).isEmpty()
708+ },
709+ 1 to {
710+ assertThat(get(" startAssetPosition" ).asDouble).isAssetPositionEqualTo(0.0 )
711+ assertThat(get(" endAssetPosition" ).asDouble).isAssetPositionEqualTo(1.0 )
712+ assertThat(get(" actualProductId" )?.asString).isEqualTo(mediaProduct2.productId)
713+ assertThat(get(" sourceType" )?.asString).isEqualTo(mediaProduct2.sourceType)
714+ assertThat(get(" sourceId" )?.asString).isEqualTo(mediaProduct2.sourceId)
715+ assertThat(get(" actions" ).asJsonArray).isEmpty()
716+ },
717+ )
718+ }
662719}
0 commit comments