Skip to content

Commit 6559d52

Browse files
committed
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. Bug: 323232586 Test: libsurfaceflinger_unittest Change-Id: Ica7a921b5bf01b8eadac78900ac69f854f8a02de
1 parent 05e3113 commit 6559d52

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
#undef LOG_TAG
1818
#define LOG_TAG "LibSurfaceFlingerUnittests"
1919

20+
#include <com_android_graphics_surfaceflinger_flags.h>
21+
#include <common/test/FlagUtils.h>
2022
#include "DualDisplayTransactionTest.h"
2123

2224
#include <gmock/gmock.h>
2325
#include <gtest/gtest.h>
2426

27+
using namespace com::android::graphics::surfaceflinger;
28+
2529
namespace android {
2630
namespace {
2731

@@ -163,6 +167,7 @@ TEST_F(FoldableTest, requestsHardwareVsyncForBothDisplays) {
163167
}
164168

165169
TEST_F(FoldableTest, requestVsyncOnPowerOn) {
170+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
166171
EXPECT_CALL(mFlinger.scheduler()->mockRequestHardwareVsync, Call(kInnerDisplayId, true))
167172
.Times(1);
168173
EXPECT_CALL(mFlinger.scheduler()->mockRequestHardwareVsync, Call(kOuterDisplayId, true))
@@ -173,6 +178,7 @@ TEST_F(FoldableTest, requestVsyncOnPowerOn) {
173178
}
174179

175180
TEST_F(FoldableTest, disableVsyncOnPowerOffPacesetter) {
181+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
176182
// When the device boots, the inner display should be the pacesetter.
177183
ASSERT_EQ(mFlinger.scheduler()->pacesetterDisplayId(), kInnerDisplayId);
178184

services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPowerModeInternalTest.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
#undef LOG_TAG
1818
#define LOG_TAG "LibSurfaceFlingerUnittests"
1919

20+
#include <com_android_graphics_surfaceflinger_flags.h>
21+
#include <common/test/FlagUtils.h>
2022
#include "DisplayTransactionTestHelpers.h"
2123

2224
#include <gmock/gmock.h>
2325
#include <gtest/gtest.h>
2426

27+
using namespace com::android::graphics::surfaceflinger;
28+
2529
namespace android {
2630
namespace {
2731

@@ -453,6 +457,7 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToUnknownPrimaryDisplay
453457
}
454458

455459
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToOnExternalDisplay) {
460+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
456461
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToOnVariant>>();
457462
}
458463

@@ -461,6 +466,7 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToDozeSuspendExternalD
461466
}
462467

463468
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToOffExternalDisplay) {
469+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
464470
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToOffVariant>>();
465471
}
466472

@@ -473,6 +479,7 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeExternalDisplay)
473479
}
474480

475481
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToDozeExternalDisplay) {
482+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
476483
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToDozeVariant>>();
477484
}
478485

@@ -481,10 +488,12 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeToOnExternalDisplay)
481488
}
482489

483490
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToOnExternalDisplay) {
491+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
484492
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToOnVariant>>();
485493
}
486494

487495
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeSuspendExternalDisplay) {
496+
SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
488497
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToDozeSuspendVariant>>();
489498
}
490499

0 commit comments

Comments
 (0)