summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Melody Hsu <melodymhsu@google.com> 2024-04-22 17:53:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-04-22 17:53:29 +0000
commit7b5d292d75312e856c3900c404bcf71619ebded6 (patch)
tree160038d5977d554119d248f899c428251e1dbccc
parentf4422cd245791986298e370dbfcab30216b68d2d (diff)
parent310e04ccf47c176c7c1541ae11697684b51e3cf3 (diff)
Merge "Inject legacy layer in metadata tests" into main
-rw-r--r--services/surfaceflinger/tests/unittests/CommitTest.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/services/surfaceflinger/tests/unittests/CommitTest.cpp b/services/surfaceflinger/tests/unittests/CommitTest.cpp
index 80c166441a..7f29418252 100644
--- a/services/surfaceflinger/tests/unittests/CommitTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CommitTest.cpp
@@ -94,13 +94,15 @@ TEST_F(CommitTest, metadataNotIncluded) {
// Create a parent layer with metadata and a child layer without. Metadata should not
// be included in the child layer when the flag is not set.
std::unordered_map<uint32_t, std::vector<uint8_t>> metadata = {{1, {'a', 'b'}}};
- auto parent = std::make_unique<frontend::RequestedLayerState>(
- createArgs(1, LayerMetadata(metadata), UNASSIGNED_LAYER_ID));
+ auto parentArgs = createArgs(1, LayerMetadata(metadata), UNASSIGNED_LAYER_ID);
+ auto parent = std::make_unique<frontend::RequestedLayerState>(parentArgs);
mFlinger.addLayer(parent);
+ mFlinger.injectLegacyLayer(sp<Layer>::make(parentArgs));
- auto child =
- std::make_unique<frontend::RequestedLayerState>(createArgs(11, LayerMetadata(), 1));
+ auto childArgs = createArgs(11, LayerMetadata(), 1);
+ auto child = std::make_unique<frontend::RequestedLayerState>(childArgs);
mFlinger.addLayer(child);
+ mFlinger.injectLegacyLayer(sp<Layer>::make(childArgs));
bool unused;
bool mustComposite = mFlinger.updateLayerSnapshots(VsyncId{1}, /*frameTimeNs=*/0,
@@ -136,13 +138,15 @@ TEST_F(CommitTest, metadataIsIncluded) {
// Create a parent layer with metadata and a child layer without. Metadata from the
// parent should be included in the child layer when the flag is set.
std::unordered_map<uint32_t, std::vector<uint8_t>> metadata = {{1, {'a', 'b'}}};
- auto parent = std::make_unique<frontend::RequestedLayerState>(
- createArgs(1, LayerMetadata(metadata), UNASSIGNED_LAYER_ID));
+ auto parentArgs = createArgs(1, LayerMetadata(metadata), UNASSIGNED_LAYER_ID);
+ auto parent = std::make_unique<frontend::RequestedLayerState>(parentArgs);
mFlinger.addLayer(parent);
+ mFlinger.injectLegacyLayer(sp<Layer>::make(parentArgs));
- auto child =
- std::make_unique<frontend::RequestedLayerState>(createArgs(11, LayerMetadata(), 1));
+ auto childArgs = createArgs(11, LayerMetadata(), 1);
+ auto child = std::make_unique<frontend::RequestedLayerState>(childArgs);
mFlinger.addLayer(child);
+ mFlinger.injectLegacyLayer(sp<Layer>::make(childArgs));
bool unused;
bool mustComposite = mFlinger.updateLayerSnapshots(VsyncId{1}, /*frameTimeNs=*/0,