File tree Expand file tree Collapse file tree
sentry-android-core/src/test/java/io/sentry/android/core/internal/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -676,12 +676,18 @@ class SentryFrameMetricsCollectorTest {
676676 val choreographer = collector.getProperty<Choreographer >(" choreographer" )
677677 choreographer.injectForField(" mLastFrameTimeNanos" , TimeUnit .SECONDS .toNanos(5 ))
678678
679- // query a range that only partially overlaps the frozen frame
680- // the frame starts around 50ns (INTENDED_VSYNC_TIMESTAMP), so querying from a later point
681- // should reduce the delay proportionally
682- val result = collector.getFramesDelay(0 , TimeUnit .SECONDS .toNanos(5 ))
683- assertTrue(result.delaySeconds > 0 )
684- assertEquals(1 , result.framesContributingToDelayCount)
679+ // The frame's delay interval is roughly [~16ms, ~1000ms].
680+ // Query from 500ms so the range clips the delay interval in half.
681+ val queryStart = TimeUnit .MILLISECONDS .toNanos(500 )
682+ val queryEnd = TimeUnit .SECONDS .toNanos(5 )
683+
684+ val fullResult = collector.getFramesDelay(0 , queryEnd)
685+ val partialResult = collector.getFramesDelay(queryStart, queryEnd)
686+
687+ // partial overlap should yield less delay than the full range
688+ assertTrue(partialResult.delaySeconds > 0 )
689+ assertTrue(partialResult.delaySeconds < fullResult.delaySeconds)
690+ assertEquals(1 , partialResult.framesContributingToDelayCount)
685691 }
686692
687693 @Test
You can’t perform that action at this time.
0 commit comments