From c1b5b52c70e0a2bb31b85b31b302bf3fa9091693 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Thu, 5 Mar 2020 10:07:47 -0800 Subject: [PATCH] gralloc4-vts: fix GetLargeReservedRegion test The existing test never assigns a handle to bufferHandle so mGralloc->getReservedRegion() will always be called with nullptr and will always return with BAD_BUFFER. Bug: b/146515640 Test: VtsHalGraphicsMapperV4_0Target Change-Id: I85dac94956c6b9db5b4a19faeb16fc947f7457e1 --- .../functional/VtsHalGraphicsMapperV4_0TargetTest.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 6cc5e34326..a783eaa7a4 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -2124,8 +2124,14 @@ TEST_P(GraphicsMapperHidlTest, GetLargeReservedRegion) { Error err; mGralloc->getAllocator()->allocate( - descriptor, 1, - [&](const auto& tmpError, const auto&, const auto&) { err = tmpError; }); + descriptor, 1, [&](const auto& tmpError, const auto&, const auto& tmpBuffers) { + err = tmpError; + if (err == Error::NONE) { + ASSERT_EQ(1, tmpBuffers.size()); + ASSERT_NO_FATAL_FAILURE(bufferHandle = + mGralloc->importBuffer(tmpBuffers[0])); + } + }); if (err == Error::UNSUPPORTED) { continue; }