@@ -401,4 +401,64 @@ internal class TwoMediaProductsPlayLogTest {
401401 eq(emptyMap()),
402402 )
403403 }
404+
405+ @Suppress(" CyclomaticComplexMethod" , " LongMethod" )
406+ @Test
407+ fun skipToNext () = runTest {
408+ val gson = Gson ()
409+
410+ player.playbackEngine.load(mediaProduct1)
411+ player.playbackEngine.play()
412+ player.playbackEngine.setNext(mediaProduct2)
413+ withContext(Dispatchers .Default .limitedParallelism(1 )) {
414+ withTimeout(4 .seconds) {
415+ player.playbackEngine.events.filter { it is Event .MediaProductTransition }.first()
416+ }
417+ delay(1 .seconds)
418+ while (player.playbackEngine.assetPosition < 1 ) {
419+ delay(10 .milliseconds)
420+ }
421+ player.playbackEngine.skipToNext()
422+ withTimeout(4 .seconds) {
423+ player.playbackEngine.events.filter { it is Event .MediaProductTransition }.first()
424+ }
425+ delay(1 .seconds)
426+ while (player.playbackEngine.assetPosition < 1 ) {
427+ delay(10 .milliseconds)
428+ }
429+ player.playbackEngine.reset()
430+ }
431+
432+ eventReporterCoroutineScope.advanceUntilIdle()
433+ verify(eventSender).sendEvent(
434+ eq(" playback_session" ),
435+ eq(ConsentCategory .NECESSARY ),
436+ argThat {
437+ with (gson.fromJson(this , JsonObject ::class .java)[" payload" ].asJsonObject) {
438+ get(" startAssetPosition" ).asDouble.isAssetPositionEqualTo(0.0 ) &&
439+ get(" endAssetPosition" ).asDouble.isAssetPositionEqualTo(1.0 ) &&
440+ get(" actualProductId" )?.asString.contentEquals(mediaProduct1.productId) &&
441+ get(" sourceType" )?.asString.contentEquals(mediaProduct1.sourceType) &&
442+ get(" sourceId" )?.asString.contentEquals(mediaProduct1.sourceId) &&
443+ get(" actions" ).asJsonArray.isEmpty
444+ }
445+ },
446+ eq(emptyMap()),
447+ )
448+ verify(eventSender).sendEvent(
449+ eq(" playback_session" ),
450+ eq(ConsentCategory .NECESSARY ),
451+ argThat {
452+ with (gson.fromJson(this , JsonObject ::class .java)[" payload" ].asJsonObject) {
453+ get(" startAssetPosition" ).asDouble.isAssetPositionEqualTo(0.0 ) &&
454+ get(" endAssetPosition" ).asDouble.isAssetPositionEqualTo(1.0 ) &&
455+ get(" actualProductId" )?.asString.contentEquals(mediaProduct2.productId) &&
456+ get(" sourceType" )?.asString.contentEquals(mediaProduct2.sourceType) &&
457+ get(" sourceId" )?.asString.contentEquals(mediaProduct2.sourceId) &&
458+ get(" actions" ).asJsonArray.isEmpty
459+ }
460+ },
461+ eq(emptyMap()),
462+ )
463+ }
404464}
0 commit comments