wifi: fix old vts tests on newer HAL

Older registerCallback is not deprecated until V1.4 HAL correctly.
As a result, their returning codes are still SUCCESS.

Bug: 173570755
Test: atest VtsHalWifiSupplicantV1_0TargetTest \
            VtsHalWifiSupplicantV1_1TargetTest \
            VtsHalWifiSupplicantV1_2TargetTest
Change-Id: Ib23821d64f53c144d74818fa3ed9aca06cd25a27
This commit is contained in:
Jimmy Chen 2020-11-20 01:45:55 +08:00
parent d37dae5138
commit becd2f136b
5 changed files with 19 additions and 9 deletions

View file

@ -22,7 +22,7 @@
#include <VtsCoreUtil.h>
#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIface.h>
#include "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"
@ -74,7 +74,7 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_0 {
sta_iface_ = getSupplicantStaIface(supplicant_);
ASSERT_NE(sta_iface_.get(), nullptr);
v1_1 = ::android::hardware::wifi::supplicant::V1_1::
v1_4 = ::android::hardware::wifi::supplicant::V1_4::
ISupplicantStaIface::castFrom(sta_iface_);
memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
@ -82,7 +82,7 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_0 {
protected:
bool isP2pOn_ = false;
sp<::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface> v1_1 =
sp<::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface> v1_4 =
nullptr;
// ISupplicantStaIface object used for all tests in this fixture.
sp<ISupplicantStaIface> sta_iface_;
@ -181,8 +181,9 @@ TEST_P(SupplicantStaIfaceHidlTest, Create) {
* RegisterCallback
*/
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback) {
// This API is deprecated from v1.4 HAL.
SupplicantStatusCode expectedCode =
(nullptr != v1_1) ? SupplicantStatusCode::FAILURE_UNKNOWN
(nullptr != v1_4) ? SupplicantStatusCode::FAILURE_UNKNOWN
: SupplicantStatusCode::SUCCESS;
sta_iface_->registerCallback(new IfaceCallback(),
[&](const SupplicantStatus& status) {

View file

@ -48,6 +48,8 @@ cc_test {
"android.hardware.wifi.supplicant@1.0",
"android.hardware.wifi.supplicant@1.1",
"android.hardware.wifi.supplicant@1.2",
"android.hardware.wifi.supplicant@1.3",
"android.hardware.wifi.supplicant@1.4",
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
"libgmock",

View file

@ -20,7 +20,7 @@
#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/1.1/IWifi.h>
#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIface.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@ -47,14 +47,14 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_1 {
sta_iface_ = getSupplicantStaIface_1_1(supplicant_);
ASSERT_NE(sta_iface_.get(), nullptr);
v1_2 = ::android::hardware::wifi::supplicant::V1_2::
v1_4 = ::android::hardware::wifi::supplicant::V1_4::
ISupplicantStaIface::castFrom(sta_iface_);
}
protected:
// ISupplicantStaIface object used for all tests in this fixture.
sp<ISupplicantStaIface> sta_iface_;
sp<::android::hardware::wifi::supplicant::V1_2::ISupplicantStaIface> v1_2 =
sp<::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface> v1_4 =
nullptr;
};
@ -139,8 +139,9 @@ class IfaceCallback : public ISupplicantStaIfaceCallback {
* RegisterCallback_1_1
*/
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback_1_1) {
// This API is deprecated from v1.4 HAL.
SupplicantStatusCode expectedCode =
(nullptr != v1_2) ? SupplicantStatusCode::FAILURE_UNKNOWN
(nullptr != v1_4) ? SupplicantStatusCode::FAILURE_UNKNOWN
: SupplicantStatusCode::SUCCESS;
sta_iface_->registerCallback_1_1(new IfaceCallback(),
[&](const SupplicantStatus& status) {

View file

@ -51,6 +51,7 @@ cc_test {
"android.hardware.wifi.supplicant@1.1",
"android.hardware.wifi.supplicant@1.2",
"android.hardware.wifi.supplicant@1.3",
"android.hardware.wifi.supplicant@1.4",
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
"libgmock",

View file

@ -25,6 +25,7 @@
#include <android/hardware/wifi/supplicant/1.2/types.h>
#include <android/hardware/wifi/supplicant/1.3/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.3/types.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIface.h>
#include <hidl/GtestPrinter.h>
#include <hidl/HidlSupport.h>
#include <hidl/ServiceManagement.h>
@ -63,6 +64,8 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_2 {
v1_3 = ::android::hardware::wifi::supplicant::V1_3::
ISupplicantStaIface::castFrom(sta_iface_);
v1_4 = ::android::hardware::wifi::supplicant::V1_4::
ISupplicantStaIface::castFrom(sta_iface_);
}
enum DppCallbackType {
@ -106,6 +109,7 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_2 {
// ISupplicantStaIface object used for all tests in this fixture.
sp<ISupplicantStaIface> sta_iface_;
sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface> v1_3;
sp<::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface> v1_4;
bool isDppSupported() {
uint32_t keyMgmtMask = 0;
@ -266,8 +270,9 @@ class IfaceDppCallback : public IfaceCallback {
* RegisterCallback_1_2
*/
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback_1_2) {
// This API is deprecated from v1.4 HAL.
SupplicantStatusCode expectedCode =
(nullptr != v1_3) ? SupplicantStatusCode::FAILURE_UNKNOWN
(nullptr != v1_4) ? SupplicantStatusCode::FAILURE_UNKNOWN
: SupplicantStatusCode::SUCCESS;
sta_iface_->registerCallback_1_2(new IfaceCallback(),
[&](const SupplicantStatus& status) {