SF: Deduplicate mock scheduler setup in tests
Extract TestableSurfaceFlinger::setupMockScheduler, and add an option to
customize the PhysicalDisplayId of the injected RefreshRateSelector (and
its display modes), so that tests can later inject a DisplayDevice with
a matching ID. Remove the DisplayModesVariant with two display modes, as
the few tests that used it are unrelated to scheduling and will later be
decoupled entirely.
Bug: 259436835
Bug: 241285191
Test: libsurfaceflinger_unittest
Change-Id: Ie58b6947201a1911342e7bcd5ea64dd8702aaa57
Merged-In: Ie58b6947201a1911342e7bcd5ea64dd8702aaa57
(cherry picked from commit fb281c53240c3e2420a20cf0ea071198e963ed3d)
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h b/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
index 223f4db..66aa204 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
@@ -85,7 +85,7 @@
// --------------------------------------------------------------------
// Mock/Fake injection
- void injectMockScheduler();
+ void injectMockScheduler(PhysicalDisplayId);
void injectMockComposer(int virtualDisplayCount);
void injectFakeBufferQueueFactory();
void injectFakeNativeWindowSurfaceFactory();
@@ -139,7 +139,7 @@
surfaceflinger::mock::NativeWindowSurface* mNativeWindowSurface = nullptr;
protected:
- DisplayTransactionTest();
+ DisplayTransactionTest(bool withMockScheduler = true);
};
constexpr int32_t DEFAULT_VSYNC_PERIOD = 16'666'667;