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

Commit 60640c06 authored by Gabriel Biren's avatar Gabriel Biren Committed by Android (Google) Code Review
Browse files

Merge "Add VTS tests for all new Supplicant APIs that contain vendor data." into main

parents 711a1acb 57e748c9
Loading
Loading
Loading
Loading
+37 −3
Original line number Diff line number Diff line
@@ -36,8 +36,10 @@ using aidl::android::hardware::wifi::supplicant::ISupplicant;
using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface;
using aidl::android::hardware::wifi::supplicant::MiracastMode;
using aidl::android::hardware::wifi::supplicant::P2pConnectInfo;
using aidl::android::hardware::wifi::supplicant::P2pCreateGroupOwnerInfo;
using aidl::android::hardware::wifi::supplicant::P2pDeviceFoundEventParams;
using aidl::android::hardware::wifi::supplicant::P2pDiscoveryInfo;
using aidl::android::hardware::wifi::supplicant::P2pExtListenInfo;
using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask;
using aidl::android::hardware::wifi::supplicant::P2pGoNegotiationReqEventParams;
using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask;
@@ -72,7 +74,7 @@ const uint32_t kTestNetworkId = 7;
const uint32_t kTestGroupFreq = 0;
const bool kTestGroupPersistent = false;
const bool kTestGroupIsJoin = false;
const auto& kTestVendorData = generateOuiKeyedDataList(5);
const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);

}  // namespace

@@ -534,6 +536,22 @@ TEST_P(SupplicantP2pIfaceAidlTest, AddGroupWithConfig_FailureInvalidFrequency) {
                     .isOk());
}

/*
 * CreateGroupOwner
 */
TEST_P(SupplicantP2pIfaceAidlTest, CreateGroupOwner) {
    if (interface_version_ < 3) {
        GTEST_SKIP() << "createGroupOwner is available as of Supplicant V3";
    }

    P2pCreateGroupOwnerInfo info;
    info.persistent = false;
    info.persistentNetworkId = kTestNetworkId;
    info.vendorData = kTestVendorDataOptional;

    EXPECT_TRUE(p2p_iface_->createGroupOwner(info).isOk());
}

/*
 * Find
 */
@@ -565,7 +583,7 @@ TEST_P(SupplicantP2pIfaceAidlTest, FindWithParams) {

    P2pDiscoveryInfo discoveryParams;
    discoveryParams.timeoutInSec = kTestFindTimeout;
    discoveryParams.vendorData = kTestVendorData;
    discoveryParams.vendorData = kTestVendorDataOptional;

    discoveryParams.scanType = P2pScanType::FULL;
    EXPECT_TRUE(p2p_iface_->findWithParams(discoveryParams).isOk());
@@ -624,7 +642,7 @@ TEST_P(SupplicantP2pIfaceAidlTest, ConnectWithParams) {
    connectInfo.joinExistingGroup = true;
    connectInfo.persistent = false;
    connectInfo.goIntent = kTestConnectGoIntent;
    connectInfo.vendorData = kTestVendorData;
    connectInfo.vendorData = kTestVendorDataOptional;

    std::string pin;
    EXPECT_TRUE(p2p_iface_->connectWithParams(connectInfo, &pin).isOk());
@@ -689,6 +707,22 @@ TEST_P(SupplicantP2pIfaceAidlTest, ConfigureExtListen) {
            .isOk());
}

/*
 * ConfigureExtListenWithParams
 */
TEST_P(SupplicantP2pIfaceAidlTest, ConfigureExtListenWithParams) {
    if (interface_version_ < 3) {
        GTEST_SKIP() << "configureExtListenWithParams is available as of Supplicant V3";
    }

    P2pExtListenInfo info;
    info.periodMs = 400;
    info.intervalMs = 400;
    info.vendorData = kTestVendorDataOptional;

    EXPECT_TRUE(p2p_iface_->configureExtListenWithParams(info).isOk());
}

/*
 * FlushServices
 */
+11 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ const std::string kTestEapMatch = "match";
const KeyMgmtMask kTestKeyMgmt =
    static_cast<KeyMgmtMask>(static_cast<uint32_t>(KeyMgmtMask::WPA_PSK) |
                             static_cast<uint32_t>(KeyMgmtMask::WPA_EAP));
const auto& kTestVendorData = generateOuiKeyedDataList(5);

}  // namespace

@@ -834,6 +835,16 @@ TEST_P(SupplicantStaNetworkAidlTest, DisableEht) {
    EXPECT_TRUE(sta_network_->disableEht().isOk());
}

/*
 * SetVendorData
 */
TEST_P(SupplicantStaNetworkAidlTest, SetVendorData) {
    if (interface_version_ < 3) {
        GTEST_SKIP() << "setVendorData is available as of Supplicant V3";
    }
    EXPECT_TRUE(sta_network_->setVendorData(kTestVendorData).isOk());
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkAidlTest);
INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantStaNetworkAidlTest,
                         testing::ValuesIn(android::getAidlHalInstanceNames(
+18 −4
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ std::array<uint8_t, 6> vecToArrayMacAddr(std::vector<uint8_t> vectorAddr) {
    return arrayAddr;
}

std::optional<OuiKeyedData> generateOuiKeyedData(int oui) {
OuiKeyedData generateOuiKeyedData(int oui) {
    PersistableBundle bundle;
    bundle.putString("stringKey", "stringValue");
    bundle.putInt("intKey", 12345);
@@ -110,13 +110,27 @@ std::optional<OuiKeyedData> generateOuiKeyedData(int oui) {
    OuiKeyedData data;
    data.oui = oui;
    data.vendorData = bundle;
    return std::optional<OuiKeyedData>{data};
    return data;
}

std::optional<std::vector<std::optional<OuiKeyedData>>> generateOuiKeyedDataList(int size) {
    std::vector<std::optional<OuiKeyedData>> dataList;
std::vector<OuiKeyedData> generateOuiKeyedDataList(int size) {
    std::vector<OuiKeyedData> dataList;
    for (int i = 0; i < size; i++) {
        dataList.push_back(generateOuiKeyedData(i + 1));
    }
    return dataList;
}

// Wraps generateOuiKeyedData result in std::optional
std::optional<OuiKeyedData> generateOuiKeyedDataOptional(int oui) {
    return std::optional<OuiKeyedData>{generateOuiKeyedData(oui)};
}

// Generate OuiKeyedData list fully wrapped in std::optional
std::optional<std::vector<std::optional<OuiKeyedData>>> generateOuiKeyedDataListOptional(int size) {
    std::vector<std::optional<OuiKeyedData>> dataList;
    for (int i = 0; i < size; i++) {
        dataList.push_back(generateOuiKeyedDataOptional(i + 1));
    }
    return std::optional<std::vector<std::optional<OuiKeyedData>>>{dataList};
}