summaryrefslogtreecommitdiff
path: root/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp
diff options
context:
space:
mode:
authorramindani <ramindani@google.com>2022-04-22 22:30:20 +0000
committerRam Indani <ramindani@google.com>2022-04-25 20:44:04 +0000
commitd575109c1e97d00686297de9c2d40efa8ad9fc88 (patch)
treec4c6d236d6de8acffb5259cd4aebc445b61c99cf /graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp
parentcf45b358a50dd2e2efe53e374e7724e117855f86 (diff)
Check Exception Code for Service specific error
Before checking the service specific error we need to check that getExceptionCode returns EX_SERVICE_SPECIFIC error code. Added a method and used that to do the two checks together for exceptionCode and for the service specific error code, so that we don't repeat two lines in all the tests that need them. EXPECT_NO_FATAL_FAILURES print the correct line number of the test or iteration of the test when used with helper functions, and testing guidelines recommend it too here: go/gunitadvanced#propagating-fatal-failures Test: atest VtsHalGraphicsComposer3_TargetTest BUG: 205152739 Change-Id: I1d3c3aa9b34dcefb14be507ff61b73b6f08a5204
Diffstat (limited to 'graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp')
-rw-r--r--graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp
index 72ff9babed..46dde09dd4 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp
@@ -109,6 +109,11 @@ class GraphicsCompositionTestBase : public ::testing::Test {
int32_t getDisplayHeight() const { return getPrimaryDisplay().getDisplayHeight(); }
+ void assertServiceSpecificError(const ScopedAStatus& status, int32_t serviceSpecificError) {
+ ASSERT_EQ(status.getExceptionCode(), EX_SERVICE_SPECIFIC);
+ ASSERT_EQ(status.getServiceSpecificError(), serviceSpecificError);
+ }
+
std::pair<bool, ::android::sp<::android::GraphicBuffer>> allocateBuffer(uint32_t usage) {
const auto width = static_cast<uint32_t>(getDisplayWidth());
const auto height = static_cast<uint32_t>(getDisplayHeight());
@@ -222,7 +227,8 @@ class GraphicsCompositionTestBase : public ::testing::Test {
mDataspace = readBackBufferAttributes.dataspace;
return ReadbackHelper::readbackSupported(mPixelFormat, mDataspace);
}
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
+ EXPECT_NO_FATAL_FAILURE(
+ assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED));
return false;
}
@@ -458,7 +464,7 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) {
mComposerClient->setReadbackBuffer(getInvalidDisplayId(), bufferHandle, fence);
EXPECT_FALSE(status.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
+ EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY));
}
TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) {
@@ -475,7 +481,7 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) {
mComposerClient->setReadbackBuffer(getPrimaryDisplayId(), &bufferHandle, releaseFence);
EXPECT_FALSE(status.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
+ EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER));
}
TEST_P(GraphicsCompositionTest, GetReadbackBufferFenceInactive) {
@@ -490,7 +496,7 @@ TEST_P(GraphicsCompositionTest, GetReadbackBufferFenceInactive) {
mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
EXPECT_FALSE(status.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
+ EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED));
EXPECT_EQ(-1, releaseFence.get());
}
@@ -1300,7 +1306,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) {
for (ColorMode mode : mTestColorModes) {
auto status = mComposerClient->setColorMode(getPrimaryDisplayId(), mode,
RenderIntent::COLORIMETRIC);
- if (!status.isOk() &&
+ if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC &&
(status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED ||
status.getServiceSpecificError() == IComposerClient::EX_BAD_PARAMETER)) {
SUCCEED() << "ColorMode not supported, skip test";