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

Commit c39728b4 authored by Gabriel Biren's avatar Gabriel Biren
Browse files

Add VTS tests for the untested legacy

P2P iface methods.

All of these methods have existed since V1 of
the Supplicant AIDL interface.

Bug: 386810503
Test: atest VtsHalWifiSupplicantP2pIfaceTargetTest
Change-Id: I4df7c4ec203ccb9c9a919e1ec3bee7476b2042bd
parent eeba2df5
Loading
Loading
Loading
Loading
+56 −2
Original line number Diff line number Diff line
@@ -399,8 +399,8 @@ TEST_P(SupplicantP2pIfaceAidlTest, SetWpsModelName) {
 * SetWpsModelNumber
 */
TEST_P(SupplicantP2pIfaceAidlTest, SetWpsModelNumber) {
    const std::string modelNumber = "TestModelNumber";
    EXPECT_TRUE(p2p_iface_->setWpsModelName(modelNumber).isOk());
    const std::string modelNumber = "Model1234";
    EXPECT_TRUE(p2p_iface_->setWpsModelNumber(modelNumber).isOk());
}

/*
@@ -1000,6 +1000,60 @@ TEST_P(SupplicantP2pIfaceAidlTest, ManageNetworks) {
    EXPECT_TRUE(p2p_iface_->removeNetwork(networkId).isOk());
}

/*
 * Request and cancel service discovery
 */
TEST_P(SupplicantP2pIfaceAidlTest, RequestAndCancelServiceDiscovery) {
    int64_t discoveryId;
    std::vector<uint8_t> query = {0x11, 0x22, 0x33};
    EXPECT_TRUE(p2p_iface_->requestServiceDiscovery(kTestMacAddr, query, &discoveryId).isOk());
    EXPECT_TRUE(p2p_iface_->cancelServiceDiscovery(discoveryId).isOk());
}

/*
 * Start and stop WPS
 */
TEST_P(SupplicantP2pIfaceAidlTest, StartAndStopWps) {
    // Expected to fail with test values
    std::string generatedPin;
    EXPECT_FALSE(p2p_iface_->startWpsPbc(kTestGroupIfName, kTestMacAddr).isOk());
    EXPECT_FALSE(
            p2p_iface_->startWpsPinDisplay(kTestGroupIfName, kTestMacAddr, &generatedPin).isOk());
    EXPECT_FALSE(p2p_iface_->startWpsPinKeypad(kTestGroupIfName, kTestConnectPin).isOk());
    EXPECT_FALSE(p2p_iface_->cancelWps(kTestGroupIfName).isOk());
}

/*
 * Create message and report handover for NFC Request
 */
TEST_P(SupplicantP2pIfaceAidlTest, CreateAndReportNfcRequest) {
    std::vector<uint8_t> requestMsg;
    EXPECT_TRUE(p2p_iface_->createNfcHandoverRequestMessage(&requestMsg).isOk());
    EXPECT_FALSE(requestMsg.empty());
    EXPECT_TRUE(p2p_iface_->reportNfcHandoverResponse(requestMsg).isOk());
}

/*
 * Create message and report handover for NFC Select
 */
TEST_P(SupplicantP2pIfaceAidlTest, CreateAndReportNfcSelect) {
    std::vector<uint8_t> selectMsg;
    EXPECT_TRUE(p2p_iface_->createNfcHandoverSelectMessage(&selectMsg).isOk());
    EXPECT_FALSE(selectMsg.empty());
    EXPECT_TRUE(p2p_iface_->reportNfcHandoverInitiation(selectMsg).isOk());
}

/*
 * RemoveClient
 */
TEST_P(SupplicantP2pIfaceAidlTest, RemoveClient) {
    // Method returns success for any valid MAC address
    EXPECT_TRUE(p2p_iface_->removeClient(kTestMacAddr, false).isOk());
    // Returns failure for any invalid MAC address
    std::vector<uint8_t> invalidMacAddr = {0x11, 0x22};
    EXPECT_FALSE(p2p_iface_->removeClient(invalidMacAddr, false).isOk());
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantP2pIfaceAidlTest);
INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantP2pIfaceAidlTest,
                         testing::ValuesIn(android::getAidlHalInstanceNames(