diff options
Diffstat (limited to 'services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp')
-rw-r--r-- | services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp b/services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp index 4eb90558ab..30a3f9a4a7 100644 --- a/services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp +++ b/services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp @@ -349,6 +349,23 @@ TEST_F(VSyncReactorTest, addResyncSamplePeriodChanges) { } } +TEST_F(VSyncReactorTest, addHwVsyncTimestampDozePreempt) { + bool periodFlushed = false; + nsecs_t const newPeriod = 4000; + + mReactor.startPeriodTransition(newPeriod); + + auto time = 0; + // If the power mode is not DOZE or DOZE_SUSPEND, it is still collecting timestamps. + EXPECT_TRUE(mReactor.addHwVsyncTimestamp(time, std::nullopt, &periodFlushed)); + EXPECT_FALSE(periodFlushed); + + // Set power mode to DOZE to trigger period flushing. + mReactor.setDisplayPowerMode(hal::PowerMode::DOZE); + EXPECT_FALSE(mReactor.addHwVsyncTimestamp(time, std::nullopt, &periodFlushed)); + EXPECT_TRUE(periodFlushed); +} + TEST_F(VSyncReactorTest, addPresentFenceWhileAwaitingPeriodConfirmationRequestsHwVsync) { auto time = 0; bool periodFlushed = false; |