mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:23:37 +00:00
WiFi: Add vts tests for ISupplicantStaIface 1.1
This Commit adds the tests for the ISupplicantStaIface for V1.1 Bug: 64612561 Test: Manual Change-Id: Id5608d0f985004a22954f368ac0fa19886f7421d Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
This commit is contained in:
@@ -40,6 +40,7 @@ cc_test {
|
||||
srcs: [
|
||||
"VtsHalWifiSupplicantV1_1TargetTest.cpp",
|
||||
"supplicant_hidl_test.cpp",
|
||||
"supplicant_sta_iface_hidl_test.cpp",
|
||||
"supplicant_sta_network_hidl_test.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "supplicant_hidl_test_utils_1_1.h"
|
||||
|
||||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicant;
|
||||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork;
|
||||
using ::android::sp;
|
||||
|
||||
@@ -28,6 +29,10 @@ sp<ISupplicant> getSupplicant_1_1() {
|
||||
return ISupplicant::castFrom(getSupplicant());
|
||||
}
|
||||
|
||||
sp<ISupplicantStaIface> getSupplicantStaIface_1_1() {
|
||||
return ISupplicantStaIface::castFrom(getSupplicantStaIface());
|
||||
}
|
||||
|
||||
sp<ISupplicantStaNetwork> createSupplicantStaNetwork_1_1() {
|
||||
return ISupplicantStaNetwork::castFrom(createSupplicantStaNetwork());
|
||||
}
|
||||
|
||||
@@ -18,11 +18,15 @@
|
||||
#define SUPPLICANT_HIDL_TEST_UTILS_1_1_H
|
||||
|
||||
#include <android/hardware/wifi/supplicant/1.1/ISupplicant.h>
|
||||
#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h>
|
||||
#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaNetwork.h>
|
||||
|
||||
android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicant>
|
||||
getSupplicant_1_1();
|
||||
|
||||
android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface>
|
||||
getSupplicantStaIface_1_1();
|
||||
|
||||
android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork>
|
||||
createSupplicantStaNetwork_1_1();
|
||||
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h>
|
||||
|
||||
#include "supplicant_hidl_test_utils.h"
|
||||
#include "supplicant_hidl_test_utils_1_1.h"
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface;
|
||||
using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIfaceCallback;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
|
||||
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
|
||||
|
||||
class SupplicantStaIfaceHidlTest
|
||||
: public ::testing::VtsHalHidlTargetTestBase {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
startSupplicantAndWaitForHidlService();
|
||||
EXPECT_TRUE(turnOnExcessiveLogging());
|
||||
sta_iface_ = getSupplicantStaIface_1_1();
|
||||
ASSERT_NE(sta_iface_.get(), nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopSupplicant(); }
|
||||
|
||||
protected:
|
||||
// ISupplicantStaIface object used for all tests in this fixture.
|
||||
sp<ISupplicantStaIface> sta_iface_;
|
||||
};
|
||||
|
||||
class IfaceCallback : public ISupplicantStaIfaceCallback {
|
||||
Return<void> onNetworkAdded(uint32_t /* id */) override { return Void(); }
|
||||
Return<void> onNetworkRemoved(uint32_t /* id */) override { return Void(); }
|
||||
Return<void> onStateChanged(
|
||||
ISupplicantStaIfaceCallback::State /* newState */,
|
||||
const hidl_array<uint8_t, 6>& /*bssid */, uint32_t /* id */,
|
||||
const hidl_vec<uint8_t>& /* ssid */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onAnqpQueryDone(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */,
|
||||
const ISupplicantStaIfaceCallback::AnqpData& /* data */,
|
||||
const ISupplicantStaIfaceCallback::Hs20AnqpData& /* hs20Data */)
|
||||
override {
|
||||
return Void();
|
||||
}
|
||||
virtual Return<void> onHs20IconQueryDone(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */,
|
||||
const hidl_string& /* fileName */,
|
||||
const hidl_vec<uint8_t>& /* data */) override {
|
||||
return Void();
|
||||
}
|
||||
virtual Return<void> onHs20SubscriptionRemediation(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */,
|
||||
ISupplicantStaIfaceCallback::OsuMethod /* osuMethod */,
|
||||
const hidl_string& /* url*/) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onHs20DeauthImminentNotice(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* reasonCode */,
|
||||
uint32_t /* reAuthDelayInSec */,
|
||||
const hidl_string& /* url */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onDisconnected(const hidl_array<uint8_t, 6>& /* bssid */,
|
||||
bool /* locallyGenerated */,
|
||||
ISupplicantStaIfaceCallback::ReasonCode
|
||||
/* reasonCode */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onAssociationRejected(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */,
|
||||
ISupplicantStaIfaceCallback::StatusCode /* statusCode */,
|
||||
bool /*timedOut */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onAuthenticationTimeout(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onBssidChanged(
|
||||
ISupplicantStaIfaceCallback::BssidChangeReason /* reason */,
|
||||
const hidl_array<uint8_t, 6>& /* bssid */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onEapFailure() override { return Void(); }
|
||||
Return<void> onEapFailure_1_1(
|
||||
ISupplicantStaIfaceCallback::EapErrorCode /* eapErrorCode */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onWpsEventSuccess() override { return Void(); }
|
||||
Return<void> onWpsEventFail(
|
||||
const hidl_array<uint8_t, 6>& /* bssid */,
|
||||
ISupplicantStaIfaceCallback::WpsConfigError /* configError */,
|
||||
ISupplicantStaIfaceCallback::WpsErrorIndication /* errorInd */)
|
||||
override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onWpsEventPbcOverlap() override { return Void(); }
|
||||
Return<void> onExtRadioWorkStart(uint32_t /* id */) override {
|
||||
return Void();
|
||||
}
|
||||
Return<void> onExtRadioWorkTimeout(uint32_t /* id*/) override {
|
||||
return Void();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* RegisterCallback_1_1
|
||||
*/
|
||||
TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback_1_1) {
|
||||
sta_iface_->registerCallback_1_1(
|
||||
new IfaceCallback(), [](const SupplicantStatus& status) {
|
||||
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user