SF: Fix edge case in SchedulerTest related to pacesetter_selection
With the pacesetter_selection enabled, Scheduler calls ISchedulerCallback::enableLayerCachingTexturePool(pacesetter, false) on every demotePacesetterDisplay(). The scheduler's destructor makes a demote call. SchedulerTest#enablesLayerCachingTexturePoolForPacesetter test enables the pacesetter_selection flag at the start, and at the end of the test the flag resets to the default value. When the flag is not enabled by default, the call to enableLayerCachingTexturePool() by the Scheduler’s destructor won’t happen. However, when it is enabled by default, the call is made. The test case sets up EXPECT_CALL for enableLayerCachingTexturePool(). One quirk of gmock is that if you mock a function, then you must mock all calls being made to it, else the test fails. To avoid the Scheduler’s destructor making an unexpected enableLayerCachingTexturePool() call and failing the test when the flag is default-enabled, we flush the mock’s expectations with VerifyAndClearExpectations() call at the end of the test. This CL also removes a redundant pacesetter_selection flag setup. Flag: EXEMPT test fix Bug: 389983418 Test: atest libsurfaceflinger_unittests with and without the flag Change-Id: Ic0b671089e44fd337efbac3a03c9440defd561a4
Loading
Please register or sign in to comment