From b283ec3897f2f479ecb9dcec4628d77faa95d676 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 1 Feb 2024 13:01:09 -0500 Subject: RESTRICT AUTOMERGE: Update tests to treat multithreaded_present as true These tests were written or updated as if the multithreaded_present flag is true, but may run on devices where it is not. Explicitly set the flag to true so the tests always pass. Conflicts: - services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp Bug: 323232586 Test: libsurfaceflinger_unittest Change-Id: Ica7a921b5bf01b8eadac78900ac69f854f8a02de Merged-In: Ica7a921b5bf01b8eadac78900ac69f854f8a02de --- .../tests/unittests/SurfaceFlinger_FoldableTest.cpp | 6 ++++++ .../tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp index 844b96c5cc..41d8f9e4e0 100644 --- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp +++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp @@ -18,10 +18,14 @@ #define LOG_TAG "LibSurfaceFlingerUnittests" #include "DisplayTransactionTestHelpers.h" +#include +#include #include #include +using namespace com::android::graphics::surfaceflinger; + namespace android { namespace { @@ -189,6 +193,7 @@ TEST_F(FoldableTest, requestsHardwareVsyncForBothDisplays) { } TEST_F(FoldableTest, requestVsyncOnPowerOn) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); EXPECT_CALL(mFlinger.scheduler()->mockRequestHardwareVsync, Call(kInnerDisplayId, true)) .Times(1); EXPECT_CALL(mFlinger.scheduler()->mockRequestHardwareVsync, Call(kOuterDisplayId, true)) @@ -199,6 +204,7 @@ TEST_F(FoldableTest, requestVsyncOnPowerOn) { } TEST_F(FoldableTest, disableVsyncOnPowerOffPacesetter) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); // When the device boots, the inner display should be the pacesetter. ASSERT_EQ(mFlinger.scheduler()->pacesetterDisplayId(), kInnerDisplayId); diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp index 15fe6008a5..83e2f980ce 100644 --- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp +++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp @@ -17,11 +17,15 @@ #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" +#include +#include #include "DisplayTransactionTestHelpers.h" #include #include +using namespace com::android::graphics::surfaceflinger; + namespace android { namespace { @@ -453,6 +457,7 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToUnknownPrimaryDisplay } TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToOnExternalDisplay) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); transitionDisplayCommon>(); } @@ -461,6 +466,7 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToDozeSuspendExternalD } TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToOffExternalDisplay) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); transitionDisplayCommon>(); } @@ -473,6 +479,7 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeExternalDisplay) } TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToDozeExternalDisplay) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); transitionDisplayCommon>(); } @@ -481,10 +488,12 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeToOnExternalDisplay) } TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToOnExternalDisplay) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); transitionDisplayCommon>(); } TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeSuspendExternalDisplay) { + SET_FLAG_FOR_TEST(flags::multithreaded_present, true); transitionDisplayCommon>(); } -- cgit v1.2.3-59-g8ed1b