From 5f696940c9d9a15092b8b6c1df527bddfab4d509 Mon Sep 17 00:00:00 2001 From: ramindani Date: Thu, 14 Oct 2021 16:24:18 +0000 Subject: [PATCH] Fix the conditions for the tests based on comments on ag/15968818. Check EXPECT_TRUE with status ok and Error none for valid display. and EXPECT_FALSE with status ok. If service exists then we can proceed with test otherwise tests will be skipped. Test: atest VtsHalGraphicsComposer3_TargetTest but tests don't just work yet. as we don't have service implementation. BUG: 202053621 Change-Id: Iff8f4ca1e102ad8333ca63b0722b1fbd26414d06 --- .../VtsHalGraphicsComposer3_TargetTest.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp index d892681585..40dfe06eda 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp @@ -13,17 +13,15 @@ #undef LOG_TAG #define LOG_TAG "VtsHalGraphicsComposer3_TargetTest" -typedef uint64_t DisplayId; - namespace aidl::android::hardware::graphics::composer3::vts { namespace { class VtsDisplay { public: - VtsDisplay(DisplayId displayId, int32_t displayWidth, int32_t displayHeight) + VtsDisplay(uint64_t displayId, int32_t displayWidth, int32_t displayHeight) : mDisplayId(displayId), mDisplayWidth(displayWidth), mDisplayHeight(displayHeight) {} - DisplayId get() const { return mDisplayId; } + uint64_t get() const { return mDisplayId; } void setDimensions(int32_t displayWidth, int32_t displayHeight) { mDisplayWidth = displayWidth; @@ -31,7 +29,7 @@ class VtsDisplay { } private: - const DisplayId mDisplayId; + const uint64_t mDisplayId; int32_t mDisplayWidth; int32_t mDisplayHeight; }; @@ -51,7 +49,7 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam { // returns an invalid display id (one that has not been registered to a // display. Currently assuming that a device will never have close to // std::numeric_limit::max() displays registered while running tests - DisplayId GetInvalidDisplayId() { + uint64_t GetInvalidDisplayId() { uint64_t id = std::numeric_limits::max(); while (id > 0) { if (std::none_of(mDisplays.begin(), mDisplays.end(), @@ -65,8 +63,8 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam { } std::shared_ptr mComposer; - std::shared_ptr mComposerClient{}; - DisplayId mInvalidDisplayId; + std::shared_ptr mComposerClient; + uint64_t mInvalidDisplayId; std::vector mDisplays; // TODO(b/202401906) populate all the displays available for test. }; @@ -74,15 +72,16 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam { TEST_P(GraphicsComposerAidlTest, getDisplayCapabilitiesBadDisplay) { std::vector capabilities; const auto error = mComposerClient->getDisplayCapabilities(mInvalidDisplayId, &capabilities); + + EXPECT_FALSE(error.isOk()); EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError()); } TEST_P(GraphicsComposerAidlTest, getDisplayCapabilities) { for (const auto& display : mDisplays) { std::vector capabilities; - const auto error = mComposerClient->getDisplayCapabilities(display.get(), &capabilities); - EXPECT_NE(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError()); + EXPECT_TRUE(mComposerClient->getDisplayCapabilities(display.get(), &capabilities).isOk()); } }