SF: Add a first real unit test
Use the newly defined mocks to substitute for the real instances,
allowing a simple direct test of
SurfaceFlinger::processDisplayChangesLocked(), for the case of a display
being added.
[Test execution time 25ms]
Test: libsurfaceflinger_unittest passes on Pixel XL
Bug: None
Change-Id: Icdb763ecc3adb1a8bf04268f3dc5716606e6e7e8
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index abb0fcb..b75dc6a 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -58,6 +58,7 @@
class NativeHandle;
class Region;
class String8;
+class TestableSurfaceFlinger;
namespace Hwc2 {
class Composer;
@@ -170,6 +171,9 @@
std::optional<hwc2_display_t> getHwcDisplayId(int32_t displayId) const;
private:
+ // For unit tests
+ friend TestableSurfaceFlinger;
+
static const int32_t VIRTUAL_DISPLAY_ID_BASE = 2;
bool isValidDisplay(int32_t displayId) const;