From 392d530a649b709187fe8bf53512ef234051662f Mon Sep 17 00:00:00 2001 From: Haotien Hsu Date: Mon, 8 May 2023 18:46:14 +0800 Subject: [PATCH] Test: Don't check results when no type-c ports For those devices without type-c ports, the queryPortStatus test is always failed.Because there are no PortStatus for the callbacks. Adding an additional condition branch to skip the results checking when there are no PortStatus. Bug: 281643316 (https://partnerissuetracker.corp.google.com/issues/281643316) Change-Id: Ibf599038b542d5d81a2af9ab2097f2f868be0447 Signed-off-by: Haotien Hsu --- usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp index 19830a6b8a..0883de2349 100644 --- a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp +++ b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp @@ -95,6 +95,7 @@ class UsbCallback : public ::testing::VtsHalHidlTargetCallbackBaseWaitForCallback(kCallbackNameNotifyPortStatusChange_1_1); EXPECT_TRUE(res.no_timeout); EXPECT_EQ(2, res.args->last_usb_cookie); - EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status.currentMode); - EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status.supportedModes); - EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status); + // if there are no type-c ports, skip below checks + if (!res.args->usb_last_port_status.status.portName.empty()) { + EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status.currentMode); + EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status.supportedModes); + EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status); + } } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UsbHidlTest); INSTANTIATE_TEST_SUITE_P(