Merge "wifi: wait for the framework to be ready before checking features" into android11-tests-dev
This commit is contained in:
commit
ec23502100
16 changed files with 124 additions and 196 deletions
|
@ -275,3 +275,17 @@ bool turnOnExcessiveLogging(const sp<ISupplicant>& supplicant) {
|
|||
});
|
||||
return !operation_failed;
|
||||
}
|
||||
|
||||
bool waitForFrameworkReady() {
|
||||
int waitCount = 10;
|
||||
do {
|
||||
// Check whether package service is ready or not.
|
||||
if (!testing::checkSubstringInCommandOutput(
|
||||
"/system/bin/service check package", ": not found")) {
|
||||
return true;
|
||||
}
|
||||
LOG(INFO) << "Framework is not ready";
|
||||
sleep(1);
|
||||
} while (waitCount-- > 0);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef SUPPLICANT_HIDL_TEST_UTILS_H
|
||||
#define SUPPLICANT_HIDL_TEST_UTILS_H
|
||||
|
||||
#include <VtsCoreUtil.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicant.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIface.h>
|
||||
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
|
||||
|
@ -62,4 +64,51 @@ bool turnOnExcessiveLogging(
|
|||
|
||||
bool turnOnExcessiveLogging();
|
||||
|
||||
bool waitForFrameworkReady();
|
||||
|
||||
class SupplicantHidlTestBase
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
// should always be v1.0 wifi
|
||||
wifi_v1_0_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
std::system("/system/bin/start");
|
||||
ASSERT_TRUE(waitForFrameworkReady());
|
||||
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
LOG(INFO) << "SupplicantHidlTestBase isP2pOn_: " << isP2pOn_;
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isP2pOn_ = false;
|
||||
std::string wifi_v1_0_instance_name_;
|
||||
std::string supplicant_instance_name_;
|
||||
};
|
||||
|
||||
class SupplicantHidlTestBaseV1_0 : public SupplicantHidlTestBase {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
ASSERT_NE(supplicant_.get(), nullptr);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
}
|
||||
|
||||
protected:
|
||||
android::sp<android::hardware::wifi::supplicant::V1_0::ISupplicant>
|
||||
supplicant_;
|
||||
};
|
||||
#endif /* SUPPLICANT_HIDL_TEST_UTILS_H */
|
||||
|
|
|
@ -71,21 +71,13 @@ constexpr uint32_t kTestExtListenInterval = 400;
|
|||
constexpr SupplicantNetworkId kTestNetworkId = 5;
|
||||
} // namespace
|
||||
|
||||
class SupplicantP2pIfaceHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantP2pIfaceHidlTest : public SupplicantHidlTestBaseV1_0 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_0::SetUp();
|
||||
if (!isP2pOn_) {
|
||||
GTEST_SKIP() << "Wi-Fi Direct is not supported, skip this test.";
|
||||
}
|
||||
p2p_iface_ = getSupplicantP2pIface(supplicant_);
|
||||
ASSERT_NE(p2p_iface_.get(), nullptr);
|
||||
|
||||
|
@ -93,22 +85,11 @@ class SupplicantP2pIfaceHidlTest
|
|||
memcpy(peer_mac_addr_.data(), kTestPeerMacAddr, peer_mac_addr_.size());
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -201,8 +182,8 @@ class IfaceCallback : public ISupplicantP2pIfaceCallback {
|
|||
* successfully created.
|
||||
*/
|
||||
TEST_P(SupplicantP2pIfaceHidlTest, Create) {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
sp<ISupplicantP2pIface> p2p_iface = getSupplicantP2pIface(
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_));
|
||||
|
@ -301,8 +282,8 @@ TEST_P(SupplicantP2pIfaceHidlTest, Connect) {
|
|||
mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
|
||||
kTestConnectPin, false, false, kTestConnectGoIntent,
|
||||
[](const SupplicantStatus& status, const hidl_string& /* pin */) {
|
||||
// This is not going to work with fake values.
|
||||
EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
|
||||
// After enabling auto-join, it will succeed always.
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -314,12 +295,12 @@ TEST_P(SupplicantP2pIfaceHidlTest, CancelConnect) {
|
|||
mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
|
||||
kTestConnectPin, false, false, kTestConnectGoIntent,
|
||||
[](const SupplicantStatus& status, const hidl_string& /* pin */) {
|
||||
// This is not going to work with fake values.
|
||||
EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
|
||||
// After enabling auto-join, it will succeed always.
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
|
||||
p2p_iface_->cancelConnect([](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -654,4 +635,4 @@ INSTANTIATE_TEST_CASE_P(
|
|||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
ISupplicant::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
|
|
@ -66,42 +66,22 @@ constexpr uint8_t kTestWpsDeviceType[] = {[0 ... 7] = 0x01};
|
|||
constexpr uint16_t kTestWpsConfigMethods = 0xffff;
|
||||
} // namespace
|
||||
|
||||
class SupplicantStaIfaceHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_0 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_0::SetUp();
|
||||
sta_iface_ = getSupplicantStaIface(supplicant_);
|
||||
ASSERT_NE(sta_iface_.get(), nullptr);
|
||||
|
||||
memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -183,8 +163,8 @@ class IfaceCallback : public ISupplicantStaIfaceCallback {
|
|||
* successfully created.
|
||||
*/
|
||||
TEST_P(SupplicantStaIfaceHidlTest, Create) {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
EXPECT_NE(nullptr, getSupplicantStaIface(
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_))
|
||||
|
@ -565,4 +545,4 @@ INSTANTIATE_TEST_CASE_P(
|
|||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
ISupplicant::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
|
|
@ -79,21 +79,10 @@ constexpr uint32_t kTestPairwiseCipher =
|
|||
ISupplicantStaNetwork::PairwiseCipherMask::TKIP);
|
||||
} // namespace
|
||||
|
||||
class SupplicantStaNetworkHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBaseV1_0 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_0::SetUp();
|
||||
sta_network_ = createSupplicantStaNetwork(supplicant_);
|
||||
ASSERT_NE(sta_network_.get(), nullptr);
|
||||
/* variable used to check if the underlying HAL version is 1.3 or
|
||||
|
@ -105,12 +94,6 @@ class SupplicantStaNetworkHidlTest
|
|||
ssid_.assign(kTestSsidStr, kTestSsidStr + strlen(kTestSsidStr));
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
protected:
|
||||
void removeNetwork() {
|
||||
sp<ISupplicantStaIface> sta_iface = getSupplicantStaIface(supplicant_);
|
||||
|
@ -128,14 +111,10 @@ class SupplicantStaNetworkHidlTest
|
|||
|
||||
sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork>
|
||||
v1_3 = nullptr;
|
||||
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 {
|
||||
|
@ -158,8 +137,8 @@ class NetworkCallback : public ISupplicantStaNetworkCallback {
|
|||
* successfully created.
|
||||
*/
|
||||
TEST_P(SupplicantStaNetworkHidlTest, Create) {
|
||||
stopSupplicant(wifi_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_instance_name_,
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_instance_name_);
|
||||
sp<ISupplicant> supplicant =
|
||||
getSupplicant(supplicant_instance_name_, isP2pOn_);
|
||||
|
|
|
@ -35,9 +35,9 @@ using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
|
|||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicant;
|
||||
using ::android::sp;
|
||||
|
||||
class SupplicantHidlTest : public SupplicantHidlTestBase {
|
||||
class SupplicantHidlTest : public SupplicantHidlTestBaseV1_1 {
|
||||
public:
|
||||
virtual void SetUp() override { SupplicantHidlTestBase::SetUp(); }
|
||||
virtual void SetUp() override { SupplicantHidlTestBaseV1_1::SetUp(); }
|
||||
|
||||
protected:
|
||||
std::string getWlan0IfaceName() {
|
||||
|
|
|
@ -36,34 +36,15 @@ createSupplicantStaNetwork_1_1(
|
|||
const android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicant>&
|
||||
supplicant);
|
||||
|
||||
class SupplicantHidlTestBase
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantHidlTestBaseV1_1 : public SupplicantHidlTestBase {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_v1_0_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_v1_1_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_v1_1_instance_name_);
|
||||
supplicant_ =
|
||||
getSupplicant_1_1(supplicant_v1_1_instance_name_, isP2pOn_);
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
supplicant_ = getSupplicant_1_1(supplicant_instance_name_, isP2pOn_);
|
||||
ASSERT_NE(supplicant_.get(), nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
protected:
|
||||
android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicant>
|
||||
supplicant_;
|
||||
bool isP2pOn_ = false;
|
||||
std::string wifi_v1_0_instance_name_;
|
||||
std::string supplicant_v1_1_instance_name_;
|
||||
};
|
||||
|
|
|
@ -39,11 +39,10 @@ using ::android::hardware::wifi::supplicant::V1_1::ISupplicant;
|
|||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIfaceCallback;
|
||||
|
||||
class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBase {
|
||||
class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_1 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_1::SetUp();
|
||||
sta_iface_ = getSupplicantStaIface_1_1(supplicant_);
|
||||
ASSERT_NE(sta_iface_.get(), nullptr);
|
||||
}
|
||||
|
@ -148,4 +147,4 @@ INSTANTIATE_TEST_CASE_P(
|
|||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
android::hardware::wifi::supplicant::V1_1::ISupplicant::
|
||||
descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
|
|
@ -37,11 +37,10 @@ constexpr uint8_t kTestIdentity[] = {0x45, 0x67, 0x98, 0x67, 0x56};
|
|||
constexpr uint8_t kTestEncryptedIdentity[] = {0x35, 0x37, 0x58, 0x57, 0x26};
|
||||
} // namespace
|
||||
|
||||
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBase {
|
||||
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBaseV1_1 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_1::SetUp();
|
||||
sta_network_ = createSupplicantStaNetwork_1_1(supplicant_);
|
||||
ASSERT_NE(sta_network_.get(), nullptr);
|
||||
}
|
||||
|
@ -59,9 +58,9 @@ class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBase {
|
|||
TEST_P(SupplicantStaNetworkHidlTest, Create) {
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_v1_1_instance_name_);
|
||||
supplicant_instance_name_);
|
||||
sp<ISupplicant> supplicant =
|
||||
getSupplicant_1_1(supplicant_v1_1_instance_name_, isP2pOn_);
|
||||
getSupplicant_1_1(supplicant_instance_name_, isP2pOn_);
|
||||
EXPECT_NE(nullptr, createSupplicantStaNetwork_1_1(supplicant).get());
|
||||
}
|
||||
|
||||
|
@ -101,4 +100,4 @@ INSTANTIATE_TEST_CASE_P(
|
|||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
android::hardware::wifi::supplicant::V1_1::ISupplicant::
|
||||
descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
|
|
@ -42,35 +42,16 @@ getSupplicantP2pIface_1_2(
|
|||
const android::sp<android::hardware::wifi::supplicant::V1_2::ISupplicant>&
|
||||
supplicant);
|
||||
|
||||
class SupplicantHidlTestBase
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantHidlTestBaseV1_2 : public SupplicantHidlTestBase {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_v1_0_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_v1_2_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_v1_2_instance_name_);
|
||||
supplicant_ =
|
||||
getSupplicant_1_2(supplicant_v1_2_instance_name_, isP2pOn_);
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
supplicant_ = getSupplicant_1_2(supplicant_instance_name_, isP2pOn_);
|
||||
ASSERT_NE(supplicant_.get(), nullptr);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
protected:
|
||||
android::sp<android::hardware::wifi::supplicant::V1_2::ISupplicant>
|
||||
supplicant_;
|
||||
bool isP2pOn_ = false;
|
||||
std::string wifi_v1_0_instance_name_;
|
||||
std::string supplicant_v1_2_instance_name_;
|
||||
};
|
||||
|
|
|
@ -38,11 +38,10 @@ constexpr char kTestPassphrase[] = "P2pWorld1234";
|
|||
constexpr uint8_t kTestZeroMacAddr[] = {[0 ... 5] = 0x0};
|
||||
} // namespace
|
||||
|
||||
class SupplicantP2pIfaceHidlTest : public SupplicantHidlTestBase {
|
||||
class SupplicantP2pIfaceHidlTest : public SupplicantHidlTestBaseV1_2 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_2::SetUp();
|
||||
if (!isP2pOn_) {
|
||||
GTEST_SKIP() << "Wi-Fi Direct is not supported, skip this test.";
|
||||
}
|
||||
|
|
|
@ -53,11 +53,10 @@ using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
|
|||
#define TIMEOUT_PERIOD 60
|
||||
class IfaceDppCallback;
|
||||
|
||||
class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBase {
|
||||
class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_2 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_2::SetUp();
|
||||
sta_iface_ = getSupplicantStaIface_1_2(supplicant_);
|
||||
ASSERT_NE(sta_iface_.get(), nullptr);
|
||||
count_ = 0;
|
||||
|
|
|
@ -37,10 +37,10 @@ using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
|
|||
// constexpr uint8_t kTestEncryptedIdentity[] = {0x35, 0x37, 0x58, 0x57, 0x26};
|
||||
//} // namespace
|
||||
|
||||
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBase {
|
||||
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBaseV1_2 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
SupplicantHidlTestBaseV1_2::SetUp();
|
||||
sta_network_ = createSupplicantStaNetwork_1_2(supplicant_);
|
||||
ASSERT_NE(sta_network_.get(), nullptr);
|
||||
}
|
||||
|
|
|
@ -34,4 +34,17 @@ getSupplicant_1_3(const std::string& supplicant_instance_name, bool isP2pOn);
|
|||
bool isFilsSupported(
|
||||
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface>
|
||||
sta_iface);
|
||||
|
||||
class SupplicantHidlTestBaseV1_3 : public SupplicantHidlTestBase {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
SupplicantHidlTestBase::SetUp();
|
||||
supplicant_ = getSupplicant_1_3(supplicant_instance_name_, isP2pOn_);
|
||||
ASSERT_NE(supplicant_.get(), nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicant>
|
||||
supplicant_;
|
||||
};
|
||||
#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_3_H */
|
||||
|
|
|
@ -55,33 +55,14 @@ using ::android::hardware::wifi::supplicant::V1_3::WpaDriverCapabilitiesMask;
|
|||
#define TIMEOUT_PERIOD 60
|
||||
class IfaceDppCallback;
|
||||
|
||||
class SupplicantStaIfaceHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_3 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_v1_0_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_v1_3_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_v1_3_instance_name_);
|
||||
supplicant_ =
|
||||
getSupplicant_1_3(supplicant_v1_3_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_3::SetUp();
|
||||
sta_iface_ = getSupplicantStaIface_1_3(supplicant_);
|
||||
ASSERT_NE(sta_iface_.get(), nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
int64_t pmkCacheExpirationTimeInSec;
|
||||
std::vector<uint8_t> serializedPmkCacheEntry;
|
||||
|
||||
|
@ -127,10 +108,6 @@ class SupplicantStaIfaceHidlTest
|
|||
protected:
|
||||
// ISupplicantStaIface object used for all tests in this fixture.
|
||||
sp<ISupplicantStaIface> sta_iface_;
|
||||
sp<ISupplicant> supplicant_;
|
||||
bool isP2pOn_ = false;
|
||||
std::string wifi_v1_0_instance_name_;
|
||||
std::string supplicant_v1_3_instance_name_;
|
||||
|
||||
bool isDppSupported() {
|
||||
uint32_t keyMgmtMask = 0;
|
||||
|
|
|
@ -43,43 +43,20 @@ constexpr OcspType kTestOcspType = OcspType::REQUEST_CERT_STATUS;
|
|||
constexpr OcspType kTestInvalidOcspType = (OcspType)-1;
|
||||
} // namespace
|
||||
|
||||
class SupplicantStaNetworkHidlTest
|
||||
: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
|
||||
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBaseV1_3 {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_v1_0_instance_name_ = std::get<0>(GetParam());
|
||||
supplicant_v1_3_instance_name_ = std::get<1>(GetParam());
|
||||
isP2pOn_ =
|
||||
testing::deviceSupportsFeature("android.hardware.wifi.direct");
|
||||
// Stop Framework
|
||||
std::system("/system/bin/stop");
|
||||
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
|
||||
supplicant_v1_3_instance_name_);
|
||||
supplicant_ =
|
||||
getSupplicant_1_3(supplicant_v1_3_instance_name_, isP2pOn_);
|
||||
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
|
||||
SupplicantHidlTestBaseV1_3::SetUp();
|
||||
sta_iface_ = getSupplicantStaIface_1_3(supplicant_);
|
||||
ASSERT_NE(nullptr, sta_iface_.get());
|
||||
sta_network_ = createSupplicantStaNetwork_1_3(supplicant_);
|
||||
ASSERT_NE(sta_network_.get(), nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopSupplicant(wifi_v1_0_instance_name_);
|
||||
// Start Framework
|
||||
std::system("/system/bin/start");
|
||||
}
|
||||
|
||||
protected:
|
||||
sp<ISupplicantStaIface> sta_iface_;
|
||||
// ISupplicantStaNetwork object used for all tests in this fixture.
|
||||
sp<ISupplicantStaNetwork> sta_network_;
|
||||
sp<ISupplicant> supplicant_;
|
||||
bool isP2pOn_ = false;
|
||||
std::string wifi_v1_0_instance_name_;
|
||||
std::string supplicant_v1_3_instance_name_;
|
||||
|
||||
bool isWapiSupported() {
|
||||
uint32_t keyMgmtMask = 0;
|
||||
|
|
Loading…
Reference in a new issue