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

Commit 4833b06f authored by Ningyuan Wang's avatar Ningyuan Wang
Browse files

Add VTS tests for ISupplicantIface

This covers the following APIs by adding tests to both
ISupplicantStaIface and ISupplicantP2pIface:
ISupplicantIface::getName(),
ISupplicantIface::getType()

Bug: 33457575
Test: VTS tests pass

Change-Id: Ibbc4be2e367fc6f179005696724cccbcca58d10f
parent 5ed47334
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIface.h>

#include "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"

using ::android::sp;
@@ -28,6 +29,7 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIfaceCallback;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
@@ -177,6 +179,26 @@ TEST_F(SupplicantP2pIfaceHidlTest, RegisterCallback) {
        });
}

/*
 * GetName
 */
TEST_F(SupplicantP2pIfaceHidlTest, GetName) {
    const auto& status_and_interface_name = HIDL_INVOKE(p2p_iface_, getName);
    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
              status_and_interface_name.first.code);
    EXPECT_FALSE(std::string(status_and_interface_name.second).empty());
}

/*
 * GetType
 */
TEST_F(SupplicantP2pIfaceHidlTest, GetType) {
    const auto& status_and_interface_type = HIDL_INVOKE(p2p_iface_, getType);
    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
              status_and_interface_type.first.code);
    EXPECT_EQ(status_and_interface_type.second, IfaceType::P2P);
}

/*
 * GetDeviceAddress
 */
+22 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>

#include "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"

using ::android::sp;
@@ -28,6 +29,7 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIfaceCallback;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
@@ -162,6 +164,26 @@ TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback) {
        });
}

/*
 * GetName
 */
TEST_F(SupplicantStaIfaceHidlTest, GetName) {
    const auto& status_and_interface_name = HIDL_INVOKE(sta_iface_, getName);
    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
              status_and_interface_name.first.code);
    EXPECT_FALSE(std::string(status_and_interface_name.second).empty());
}

/*
 * GetType
 */
TEST_F(SupplicantStaIfaceHidlTest, GetType) {
    const auto& status_and_interface_type = HIDL_INVOKE(sta_iface_, getType);
    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
              status_and_interface_type.first.code);
    EXPECT_EQ(status_and_interface_type.second, IfaceType::STA);
}

/*
 * listNetworks.
 */