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

Commit 4a936e37 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Wifi: omit FILS related vts tests if not supported" into rvc-dev

parents 597758ab 54cae11b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@
#include "supplicant_hidl_test_utils_1_3.h"

using ::android::sp;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicant;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork;
@@ -43,3 +45,15 @@ sp<ISupplicant> getSupplicant_1_3(const std::string& supplicant_instance_name,
    return ISupplicant::castFrom(
        getSupplicant(supplicant_instance_name, isP2pOn));
}

bool isFilsSupported(sp<ISupplicantStaIface> sta_iface) {
    uint32_t keyMgmtMask = 0;
    sta_iface->getKeyMgmtCapabilities_1_3(
        [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            keyMgmtMask = keyMgmtMaskInternal;
        });

    return (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
                           ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384));
}
+3 −0
Original line number Diff line number Diff line
@@ -31,4 +31,7 @@ createSupplicantStaNetwork_1_3(
        supplicant);
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicant>
getSupplicant_1_3(const std::string& supplicant_instance_name, bool isP2pOn);
bool isFilsSupported(
    android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface>
        sta_iface);
#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_3_H */
+13 −32
Original line number Diff line number Diff line
@@ -517,7 +517,10 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
 * FilsHlpAddRequest
 */
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
    uint32_t keyMgmtMask = 0;
    if (!isFilsSupported(sta_iface_)) {
        GTEST_SKIP()
            << "Skipping test since driver/supplicant doesn't support FILS";
    }
    uint8_t destMacAddr[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
    std::vector<uint8_t> pktBuffer = {
        0x08, 0x00, 0x45, 0x10, 0x01, 0x3a, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
@@ -548,22 +551,9 @@ TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
        0x63, 0x70, 0x2d, 0x52, 0x37, 0x0a, 0x01, 0x03, 0x06, 0x0f, 0x1a, 0x1c,
        0x33, 0x3a, 0x3b, 0x2b, 0xff, 0x00};

    sta_iface_->getKeyMgmtCapabilities_1_3(
        [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            keyMgmtMask = keyMgmtMaskInternal;
        });

    SupplicantStatusCode expectedStatusCode =
        (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
                        ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
            ? SupplicantStatusCode::SUCCESS
            : SupplicantStatusCode::FAILURE_UNKNOWN;

    sta_iface_->filsHlpAddRequest(
        destMacAddr, pktBuffer,
        [expectedStatusCode](const SupplicantStatus& status) {
            EXPECT_EQ(expectedStatusCode, status.code);
        destMacAddr, pktBuffer, [](const SupplicantStatus& status) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
        });
}

@@ -571,22 +561,13 @@ TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
 * FilsHlpFlushRequest
 */
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpFlushRequest) {
    uint32_t keyMgmtMask = 0;
    sta_iface_->getKeyMgmtCapabilities_1_3(
        [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            keyMgmtMask = keyMgmtMaskInternal;
        });

    SupplicantStatusCode expectedStatusCode =
        (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
                        ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
            ? SupplicantStatusCode::SUCCESS
            : SupplicantStatusCode::FAILURE_UNKNOWN;
    if (!isFilsSupported(sta_iface_)) {
        GTEST_SKIP()
            << "Skipping test since driver/supplicant doesn't support FILS";
    }

    sta_iface_->filsHlpFlushRequest(
        [expectedStatusCode](const SupplicantStatus& status) {
            EXPECT_EQ(expectedStatusCode, status.code);
    sta_iface_->filsHlpFlushRequest([](const SupplicantStatus& status) {
        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    });
}
INSTANTIATE_TEST_CASE_P(
+7 −16
Original line number Diff line number Diff line
@@ -290,22 +290,13 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetWapiCertSuite) {
 * SetEapErp
 */
TEST_P(SupplicantStaNetworkHidlTest, SetEapErp) {
    uint32_t keyMgmtMask = 0;
    sta_iface_->getKeyMgmtCapabilities_1_3(
        [&](const SupplicantStatus &status, uint32_t keyMgmtMaskInternal) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            keyMgmtMask = keyMgmtMaskInternal;
        });

    SupplicantStatusCode expectedStatusCode =
        (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
                        ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
            ? SupplicantStatusCode::SUCCESS
            : SupplicantStatusCode::FAILURE_UNKNOWN;
    if (!isFilsSupported(sta_iface_)) {
        GTEST_SKIP()
            << "Skipping test since driver/supplicant doesn't support FILS";
    }

    sta_network_->setEapErp(
        true, [expectedStatusCode](const SupplicantStatus &status) {
            EXPECT_EQ(expectedStatusCode, status.code);
    sta_network_->setEapErp(true, [](const SupplicantStatus &status) {
        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    });
}
INSTANTIATE_TEST_CASE_P(