mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Convert VtsHalWifiSupplicantV1_0TargetTest to be parameterized test"
am: b2193ac0d0
Change-Id: Ica5c5a5c5ba054c1d00ffce4e72e98a235090477
This commit is contained in:
@@ -51,7 +51,7 @@ cc_test {
|
||||
"libwifi-system",
|
||||
"libwifi-system-iface",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
@@ -71,4 +71,5 @@ cc_test {
|
||||
"libwifi-system",
|
||||
"libwifi-system-iface",
|
||||
],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -14,40 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "supplicant_hidl_test_utils.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
class WifiSupplicantHidlEnvironment_1_0 : public WifiSupplicantHidlEnvironment {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static WifiSupplicantHidlEnvironment_1_0* Instance() {
|
||||
static WifiSupplicantHidlEnvironment_1_0* instance =
|
||||
new WifiSupplicantHidlEnvironment_1_0;
|
||||
return instance;
|
||||
}
|
||||
virtual void registerTestServices() override {
|
||||
registerTestService<::android::hardware::wifi::V1_0::IWifi>();
|
||||
registerTestService<
|
||||
::android::hardware::wifi::supplicant::V1_0::ISupplicant>();
|
||||
}
|
||||
|
||||
private:
|
||||
WifiSupplicantHidlEnvironment_1_0() {}
|
||||
};
|
||||
|
||||
WifiSupplicantHidlEnvironment* gEnv =
|
||||
WifiSupplicantHidlEnvironment_1_0::Instance();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = gEnv->initFromOptions(argc, argv);
|
||||
if (status == 0) {
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
|
||||
// updated.
|
||||
WifiSupplicantHidlEnvironment* gEnv = nullptr;
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
namespace {
|
||||
namespace detail {
|
||||
template <typename>
|
||||
|
||||
@@ -16,35 +16,47 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include <VtsCoreUtil.h>
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicant.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "supplicant_hidl_test_utils.h"
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
|
||||
extern WifiSupplicantHidlEnvironment* gEnv;
|
||||
|
||||
class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class SupplicantHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
supplicant_ = getSupplicant();
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
ASSERT_NE(supplicant_.get(), nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopSupplicant(); }
|
||||
virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
|
||||
|
||||
protected:
|
||||
// ISupplicant object used for all tests in this fixture.
|
||||
sp<ISupplicant> supplicant_;
|
||||
bool isP2pOn_ = false;
|
||||
std::string wifi_instance_name_;
|
||||
std::string supplicant_instance_name_;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -52,16 +64,19 @@ class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the ISupplicant proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(SupplicantHidlTestNoFixture, Create) {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_NE(nullptr, getSupplicant().get());
|
||||
stopSupplicant();
|
||||
TEST_P(SupplicantHidlTest, Create) {
|
||||
// Stop the proxy object created in setup.
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
EXPECT_NE(nullptr,
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_).get());
|
||||
}
|
||||
|
||||
/*
|
||||
* ListInterfaces
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, ListInterfaces) {
|
||||
TEST_P(SupplicantHidlTest, ListInterfaces) {
|
||||
std::vector<ISupplicant::IfaceInfo> ifaces;
|
||||
supplicant_->listInterfaces(
|
||||
[&](const SupplicantStatus& status,
|
||||
@@ -74,7 +89,7 @@ TEST_F(SupplicantHidlTest, ListInterfaces) {
|
||||
std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
|
||||
return iface.type == IfaceType::STA;
|
||||
}));
|
||||
if (gEnv->isP2pOn) {
|
||||
if (isP2pOn_) {
|
||||
EXPECT_NE(
|
||||
ifaces.end(),
|
||||
std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
|
||||
@@ -86,7 +101,7 @@ TEST_F(SupplicantHidlTest, ListInterfaces) {
|
||||
/*
|
||||
* GetInterface
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, GetInterface) {
|
||||
TEST_P(SupplicantHidlTest, GetInterface) {
|
||||
std::vector<ISupplicant::IfaceInfo> ifaces;
|
||||
supplicant_->listInterfaces(
|
||||
[&](const SupplicantStatus& status,
|
||||
@@ -107,7 +122,7 @@ TEST_F(SupplicantHidlTest, GetInterface) {
|
||||
/*
|
||||
* SetDebugParams
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, SetDebugParams) {
|
||||
TEST_P(SupplicantHidlTest, SetDebugParams) {
|
||||
bool show_timestamp = true;
|
||||
bool show_keys = true;
|
||||
ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
|
||||
@@ -124,7 +139,7 @@ TEST_F(SupplicantHidlTest, SetDebugParams) {
|
||||
/*
|
||||
* GetDebugLevel
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, GetDebugLevel) {
|
||||
TEST_P(SupplicantHidlTest, GetDebugLevel) {
|
||||
bool show_timestamp = true;
|
||||
bool show_keys = true;
|
||||
ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
|
||||
@@ -142,7 +157,7 @@ TEST_F(SupplicantHidlTest, GetDebugLevel) {
|
||||
/*
|
||||
* IsDebugShowTimestampEnabled
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, IsDebugShowTimestampEnabled) {
|
||||
TEST_P(SupplicantHidlTest, IsDebugShowTimestampEnabled) {
|
||||
bool show_timestamp = true;
|
||||
bool show_keys = true;
|
||||
ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
|
||||
@@ -160,7 +175,7 @@ TEST_F(SupplicantHidlTest, IsDebugShowTimestampEnabled) {
|
||||
/*
|
||||
* IsDebugShowKeysEnabled
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, IsDebugShowKeysEnabled) {
|
||||
TEST_P(SupplicantHidlTest, IsDebugShowKeysEnabled) {
|
||||
bool show_timestamp = true;
|
||||
bool show_keys = true;
|
||||
ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
|
||||
@@ -178,15 +193,24 @@ TEST_F(SupplicantHidlTest, IsDebugShowKeysEnabled) {
|
||||
/*
|
||||
* SetConcurrenyPriority
|
||||
*/
|
||||
TEST_F(SupplicantHidlTest, SetConcurrencyPriority) {
|
||||
TEST_P(SupplicantHidlTest, SetConcurrencyPriority) {
|
||||
supplicant_->setConcurrencyPriority(
|
||||
IfaceType::STA, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
if (gEnv->isP2pOn) {
|
||||
if (isP2pOn_) {
|
||||
supplicant_->setConcurrencyPriority(
|
||||
IfaceType::P2P, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
PerInstance, SupplicantHidlTest,
|
||||
testing::Combine(
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
ISupplicant::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
@@ -56,8 +56,8 @@ namespace {
|
||||
|
||||
// Helper function to initialize the driver and firmware to STA mode
|
||||
// using the vendor HAL HIDL interface.
|
||||
void initilializeDriverAndFirmware() {
|
||||
sp<IWifiChip> wifi_chip = getWifiChip();
|
||||
void initilializeDriverAndFirmware(const std::string& wifi_instance_name) {
|
||||
sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
|
||||
ChipModeId mode_id;
|
||||
EXPECT_TRUE(configureChipToSupportIfaceType(
|
||||
wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id));
|
||||
@@ -65,7 +65,9 @@ void initilializeDriverAndFirmware() {
|
||||
|
||||
// Helper function to deinitialize the driver and firmware
|
||||
// using the vendor HAL HIDL interface.
|
||||
void deInitilializeDriverAndFirmware() { stopWifi(); }
|
||||
void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) {
|
||||
stopWifi(wifi_instance_name);
|
||||
}
|
||||
|
||||
// Helper function to find any iface of the desired type exposed.
|
||||
bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type,
|
||||
@@ -154,28 +156,38 @@ class ServiceNotificationListener : public IServiceNotification {
|
||||
std::condition_variable condition_;
|
||||
};
|
||||
|
||||
void stopSupplicant() {
|
||||
void stopSupplicant() { stopSupplicant(""); }
|
||||
|
||||
void stopSupplicant(const std::string& wifi_instance_name) {
|
||||
SupplicantManager supplicant_manager;
|
||||
|
||||
ASSERT_TRUE(supplicant_manager.StopSupplicant());
|
||||
deInitilializeDriverAndFirmware();
|
||||
deInitilializeDriverAndFirmware(wifi_instance_name);
|
||||
ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
|
||||
}
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
void startSupplicantAndWaitForHidlService() {
|
||||
initilializeDriverAndFirmware();
|
||||
startSupplicantAndWaitForHidlService("",
|
||||
gEnv->getServiceName<ISupplicant>());
|
||||
}
|
||||
|
||||
void startSupplicantAndWaitForHidlService(
|
||||
const std::string& wifi_instance_name,
|
||||
const std::string& supplicant_instance_name) {
|
||||
initilializeDriverAndFirmware(wifi_instance_name);
|
||||
|
||||
android::sp<ServiceNotificationListener> notification_listener =
|
||||
new ServiceNotificationListener();
|
||||
string service_name = gEnv->getServiceName<ISupplicant>();
|
||||
ASSERT_TRUE(notification_listener->registerForHidlServiceNotifications(
|
||||
service_name));
|
||||
supplicant_instance_name));
|
||||
|
||||
SupplicantManager supplicant_manager;
|
||||
ASSERT_TRUE(supplicant_manager.StartSupplicant());
|
||||
ASSERT_TRUE(supplicant_manager.IsSupplicantRunning());
|
||||
|
||||
ASSERT_TRUE(notification_listener->waitForHidlService(500, service_name));
|
||||
ASSERT_TRUE(notification_listener->waitForHidlService(
|
||||
500, supplicant_instance_name));
|
||||
}
|
||||
|
||||
bool is_1_1(const sp<ISupplicant>& supplicant) {
|
||||
@@ -218,6 +230,7 @@ void addSupplicantP2pIface_1_1(const sp<ISupplicant>& supplicant) {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
sp<ISupplicant> getSupplicant() {
|
||||
sp<ISupplicant> supplicant =
|
||||
::testing::VtsHalHidlTargetTestBase::getService<ISupplicant>(
|
||||
@@ -232,8 +245,28 @@ sp<ISupplicant> getSupplicant() {
|
||||
return supplicant;
|
||||
}
|
||||
|
||||
sp<ISupplicant> getSupplicant(const std::string& supplicant_instance_name,
|
||||
bool isP2pOn) {
|
||||
sp<ISupplicant> supplicant =
|
||||
ISupplicant::getService(supplicant_instance_name);
|
||||
// For 1.1 supplicant, we need to add interfaces at initialization.
|
||||
if (is_1_1(supplicant)) {
|
||||
addSupplicantStaIface_1_1(supplicant);
|
||||
if (isP2pOn) {
|
||||
addSupplicantP2pIface_1_1(supplicant);
|
||||
}
|
||||
}
|
||||
return supplicant;
|
||||
}
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
sp<ISupplicantStaIface> getSupplicantStaIface() {
|
||||
sp<ISupplicant> supplicant = getSupplicant();
|
||||
return getSupplicantStaIface(supplicant);
|
||||
}
|
||||
|
||||
sp<ISupplicantStaIface> getSupplicantStaIface(
|
||||
const sp<ISupplicant>& supplicant) {
|
||||
if (!supplicant.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -257,8 +290,14 @@ sp<ISupplicantStaIface> getSupplicantStaIface() {
|
||||
return sta_iface;
|
||||
}
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
sp<ISupplicantStaNetwork> createSupplicantStaNetwork() {
|
||||
sp<ISupplicantStaIface> sta_iface = getSupplicantStaIface();
|
||||
return createSupplicantStaNetwork(getSupplicant());
|
||||
}
|
||||
|
||||
sp<ISupplicantStaNetwork> createSupplicantStaNetwork(
|
||||
const sp<ISupplicant>& supplicant) {
|
||||
sp<ISupplicantStaIface> sta_iface = getSupplicantStaIface(supplicant);
|
||||
if (!sta_iface.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -278,8 +317,13 @@ sp<ISupplicantStaNetwork> createSupplicantStaNetwork() {
|
||||
return sta_network;
|
||||
}
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
sp<ISupplicantP2pIface> getSupplicantP2pIface() {
|
||||
sp<ISupplicant> supplicant = getSupplicant();
|
||||
return getSupplicantP2pIface(getSupplicant());
|
||||
}
|
||||
|
||||
sp<ISupplicantP2pIface> getSupplicantP2pIface(
|
||||
const sp<ISupplicant>& supplicant) {
|
||||
if (!supplicant.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -303,8 +347,12 @@ sp<ISupplicantP2pIface> getSupplicantP2pIface() {
|
||||
return p2p_iface;
|
||||
}
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
bool turnOnExcessiveLogging() {
|
||||
sp<ISupplicant> supplicant = getSupplicant();
|
||||
return turnOnExcessiveLogging(getSupplicant());
|
||||
}
|
||||
|
||||
bool turnOnExcessiveLogging(const sp<ISupplicant>& supplicant) {
|
||||
if (!supplicant.get()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,21 +25,47 @@
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
// Used to stop the android wifi framework before every test.
|
||||
void stopWifiFramework();
|
||||
void stopWifiFramework(const std::string& wifi_instance_name);
|
||||
void startWifiFramework();
|
||||
void startWifiFramework(const std::string& wifi_instance_name);
|
||||
|
||||
void stopSupplicant();
|
||||
void stopSupplicant(const std::string& wifi_instance_name);
|
||||
// Used to configure the chip, driver and start wpa_supplicant before every
|
||||
// test.
|
||||
void startSupplicantAndWaitForHidlService();
|
||||
void startSupplicantAndWaitForHidlService(
|
||||
const std::string& wifi_instance_name,
|
||||
const std::string& supplicant_instance_name);
|
||||
|
||||
// Helper functions to obtain references to the various HIDL interface objects.
|
||||
// Note: We only have a single instance of each of these objects currently.
|
||||
// These helper functions should be modified to return vectors if we support
|
||||
// multiple instances.
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>
|
||||
getSupplicant(const std::string& supplicant_instance_name, bool isP2pOn);
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface>
|
||||
getSupplicantStaIface(
|
||||
const android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>&
|
||||
supplicant);
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork>
|
||||
createSupplicantStaNetwork(
|
||||
const android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>&
|
||||
supplicant);
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface>
|
||||
getSupplicantP2pIface(
|
||||
const android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>&
|
||||
supplicant);
|
||||
bool turnOnExcessiveLogging(
|
||||
const android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>&
|
||||
supplicant);
|
||||
|
||||
// TODO(b/143892896): Remove old APIs after all supplicant tests are updated.
|
||||
void startSupplicantAndWaitForHidlService();
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>
|
||||
getSupplicant();
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface>
|
||||
getSupplicantStaIface();
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include <VtsCoreUtil.h>
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIface.h>
|
||||
|
||||
#include "supplicant_hidl_call_util.h"
|
||||
@@ -30,11 +33,13 @@ 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::ISupplicant;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIfaceCallback;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
|
||||
namespace {
|
||||
constexpr uint8_t kTestSsidPostfix[] = {'t', 'e', 's', 't'};
|
||||
@@ -66,26 +71,38 @@ constexpr uint32_t kTestExtListenInterval = 400;
|
||||
constexpr SupplicantNetworkId kTestNetworkId = 5;
|
||||
} // namespace
|
||||
|
||||
class SupplicantP2pIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class SupplicantP2pIfaceHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging());
|
||||
p2p_iface_ = getSupplicantP2pIface();
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
p2p_iface_ = getSupplicantP2pIface(supplicant_);
|
||||
ASSERT_NE(p2p_iface_.get(), nullptr);
|
||||
|
||||
memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
|
||||
memcpy(peer_mac_addr_.data(), kTestPeerMacAddr, peer_mac_addr_.size());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopSupplicant(); }
|
||||
virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
|
||||
|
||||
protected:
|
||||
bool isP2pOn_ = false;
|
||||
sp<ISupplicant> supplicant_;
|
||||
// ISupplicantP2pIface object used for all tests in this fixture.
|
||||
sp<ISupplicantP2pIface> p2p_iface_;
|
||||
// MAC address to use for various tests.
|
||||
std::array<uint8_t, 6> mac_addr_;
|
||||
std::array<uint8_t, 6> peer_mac_addr_;
|
||||
std::string wifi_instance_name_;
|
||||
std::string supplicant_instance_name_;
|
||||
};
|
||||
|
||||
class IfaceCallback : public ISupplicantP2pIfaceCallback {
|
||||
@@ -177,16 +194,20 @@ class IfaceCallback : public ISupplicantP2pIfaceCallback {
|
||||
* Ensures that an instance of the ISupplicantP2pIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(SupplicantP2pIfaceHidlTestNoFixture, Create) {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_NE(nullptr, getSupplicantP2pIface().get());
|
||||
stopSupplicant();
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Create) {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
sp<ISupplicantP2pIface> p2p_iface = getSupplicantP2pIface(
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_));
|
||||
|
||||
EXPECT_NE(nullptr, p2p_iface.get());
|
||||
}
|
||||
|
||||
/*
|
||||
* RegisterCallback
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, RegisterCallback) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, RegisterCallback) {
|
||||
p2p_iface_->registerCallback(
|
||||
new IfaceCallback(), [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -196,7 +217,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, RegisterCallback) {
|
||||
/*
|
||||
* GetName
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, GetName) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, GetName) {
|
||||
const auto& status_and_interface_name = HIDL_INVOKE(p2p_iface_, getName);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
status_and_interface_name.first.code);
|
||||
@@ -206,7 +227,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, GetName) {
|
||||
/*
|
||||
* GetType
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, GetType) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, GetType) {
|
||||
const auto& status_and_interface_type = HIDL_INVOKE(p2p_iface_, getType);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
status_and_interface_type.first.code);
|
||||
@@ -216,7 +237,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, GetType) {
|
||||
/*
|
||||
* GetDeviceAddress
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, GetDeviceAddress) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, GetDeviceAddress) {
|
||||
p2p_iface_->getDeviceAddress(
|
||||
[](const SupplicantStatus& status,
|
||||
const hidl_array<uint8_t, 6>& /* mac_addr */) {
|
||||
@@ -227,7 +248,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, GetDeviceAddress) {
|
||||
/*
|
||||
* SetSsidPostfix
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetSsidPostfix) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetSsidPostfix) {
|
||||
std::vector<uint8_t> ssid(kTestSsidPostfix,
|
||||
kTestSsidPostfix + sizeof(kTestSsidPostfix));
|
||||
p2p_iface_->setSsidPostfix(ssid, [](const SupplicantStatus& status) {
|
||||
@@ -238,7 +259,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetSsidPostfix) {
|
||||
/*
|
||||
* Find
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, Find) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Find) {
|
||||
p2p_iface_->find(kTestFindTimeout, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -247,7 +268,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, Find) {
|
||||
/*
|
||||
* StopFind
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, StopFind) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, StopFind) {
|
||||
p2p_iface_->find(kTestFindTimeout, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -260,7 +281,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, StopFind) {
|
||||
/*
|
||||
* Flush
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, Flush) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Flush) {
|
||||
p2p_iface_->flush([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -269,7 +290,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, Flush) {
|
||||
/*
|
||||
* Connect
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, Connect) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Connect) {
|
||||
p2p_iface_->connect(
|
||||
mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
|
||||
kTestConnectPin, false, false, kTestConnectGoIntent,
|
||||
@@ -282,7 +303,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, Connect) {
|
||||
/*
|
||||
* CancelConnect
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, CancelConnect) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, CancelConnect) {
|
||||
p2p_iface_->connect(
|
||||
mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
|
||||
kTestConnectPin, false, false, kTestConnectGoIntent,
|
||||
@@ -299,7 +320,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, CancelConnect) {
|
||||
/*
|
||||
* ProvisionDiscovery
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, ProvisionDiscovery) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, ProvisionDiscovery) {
|
||||
p2p_iface_->provisionDiscovery(
|
||||
mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
|
||||
[](const SupplicantStatus& status) {
|
||||
@@ -311,7 +332,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, ProvisionDiscovery) {
|
||||
/*
|
||||
* AddGroup
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, AddGroup) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, AddGroup) {
|
||||
p2p_iface_->addGroup(false, kTestNetworkId,
|
||||
[](const SupplicantStatus& /* status */) {
|
||||
// TODO: Figure out the initialization sequence for
|
||||
@@ -324,7 +345,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, AddGroup) {
|
||||
/*
|
||||
* RemoveGroup
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, RemoveGroup) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, RemoveGroup) {
|
||||
// This is not going to work with fake values.
|
||||
EXPECT_NE(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, removeGroup, kTestGroupIfName).code);
|
||||
@@ -333,7 +354,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, RemoveGroup) {
|
||||
/*
|
||||
* Reject
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, Reject) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Reject) {
|
||||
p2p_iface_->reject(mac_addr_, [](const SupplicantStatus& status) {
|
||||
// This is not going to work with fake values.
|
||||
EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
|
||||
@@ -343,7 +364,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, Reject) {
|
||||
/*
|
||||
* Invite
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, Invite) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Invite) {
|
||||
p2p_iface_->invite(kTestGroupIfName, mac_addr_, peer_mac_addr_,
|
||||
[](const SupplicantStatus& status) {
|
||||
// This is not going to work with fake values.
|
||||
@@ -355,7 +376,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, Invite) {
|
||||
/*
|
||||
* Reinvoke
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, Reinvoke) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Reinvoke) {
|
||||
p2p_iface_->reinvoke(
|
||||
kTestNetworkId, mac_addr_, [](const SupplicantStatus& status) {
|
||||
// This is not going to work with fake values.
|
||||
@@ -367,7 +388,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, Reinvoke) {
|
||||
/*
|
||||
* ConfigureExtListen
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, ConfigureExtListen) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, ConfigureExtListen) {
|
||||
p2p_iface_->configureExtListen(kTestExtListenPeriod, kTestExtListenInterval,
|
||||
[](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -378,7 +399,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, ConfigureExtListen) {
|
||||
/*
|
||||
* SetListenChannel
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetListenChannel) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetListenChannel) {
|
||||
p2p_iface_->setListenChannel(
|
||||
kTestChannel, kTestOperatingClass, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -388,7 +409,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetListenChannel) {
|
||||
/*
|
||||
* SetDisallowedFrequencies
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetDisallowedFrequencies) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetDisallowedFrequencies) {
|
||||
std::vector<ISupplicantP2pIface::FreqRange> ranges = {
|
||||
{kTestFreqRange[0], kTestFreqRange[1]}};
|
||||
p2p_iface_->setDisallowedFrequencies(
|
||||
@@ -400,7 +421,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetDisallowedFrequencies) {
|
||||
/*
|
||||
* GetSsid
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, GetSsid) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, GetSsid) {
|
||||
std::array<uint8_t, 6> mac_addr;
|
||||
memcpy(mac_addr.data(), kTestMacAddr, mac_addr.size());
|
||||
p2p_iface_->getSsid(mac_addr, [](const SupplicantStatus& status,
|
||||
@@ -413,7 +434,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, GetSsid) {
|
||||
/*
|
||||
* GetGroupCapability
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, GetGroupCapability) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, GetGroupCapability) {
|
||||
std::array<uint8_t, 6> mac_addr;
|
||||
memcpy(mac_addr.data(), kTestMacAddr, mac_addr.size());
|
||||
p2p_iface_->getGroupCapability(
|
||||
@@ -426,7 +447,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, GetGroupCapability) {
|
||||
/*
|
||||
* FlushServices
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, FlushServices) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, FlushServices) {
|
||||
p2p_iface_->flushServices([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -435,7 +456,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, FlushServices) {
|
||||
/*
|
||||
* SetMiracastMode
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetMiracastMode) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetMiracastMode) {
|
||||
p2p_iface_->setMiracastMode(ISupplicantP2pIface::MiracastMode::DISABLED,
|
||||
[](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -456,7 +477,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetMiracastMode) {
|
||||
/*
|
||||
* SetGroupIdle
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetGroupIdle) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetGroupIdle) {
|
||||
// This is not going to work with fake values.
|
||||
EXPECT_NE(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setGroupIdle, kTestGroupIfName,
|
||||
@@ -467,7 +488,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetGroupIdle) {
|
||||
/*
|
||||
* SetPowerSave
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetPowerSave) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetPowerSave) {
|
||||
// This is not going to work with fake values.
|
||||
EXPECT_NE(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
@@ -481,7 +502,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetPowerSave) {
|
||||
/*
|
||||
* SetWpsDeviceName
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsDeviceName) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsDeviceName) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsDeviceName, kTestWpsDeviceName).code);
|
||||
@@ -490,7 +511,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsDeviceName) {
|
||||
/*
|
||||
* SetWpsDeviceType
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsDeviceType) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsDeviceType) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsDeviceType, kTestWpsDeviceType).code);
|
||||
@@ -499,7 +520,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsDeviceType) {
|
||||
/*
|
||||
* SetWpsManufacturer
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsManufacturer) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsManufacturer) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsManufacturer, kTestWpsManufacturer).code);
|
||||
@@ -508,7 +529,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsManufacturer) {
|
||||
/*
|
||||
* SetWpsModelName
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsModelName) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsModelName) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsModelName, kTestWpsModelName).code);
|
||||
}
|
||||
@@ -516,7 +537,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsModelName) {
|
||||
/*
|
||||
* SetWpsModelNumber
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsModelNumber) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsModelNumber) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsModelNumber, kTestWpsModelNumber).code);
|
||||
@@ -525,7 +546,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsModelNumber) {
|
||||
/*
|
||||
* SetWpsSerialNumber
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsSerialNumber) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsSerialNumber) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsSerialNumber, kTestWpsSerialNumber).code);
|
||||
@@ -534,7 +555,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsSerialNumber) {
|
||||
/*
|
||||
* SetWpsConfigMethods
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWpsConfigMethods) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWpsConfigMethods) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWpsConfigMethods, kTestWpsConfigMethods)
|
||||
@@ -548,7 +569,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, SetWpsConfigMethods) {
|
||||
* This also tests that removeBonjourSerive() returns error when there is no
|
||||
* existing bonjour service with the same query data.
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, AddAndRemoveBonjourService) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, AddAndRemoveBonjourService) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(
|
||||
p2p_iface_, addBonjourService,
|
||||
@@ -584,7 +605,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, AddAndRemoveBonjourService) {
|
||||
* This also tests that removeUpnpService() returns error when there is no
|
||||
* exsiting upnp service with the same service name.
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, AddAndRemoveUpnpService) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, AddAndRemoveUpnpService) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, addUpnpService, 0 /* version */,
|
||||
kTestUpnpServiceName)
|
||||
@@ -604,7 +625,7 @@ TEST_F(SupplicantP2pIfaceHidlTest, AddAndRemoveUpnpService) {
|
||||
/*
|
||||
* EnableWfd
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, EnableWfd) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, EnableWfd) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, enableWfd, true).code);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -614,8 +635,17 @@ TEST_F(SupplicantP2pIfaceHidlTest, EnableWfd) {
|
||||
/*
|
||||
* SetWfdDeviceInfo
|
||||
*/
|
||||
TEST_F(SupplicantP2pIfaceHidlTest, SetWfdDeviceInfo) {
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, SetWfdDeviceInfo) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(p2p_iface_, setWfdDeviceInfo, kTestWfdDeviceInfo).code);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
PerInstance, SupplicantP2pIfaceHidlTest,
|
||||
testing::Combine(
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
ISupplicant::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include <VtsCoreUtil.h>
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
|
||||
|
||||
#include "supplicant_hidl_call_util.h"
|
||||
@@ -30,12 +33,14 @@ 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::ISupplicant;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIfaceCallback;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
|
||||
namespace {
|
||||
constexpr uint8_t kTestMacAddr[] = {0x56, 0x67, 0x67, 0xf4, 0x56, 0x92};
|
||||
@@ -61,24 +66,36 @@ constexpr uint8_t kTestWpsDeviceType[] = {[0 ... 7] = 0x01};
|
||||
constexpr uint16_t kTestWpsConfigMethods = 0xffff;
|
||||
} // namespace
|
||||
|
||||
class SupplicantStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class SupplicantStaIfaceHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging());
|
||||
sta_iface_ = getSupplicantStaIface();
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
sta_iface_ = getSupplicantStaIface(supplicant_);
|
||||
ASSERT_NE(sta_iface_.get(), nullptr);
|
||||
|
||||
memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopSupplicant(); }
|
||||
virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
|
||||
|
||||
protected:
|
||||
bool isP2pOn_ = false;
|
||||
sp<ISupplicant> supplicant_;
|
||||
// ISupplicantStaIface object used for all tests in this fixture.
|
||||
sp<ISupplicantStaIface> sta_iface_;
|
||||
// MAC address to use for various tests.
|
||||
std::array<uint8_t, 6> mac_addr_;
|
||||
std::string wifi_instance_name_;
|
||||
std::string supplicant_instance_name_;
|
||||
};
|
||||
|
||||
class IfaceCallback : public ISupplicantStaIfaceCallback {
|
||||
@@ -159,16 +176,19 @@ class IfaceCallback : public ISupplicantStaIfaceCallback {
|
||||
* Ensures that an instance of the ISupplicantStaIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(SupplicantStaIfaceHidlTestNoFixture, Create) {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_NE(nullptr, getSupplicantStaIface().get());
|
||||
stopSupplicant();
|
||||
TEST_P(SupplicantStaIfaceHidlTest, Create) {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
EXPECT_NE(nullptr, getSupplicantStaIface(
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_))
|
||||
.get());
|
||||
}
|
||||
|
||||
/*
|
||||
* RegisterCallback
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback) {
|
||||
sta_iface_->registerCallback(
|
||||
new IfaceCallback(), [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -178,7 +198,7 @@ TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback) {
|
||||
/*
|
||||
* GetName
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, GetName) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, GetName) {
|
||||
const auto& status_and_interface_name = HIDL_INVOKE(sta_iface_, getName);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
status_and_interface_name.first.code);
|
||||
@@ -188,7 +208,7 @@ TEST_F(SupplicantStaIfaceHidlTest, GetName) {
|
||||
/*
|
||||
* GetType
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, GetType) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, GetType) {
|
||||
const auto& status_and_interface_type = HIDL_INVOKE(sta_iface_, getType);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
status_and_interface_type.first.code);
|
||||
@@ -198,14 +218,15 @@ TEST_F(SupplicantStaIfaceHidlTest, GetType) {
|
||||
/*
|
||||
* listNetworks.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, listNetworks) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, listNetworks) {
|
||||
sta_iface_->listNetworks([](const SupplicantStatus& status,
|
||||
const hidl_vec<SupplicantNetworkId>& ids) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
EXPECT_EQ(0u, ids.size());
|
||||
});
|
||||
|
||||
sp<ISupplicantStaNetwork> sta_network = createSupplicantStaNetwork();
|
||||
sp<ISupplicantStaNetwork> sta_network =
|
||||
createSupplicantStaNetwork(supplicant_);
|
||||
EXPECT_NE(nullptr, sta_network.get());
|
||||
|
||||
sta_iface_->listNetworks([](const SupplicantStatus& status,
|
||||
@@ -218,7 +239,7 @@ TEST_F(SupplicantStaIfaceHidlTest, listNetworks) {
|
||||
/*
|
||||
* Reassociate.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, Reassociate) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, Reassociate) {
|
||||
sta_iface_->reassociate([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -227,7 +248,7 @@ TEST_F(SupplicantStaIfaceHidlTest, Reassociate) {
|
||||
/*
|
||||
* Reconnect.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, Reconnect) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, Reconnect) {
|
||||
sta_iface_->reconnect([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::FAILURE_IFACE_NOT_DISCONNECTED,
|
||||
status.code);
|
||||
@@ -237,7 +258,7 @@ TEST_F(SupplicantStaIfaceHidlTest, Reconnect) {
|
||||
/*
|
||||
* Disconnect.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, Disconnect) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, Disconnect) {
|
||||
sta_iface_->disconnect([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -246,7 +267,7 @@ TEST_F(SupplicantStaIfaceHidlTest, Disconnect) {
|
||||
/*
|
||||
* SetPowerSave.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetPowerSave) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetPowerSave) {
|
||||
sta_iface_->setPowerSave(true, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -258,7 +279,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetPowerSave) {
|
||||
/*
|
||||
* InitiateTdlsDiscover.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsDiscover) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, InitiateTdlsDiscover) {
|
||||
sta_iface_->initiateTdlsDiscover(
|
||||
mac_addr_, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -268,7 +289,7 @@ TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsDiscover) {
|
||||
/*
|
||||
* InitiateTdlsSetup.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsSetup) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, InitiateTdlsSetup) {
|
||||
sta_iface_->initiateTdlsSetup(
|
||||
mac_addr_, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -278,7 +299,7 @@ TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsSetup) {
|
||||
/*
|
||||
* InitiateTdlsTeardown.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsTeardown) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, InitiateTdlsTeardown) {
|
||||
sta_iface_->initiateTdlsTeardown(
|
||||
mac_addr_, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -288,7 +309,7 @@ TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsTeardown) {
|
||||
/*
|
||||
* InitiateAnqpQuery.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, InitiateAnqpQuery) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, InitiateAnqpQuery) {
|
||||
std::vector<ISupplicantStaIface::AnqpInfoId> anqp_ids(
|
||||
kTestAnqpInfoIds, kTestAnqpInfoIds + sizeof(kTestAnqpInfoIds));
|
||||
std::vector<ISupplicantStaIface::Hs20AnqpSubtypes> hs_types(
|
||||
@@ -304,7 +325,7 @@ TEST_F(SupplicantStaIfaceHidlTest, InitiateAnqpQuery) {
|
||||
/*
|
||||
* InitiateHs20IconQuery.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, InitiateHs20IconQuery) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, InitiateHs20IconQuery) {
|
||||
sta_iface_->initiateHs20IconQuery(
|
||||
mac_addr_, kTestHs20IconFile, [](const SupplicantStatus& status) {
|
||||
// These requests will fail unless the BSSID mentioned is actually
|
||||
@@ -316,7 +337,7 @@ TEST_F(SupplicantStaIfaceHidlTest, InitiateHs20IconQuery) {
|
||||
/*
|
||||
* GetMacAddress.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, GetMacAddress) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, GetMacAddress) {
|
||||
sta_iface_->getMacAddress([](const SupplicantStatus& status,
|
||||
const hidl_array<uint8_t, 6>& mac_addr) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -328,7 +349,7 @@ TEST_F(SupplicantStaIfaceHidlTest, GetMacAddress) {
|
||||
/*
|
||||
* StartRxFilter.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, StartRxFilter) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, StartRxFilter) {
|
||||
sta_iface_->startRxFilter([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -337,7 +358,7 @@ TEST_F(SupplicantStaIfaceHidlTest, StartRxFilter) {
|
||||
/*
|
||||
* StopRxFilter.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, StopRxFilter) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, StopRxFilter) {
|
||||
sta_iface_->stopRxFilter([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -346,7 +367,7 @@ TEST_F(SupplicantStaIfaceHidlTest, StopRxFilter) {
|
||||
/*
|
||||
* AddRxFilter.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, AddRxFilter) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, AddRxFilter) {
|
||||
sta_iface_->addRxFilter(ISupplicantStaIface::RxFilterType::V4_MULTICAST,
|
||||
[](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -362,7 +383,7 @@ TEST_F(SupplicantStaIfaceHidlTest, AddRxFilter) {
|
||||
/*
|
||||
* RemoveRxFilter.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, RemoveRxFilter) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, RemoveRxFilter) {
|
||||
sta_iface_->removeRxFilter(ISupplicantStaIface::RxFilterType::V4_MULTICAST,
|
||||
[](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -378,7 +399,7 @@ TEST_F(SupplicantStaIfaceHidlTest, RemoveRxFilter) {
|
||||
/*
|
||||
* SetBtCoexistenceMode.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceMode) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetBtCoexistenceMode) {
|
||||
sta_iface_->setBtCoexistenceMode(
|
||||
ISupplicantStaIface::BtCoexistenceMode::ENABLED,
|
||||
[](const SupplicantStatus& status) {
|
||||
@@ -399,7 +420,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceMode) {
|
||||
/*
|
||||
* SetBtCoexistenceScanModeEnabled.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceScanModeEnabled) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetBtCoexistenceScanModeEnabled) {
|
||||
sta_iface_->setBtCoexistenceScanModeEnabled(
|
||||
true, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -413,7 +434,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceScanModeEnabled) {
|
||||
/*
|
||||
* SetSuspendModeEnabled.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetSuspendModeEnabled) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetSuspendModeEnabled) {
|
||||
sta_iface_->setSuspendModeEnabled(true, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -426,7 +447,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetSuspendModeEnabled) {
|
||||
/*
|
||||
* SetCountryCode.
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetCountryCode) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetCountryCode) {
|
||||
sta_iface_->setCountryCode(
|
||||
kTestCountryCode, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -436,7 +457,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetCountryCode) {
|
||||
/*
|
||||
* SetWpsDeviceName
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceName) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsDeviceName) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsDeviceName, kTestWpsDeviceName).code);
|
||||
@@ -445,7 +466,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceName) {
|
||||
/*
|
||||
* SetWpsDeviceType
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceType) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsDeviceType) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsDeviceType, kTestWpsDeviceType).code);
|
||||
@@ -454,7 +475,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceType) {
|
||||
/*
|
||||
* SetWpsManufacturer
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsManufacturer) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsManufacturer) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsManufacturer, kTestWpsManufacturer).code);
|
||||
@@ -463,7 +484,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsManufacturer) {
|
||||
/*
|
||||
* SetWpsModelName
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelName) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsModelName) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsModelName, kTestWpsModelName).code);
|
||||
}
|
||||
@@ -471,7 +492,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelName) {
|
||||
/*
|
||||
* SetWpsModelNumber
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelNumber) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsModelNumber) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsModelNumber, kTestWpsModelNumber).code);
|
||||
@@ -480,7 +501,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelNumber) {
|
||||
/*
|
||||
* SetWpsSerialNumber
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsSerialNumber) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsSerialNumber) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsSerialNumber, kTestWpsSerialNumber).code);
|
||||
@@ -489,7 +510,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsSerialNumber) {
|
||||
/*
|
||||
* SetWpsConfigMethods
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetWpsConfigMethods) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetWpsConfigMethods) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setWpsConfigMethods, kTestWpsConfigMethods)
|
||||
@@ -499,7 +520,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetWpsConfigMethods) {
|
||||
/*
|
||||
* SetExternalSim
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, SetExternalSim) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, SetExternalSim) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, setExternalSim, true).code);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -509,7 +530,7 @@ TEST_F(SupplicantStaIfaceHidlTest, SetExternalSim) {
|
||||
/*
|
||||
* AddExtRadioWork
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, AddExtRadioWork) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, AddExtRadioWork) {
|
||||
const auto& status_and_radio_work_id =
|
||||
HIDL_INVOKE(sta_iface_, addExtRadioWork, kTestRadioWorkName,
|
||||
kTestRadioWorkFrequency, kTestRadioWorkTimeout);
|
||||
@@ -524,9 +545,18 @@ TEST_F(SupplicantStaIfaceHidlTest, AddExtRadioWork) {
|
||||
/*
|
||||
* RemoveExtRadioWork
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, RemoveExtRadioWork) {
|
||||
TEST_P(SupplicantStaIfaceHidlTest, RemoveExtRadioWork) {
|
||||
// This fails because there is no on going radio work with kTestRadioWorkId.
|
||||
EXPECT_NE(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_iface_, removeExtRadioWork, kTestRadioWorkId).code);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
PerInstance, SupplicantStaIfaceHidlTest,
|
||||
testing::Combine(
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
ISupplicant::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
@@ -16,14 +16,16 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
|
||||
|
||||
#include <VtsCoreUtil.h>
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "supplicant_hidl_call_util.h"
|
||||
#include "supplicant_hidl_test_utils.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
@@ -32,12 +34,14 @@ 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::ISupplicant;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::
|
||||
ISupplicantStaNetworkCallback;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
|
||||
namespace {
|
||||
constexpr char kTestSsidStr[] = "TestSsid1234";
|
||||
@@ -74,37 +78,50 @@ constexpr uint32_t kTestPairwiseCipher =
|
||||
ISupplicantStaNetwork::PairwiseCipherMask::TKIP);
|
||||
} // namespace
|
||||
|
||||
class SupplicantStaNetworkHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class SupplicantStaNetworkHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging());
|
||||
sta_network_ = createSupplicantStaNetwork();
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
sta_network_ = createSupplicantStaNetwork(supplicant_);
|
||||
ASSERT_NE(sta_network_.get(), nullptr);
|
||||
|
||||
ssid_.assign(kTestSsidStr, kTestSsidStr + strlen(kTestSsidStr));
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopSupplicant(); }
|
||||
virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
|
||||
|
||||
protected:
|
||||
void removeNetwork() {
|
||||
sp<ISupplicantStaIface> sta_iface = getSupplicantStaIface();
|
||||
ASSERT_NE(nullptr, sta_iface.get());
|
||||
uint32_t net_id;
|
||||
sta_network_->getId([&](const SupplicantStatus& status, int network_id) {
|
||||
ASSERT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
net_id = network_id;
|
||||
});
|
||||
sta_iface->removeNetwork(net_id, [](const SupplicantStatus& status) {
|
||||
ASSERT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
sp<ISupplicantStaIface> sta_iface = getSupplicantStaIface(supplicant_);
|
||||
ASSERT_NE(nullptr, sta_iface.get());
|
||||
uint32_t net_id;
|
||||
sta_network_->getId(
|
||||
[&](const SupplicantStatus& status, int network_id) {
|
||||
ASSERT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
net_id = network_id;
|
||||
});
|
||||
sta_iface->removeNetwork(net_id, [](const SupplicantStatus& status) {
|
||||
ASSERT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
}
|
||||
|
||||
bool isP2pOn_ = false;
|
||||
sp<ISupplicant> supplicant_;
|
||||
// ISupplicantStaNetwork object used for all tests in this fixture.
|
||||
sp<ISupplicantStaNetwork> sta_network_;
|
||||
// SSID to use for various tests.
|
||||
std::vector<uint8_t> ssid_;
|
||||
std::string wifi_instance_name_;
|
||||
std::string supplicant_instance_name_;
|
||||
};
|
||||
|
||||
class NetworkCallback : public ISupplicantStaNetworkCallback {
|
||||
@@ -126,16 +143,20 @@ class NetworkCallback : public ISupplicantStaNetworkCallback {
|
||||
* Ensures that an instance of the ISupplicantStaNetwork proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(SupplicantStaNetworkHidlTestNoFixture, Create) {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_NE(nullptr, createSupplicantStaNetwork().get());
|
||||
stopSupplicant();
|
||||
TEST_P(SupplicantStaNetworkHidlTest, Create) {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
sp<ISupplicant> supplicant =
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant));
|
||||
EXPECT_NE(nullptr, createSupplicantStaNetwork(supplicant).get());
|
||||
}
|
||||
|
||||
/*
|
||||
* RegisterCallback
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, RegisterCallback) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, RegisterCallback) {
|
||||
sta_network_->registerCallback(
|
||||
new NetworkCallback(), [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -145,7 +166,7 @@ TEST_F(SupplicantStaNetworkHidlTest, RegisterCallback) {
|
||||
/*
|
||||
* GetInterfaceName
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, GetInterfaceName) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, GetInterfaceName) {
|
||||
const auto& status_and_interface_name =
|
||||
HIDL_INVOKE(sta_network_, getInterfaceName);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -156,7 +177,7 @@ TEST_F(SupplicantStaNetworkHidlTest, GetInterfaceName) {
|
||||
/*
|
||||
* GetType
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, GetType) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, GetType) {
|
||||
const auto& status_and_interface_type = HIDL_INVOKE(sta_network_, getType);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
status_and_interface_type.first.code);
|
||||
@@ -167,7 +188,7 @@ TEST_F(SupplicantStaNetworkHidlTest, GetType) {
|
||||
/*
|
||||
* SetGetSsid
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetSsid) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetSsid) {
|
||||
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -181,7 +202,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetSsid) {
|
||||
/*
|
||||
* SetGetBssid
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetBssid) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetBssid) {
|
||||
std::array<uint8_t, 6> set_bssid;
|
||||
memcpy(set_bssid.data(), kTestBssid, set_bssid.size());
|
||||
sta_network_->setBssid(set_bssid, [](const SupplicantStatus& status) {
|
||||
@@ -199,7 +220,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetBssid) {
|
||||
/*
|
||||
* SetGetKeyMgmt
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) {
|
||||
sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -213,7 +234,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) {
|
||||
/*
|
||||
* SetGetProto
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetProto) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetProto) {
|
||||
sta_network_->setProto(kTestProto, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -226,7 +247,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetProto) {
|
||||
/*
|
||||
* SetGetKeyAuthAlg
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetAuthAlg) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetAuthAlg) {
|
||||
sta_network_->setAuthAlg(kTestAuthAlg, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
@@ -240,7 +261,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetAuthAlg) {
|
||||
/*
|
||||
* SetGetGroupCipher
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetGroupCipher) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetGroupCipher) {
|
||||
sta_network_->setGroupCipher(
|
||||
kTestGroupCipher, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -255,7 +276,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetGroupCipher) {
|
||||
/*
|
||||
* SetGetPairwiseCipher
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher) {
|
||||
sta_network_->setPairwiseCipher(
|
||||
kTestPairwiseCipher, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -270,7 +291,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher) {
|
||||
/*
|
||||
* SetGetPskPassphrase
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetPskPassphrase) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetPskPassphrase) {
|
||||
sta_network_->setPskPassphrase(
|
||||
kTestPskPassphrase, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -285,7 +306,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetPskPassphrase) {
|
||||
/*
|
||||
* SetGetPsk
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetPsk) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetPsk) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, setPsk, kTestPsk).code);
|
||||
const auto& status_and_psk = HIDL_INVOKE(sta_network_, getPsk);
|
||||
@@ -297,7 +318,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetPsk) {
|
||||
/*
|
||||
* SetGetWepKeys
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetWepTxKeyIdx) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetWepTxKeyIdx) {
|
||||
sta_network_->setWepTxKeyIdx(
|
||||
kTestWepTxKeyIdx, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -312,7 +333,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetWepTxKeyIdx) {
|
||||
/*
|
||||
* SetGetWepKeys
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetWepKeys) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetWepKeys) {
|
||||
for (uint32_t i = 0;
|
||||
i < static_cast<uint32_t>(
|
||||
ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM);
|
||||
@@ -334,7 +355,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetWepKeys) {
|
||||
/*
|
||||
* SetGetScanSsid
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetScanSsid) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetScanSsid) {
|
||||
sta_network_->setScanSsid(
|
||||
true, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -349,7 +370,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetScanSsid) {
|
||||
/*
|
||||
* SetGetRequirePmf
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetRequirePmf) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetRequirePmf) {
|
||||
sta_network_->setRequirePmf(
|
||||
true, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -364,7 +385,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetRequirePmf) {
|
||||
/*
|
||||
* SetGetIdStr
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetIdStr) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetIdStr) {
|
||||
sta_network_->setIdStr(
|
||||
kTestIdStr, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -376,11 +397,10 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetIdStr) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SetGetEapMethod
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapMethod) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapMethod) {
|
||||
ISupplicantStaNetwork::EapMethod set_eap_method =
|
||||
ISupplicantStaNetwork::EapMethod::PEAP;
|
||||
sta_network_->setEapMethod(
|
||||
@@ -398,7 +418,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapMethod) {
|
||||
/*
|
||||
* SetGetEapPhase2Method
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPhase2Method) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapPhase2Method) {
|
||||
ISupplicantStaNetwork::EapMethod set_eap_method =
|
||||
ISupplicantStaNetwork::EapMethod::PEAP;
|
||||
sta_network_->setEapMethod(
|
||||
@@ -422,7 +442,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPhase2Method) {
|
||||
/*
|
||||
* SetGetEapIdentity
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapIdentity) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapIdentity) {
|
||||
std::vector<uint8_t> set_identity(kTestIdentity, kTestIdentity + sizeof(kTestIdentity));
|
||||
sta_network_->setEapIdentity(
|
||||
set_identity, [](const SupplicantStatus& status) {
|
||||
@@ -438,7 +458,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapIdentity) {
|
||||
/*
|
||||
* SetGetEapAnonymousIdentity
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapAnonymousIdentity) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapAnonymousIdentity) {
|
||||
std::vector<uint8_t> set_identity(kTestIdentity, kTestIdentity + sizeof(kTestIdentity));
|
||||
sta_network_->setEapAnonymousIdentity(
|
||||
set_identity, [](const SupplicantStatus& status) {
|
||||
@@ -454,7 +474,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapAnonymousIdentity) {
|
||||
/*
|
||||
* SetGetEapPassword
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPassword) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapPassword) {
|
||||
std::vector<uint8_t> set_eap_passwd(
|
||||
kTestEapPasswdStr, kTestEapPasswdStr + strlen(kTestEapPasswdStr));
|
||||
sta_network_->setEapPassword(
|
||||
@@ -471,7 +491,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPassword) {
|
||||
/*
|
||||
* SetGetEapCACert
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapCACert) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapCACert) {
|
||||
sta_network_->setEapCACert(
|
||||
kTestEapCert, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -486,7 +506,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapCACert) {
|
||||
/*
|
||||
* SetGetEapCAPath
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapCAPath) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapCAPath) {
|
||||
sta_network_->setEapCAPath(
|
||||
kTestEapCert, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -501,7 +521,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapCAPath) {
|
||||
/*
|
||||
* SetGetEapClientCert
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapClientCert) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapClientCert) {
|
||||
sta_network_->setEapClientCert(
|
||||
kTestEapCert, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -516,7 +536,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapClientCert) {
|
||||
/*
|
||||
* SetGetEapPrivateKeyId
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPrivateKeyId) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapPrivateKeyId) {
|
||||
sta_network_->setEapPrivateKeyId(
|
||||
kTestEapPrivateKeyId, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -531,7 +551,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPrivateKeyId) {
|
||||
/*
|
||||
* SetGetEapAltSubjectMatch
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapAltSubjectMatch) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapAltSubjectMatch) {
|
||||
sta_network_->setEapAltSubjectMatch(
|
||||
kTestEapMatch, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -546,7 +566,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapAltSubjectMatch) {
|
||||
/*
|
||||
* SetGetEapSubjectMatch
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapSubjectMatch) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapSubjectMatch) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, setEapSubjectMatch, kTestEapMatch).code);
|
||||
@@ -561,7 +581,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapSubjectMatch) {
|
||||
/*
|
||||
* SetGetEapDomainSuffixMatch
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapDomainSuffixMatch) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapDomainSuffixMatch) {
|
||||
sta_network_->setEapDomainSuffixMatch(
|
||||
kTestEapMatch, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -576,7 +596,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapDomainSuffixMatch) {
|
||||
/*
|
||||
* SetGetEapEngine
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapEngine) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapEngine) {
|
||||
sta_network_->setEapEngine(
|
||||
true, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -591,7 +611,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapEngine) {
|
||||
/*
|
||||
* SetGetEapEngineID
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetGetEapEngineID) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetGetEapEngineID) {
|
||||
sta_network_->setEapEngineID(
|
||||
kTestEapEngineID, [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
@@ -606,7 +626,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetGetEapEngineID) {
|
||||
/*
|
||||
* Enable
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, Enable) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, Enable) {
|
||||
// wpa_supplicant doesn't perform any connection initiation
|
||||
// unless atleast the Ssid and Ket mgmt params are set.
|
||||
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
|
||||
@@ -633,7 +653,7 @@ TEST_F(SupplicantStaNetworkHidlTest, Enable) {
|
||||
/*
|
||||
* Disable
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, Disable) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, Disable) {
|
||||
// wpa_supplicant doesn't perform any connection initiation
|
||||
// unless atleast the Ssid and Ket mgmt params are set.
|
||||
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
|
||||
@@ -656,7 +676,7 @@ TEST_F(SupplicantStaNetworkHidlTest, Disable) {
|
||||
/*
|
||||
* Select.
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, Select) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, Select) {
|
||||
// wpa_supplicant doesn't perform any connection initiation
|
||||
// unless atleast the Ssid and Ket mgmt params are set.
|
||||
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
|
||||
@@ -679,7 +699,7 @@ TEST_F(SupplicantStaNetworkHidlTest, Select) {
|
||||
/*
|
||||
* SendNetworkEapSimGsmAuthResponse
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthResponse) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthResponse) {
|
||||
std::vector<ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams>
|
||||
params;
|
||||
ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams param;
|
||||
@@ -695,7 +715,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthResponse) {
|
||||
/*
|
||||
* SendNetworkEapSimGsmAuthFailure
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthFailure) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthFailure) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, sendNetworkEapSimGsmAuthFailure).code);
|
||||
}
|
||||
@@ -703,7 +723,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthFailure) {
|
||||
/*
|
||||
* SendNetworkEapSimUmtsAuthResponse
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthResponse) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthResponse) {
|
||||
ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams params;
|
||||
params.res = std::vector<uint8_t>(kTestRes, kTestRes + sizeof(kTestRes));
|
||||
memcpy(params.ik.data(), kTestIk, params.ik.size());
|
||||
@@ -717,7 +737,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthResponse) {
|
||||
/*
|
||||
* SendNetworkEapSimUmtsAuthFailure
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthFailure) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthFailure) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, sendNetworkEapSimUmtsAuthFailure).code);
|
||||
}
|
||||
@@ -725,7 +745,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthFailure) {
|
||||
/*
|
||||
* SendNetworkEapSimUmtsAutsResponse
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAutsResponse) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAutsResponse) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, sendNetworkEapSimUmtsAutsResponse,
|
||||
kTestAutParam)
|
||||
@@ -735,7 +755,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAutsResponse) {
|
||||
/*
|
||||
* SendNetworkEapIdentityResponse
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapIdentityResponse) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SendNetworkEapIdentityResponse) {
|
||||
sta_network_->sendNetworkEapIdentityResponse(
|
||||
std::vector<uint8_t>(kTestIdentity,
|
||||
kTestIdentity + sizeof(kTestIdentity)),
|
||||
@@ -747,7 +767,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapIdentityResponse) {
|
||||
/*
|
||||
* SetUpdateIdentifier
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetUpdateIdentifier) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetUpdateIdentifier) {
|
||||
EXPECT_EQ(
|
||||
SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, setUpdateIdentifier, kTestUpdateIdentifier)
|
||||
@@ -757,7 +777,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetUpdateIdentifier) {
|
||||
/*
|
||||
* SetProactiveKeyCaching
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, SetProactiveKeyCaching) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, SetProactiveKeyCaching) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, setProactiveKeyCaching, true).code);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -767,7 +787,7 @@ TEST_F(SupplicantStaNetworkHidlTest, SetProactiveKeyCaching) {
|
||||
/*
|
||||
* GetWpsNfcConfigurationToken
|
||||
*/
|
||||
TEST_F(SupplicantStaNetworkHidlTest, GetWpsNfcConfigurationToken) {
|
||||
TEST_P(SupplicantStaNetworkHidlTest, GetWpsNfcConfigurationToken) {
|
||||
ASSERT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(sta_network_, setSsid, ssid_).code);
|
||||
ASSERT_EQ(SupplicantStatusCode::SUCCESS,
|
||||
@@ -780,3 +800,12 @@ TEST_F(SupplicantStaNetworkHidlTest, GetWpsNfcConfigurationToken) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status_and_token.first.code);
|
||||
EXPECT_FALSE(0 == status_and_token.second.size());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
PerInstance, SupplicantStaNetworkHidlTest,
|
||||
testing::Combine(
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
ISupplicant::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
Reference in New Issue
Block a user