Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc963e64 authored by Eva Chen's avatar Eva Chen Committed by Android (Google) Code Review
Browse files

Merge "Update VtsHalAutomotiveVehicleTargetTest::verifyProperty to only run on...

Merge "Update VtsHalAutomotiveVehicleTargetTest::verifyProperty to only run on implemented properties."
parents 16fed020 17bc5781
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -438,13 +438,30 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId,
    int expectedArea = toInt(area);
    int expectedPropertyType = toInt(propertyType);

    auto result = mVhalClient->getPropConfigs({expectedPropId});
    ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
    auto result = mVhalClient->getAllPropConfigs();
    ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: "
                             << result.error().message();

    if (result.value().size() == 0) {
        GTEST_SKIP() << "Property has not been implemented";
    // Check if property is implemented by getting all configs and looking to see if the expected
    // property id is in that list.
    bool isExpectedPropIdImplemented = false;
    for (const auto& cfgPtr : result.value()) {
        const IHalPropConfig& cfg = *cfgPtr;
        if (expectedPropId == cfg.getPropId()) {
            isExpectedPropIdImplemented = true;
            break;
        }
    }

    if (!isExpectedPropIdImplemented) {
        GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented",
                                     expectedPropId);
    }

    result = mVhalClient->getPropConfigs({expectedPropId});
    ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
                             << result.error().message();

    ASSERT_EQ(result.value().size(), 1u)
            << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size());