@@ -660,4 +660,57 @@ internal class TwoMediaProductsPlayLogTest {
660
660
eq(emptyMap()),
661
661
)
662
662
}
663
+
664
+ @Test
665
+ fun playSequentiallyWithoutRepeatOne () = runTest {
666
+ val gson = Gson ()
667
+
668
+ player.playbackEngine.load(mediaProduct1)
669
+ player.playbackEngine.play()
670
+ withContext(Dispatchers .Default .limitedParallelism(1 )) {
671
+ delay(2 .seconds)
672
+ while (player.playbackEngine.assetPosition < 2 ) {
673
+ delay(10 .milliseconds)
674
+ }
675
+ player.playbackEngine.load(mediaProduct2)
676
+ player.playbackEngine.play()
677
+ delay(1 .seconds)
678
+ while (player.playbackEngine.assetPosition < 1 ) {
679
+ delay(10 .milliseconds)
680
+ }
681
+ player.playbackEngine.reset()
682
+ }
683
+
684
+ eventReporterCoroutineScope.advanceUntilIdle()
685
+ verify(eventSender).sendEvent(
686
+ eq(" playback_session" ),
687
+ eq(ConsentCategory .NECESSARY ),
688
+ argThat {
689
+ with (gson.fromJson(this , JsonObject ::class .java)[" payload" ].asJsonObject) {
690
+ get(" startAssetPosition" ).asDouble.isAssetPositionEqualTo(0.0 ) &&
691
+ get(" endAssetPosition" ).asDouble.isAssetPositionEqualTo(2.0 ) &&
692
+ get(" actualProductId" )?.asString.contentEquals(mediaProduct1.productId) &&
693
+ get(" sourceType" )?.asString.contentEquals(mediaProduct1.sourceType) &&
694
+ get(" sourceId" )?.asString.contentEquals(mediaProduct1.sourceId) &&
695
+ get(" actions" ).asJsonArray.isEmpty
696
+ }
697
+ },
698
+ eq(emptyMap()),
699
+ )
700
+ verify(eventSender).sendEvent(
701
+ eq(" playback_session" ),
702
+ eq(ConsentCategory .NECESSARY ),
703
+ argThat {
704
+ with (gson.fromJson(this , JsonObject ::class .java)[" payload" ].asJsonObject) {
705
+ get(" startAssetPosition" ).asDouble.isAssetPositionEqualTo(0.0 ) &&
706
+ get(" endAssetPosition" ).asDouble.isAssetPositionEqualTo(1.0 ) &&
707
+ get(" actualProductId" )?.asString.contentEquals(mediaProduct2.productId) &&
708
+ get(" sourceType" )?.asString.contentEquals(mediaProduct2.sourceType) &&
709
+ get(" sourceId" )?.asString.contentEquals(mediaProduct2.sourceId) &&
710
+ get(" actions" ).asJsonArray.isEmpty
711
+ }
712
+ },
713
+ eq(emptyMap()),
714
+ )
715
+ }
663
716
}
0 commit comments