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

Commit 4c219071 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "wifi: fix old vts tests for deprecated APIs"

parents 6ffb9d08 06c9863d
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -22,6 +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 "supplicant_hidl_call_util.h"
#include "supplicant_hidl_test_utils.h"
@@ -73,11 +74,16 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_0 {
        sta_iface_ = getSupplicantStaIface(supplicant_);
        ASSERT_NE(sta_iface_.get(), nullptr);

        v1_1 = ::android::hardware::wifi::supplicant::V1_1::
            ISupplicantStaIface::castFrom(sta_iface_);

        memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
    }

   protected:
    bool isP2pOn_ = false;
    sp<::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface> v1_1 =
        nullptr;
    // ISupplicantStaIface object used for all tests in this fixture.
    sp<ISupplicantStaIface> sta_iface_;
    // MAC address to use for various tests.
@@ -175,9 +181,12 @@ TEST_P(SupplicantStaIfaceHidlTest, Create) {
 * RegisterCallback
 */
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback) {
    sta_iface_->registerCallback(
        new IfaceCallback(), [](const SupplicantStatus& status) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    SupplicantStatusCode expectedCode =
        (nullptr != v1_1) ? SupplicantStatusCode::FAILURE_UNKNOWN
                          : SupplicantStatusCode::SUCCESS;
    sta_iface_->registerCallback(new IfaceCallback(),
                                 [&](const SupplicantStatus& status) {
                                     EXPECT_EQ(expectedCode, status.code);
                                 });
}

+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ cc_test {
        "VtsHalWifiSupplicantV1_1TargetTestUtil",
        "android.hardware.wifi.supplicant@1.0",
        "android.hardware.wifi.supplicant@1.1",
        "android.hardware.wifi.supplicant@1.2",
        "android.hardware.wifi@1.0",
        "android.hardware.wifi@1.1",
        "libgmock",
+13 −4
Original line number Diff line number Diff line
@@ -20,6 +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 <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -45,11 +46,16 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_1 {
        SupplicantHidlTestBaseV1_1::SetUp();
        sta_iface_ = getSupplicantStaIface_1_1(supplicant_);
        ASSERT_NE(sta_iface_.get(), nullptr);

        v1_2 = ::android::hardware::wifi::supplicant::V1_2::
            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 =
        nullptr;
};

class IfaceCallback : public ISupplicantStaIfaceCallback {
@@ -133,9 +139,12 @@ class IfaceCallback : public ISupplicantStaIfaceCallback {
 * RegisterCallback_1_1
 */
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback_1_1) {
    sta_iface_->registerCallback_1_1(
        new IfaceCallback(), [](const SupplicantStatus& status) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    SupplicantStatusCode expectedCode =
        (nullptr != v1_2) ? SupplicantStatusCode::FAILURE_UNKNOWN
                          : SupplicantStatusCode::SUCCESS;
    sta_iface_->registerCallback_1_1(new IfaceCallback(),
                                     [&](const SupplicantStatus& status) {
                                         EXPECT_EQ(expectedCode, status.code);
                                     });
}

+11 −11
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_2 {
        sta_iface_ = getSupplicantStaIface_1_2(supplicant_);
        ASSERT_NE(sta_iface_.get(), nullptr);
        count_ = 0;

        v1_3 = ::android::hardware::wifi::supplicant::V1_3::
            ISupplicantStaIface::castFrom(sta_iface_);
    }

    enum DppCallbackType {
@@ -102,6 +105,7 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_2 {
   protected:
    // ISupplicantStaIface object used for all tests in this fixture.
    sp<ISupplicantStaIface> sta_iface_;
    sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface> v1_3;

    bool isDppSupported() {
        uint32_t keyMgmtMask = 0;
@@ -262,9 +266,12 @@ class IfaceDppCallback : public IfaceCallback {
 * RegisterCallback_1_2
 */
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback_1_2) {
    sta_iface_->registerCallback_1_2(
        new IfaceCallback(), [](const SupplicantStatus& status) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    SupplicantStatusCode expectedCode =
        (nullptr != v1_3) ? SupplicantStatusCode::FAILURE_UNKNOWN
                          : SupplicantStatusCode::SUCCESS;
    sta_iface_->registerCallback_1_2(new IfaceCallback(),
                                     [&](const SupplicantStatus& status) {
                                         EXPECT_EQ(expectedCode, status.code);
                                     });
}

@@ -339,9 +346,6 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppEnrolleeInitiator) {
     * it is waiting for will never be called. Note that this test is also
     * implemented in the 1.3 VTS test.
     */
    sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface> v1_3 =
        ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface::
            castFrom(sta_iface_);
    if (v1_3 != nullptr) {
        GTEST_SKIP() << "Test not supported with this HAL version";
    }
@@ -404,10 +408,6 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
     * it is waiting for will never be called. Note that this test is also
     * implemented in the 1.3 VTS test.
     */
    sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface> v1_3 =
        ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface::
            castFrom(sta_iface_);

    if (v1_3 != nullptr) {
        GTEST_SKIP() << "Test not supported with this HAL version";
        return;
+17 −4
Original line number Diff line number Diff line
@@ -325,9 +325,12 @@ class IfaceBssTmHandlingDoneCallback : public IfaceCallback {
 * RegisterCallback_1_3
 */
TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback_1_3) {
    sta_iface_->registerCallback_1_3(
        new IfaceCallback(), [](const SupplicantStatus& status) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    SupplicantStatusCode expectedCode =
        (nullptr != sta_iface_v1_4_) ? SupplicantStatusCode::FAILURE_UNKNOWN
                                     : SupplicantStatusCode::SUCCESS;
    sta_iface_->registerCallback_1_3(new IfaceCallback(),
                                     [&](const SupplicantStatus& status) {
                                         EXPECT_EQ(expectedCode, status.code);
                                     });
}

@@ -428,6 +431,11 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppEnrolleeInitiator) {
        return;
    }

    if (sta_iface_v1_4_ != nullptr) {
        GTEST_SKIP() << "Test not supported with this HAL version";
        return;
    }

    hidl_string uri =
        "DPP:C:81/1,117/"
        "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj"
@@ -480,6 +488,11 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
        return;
    }

    if (sta_iface_v1_4_ != nullptr) {
        GTEST_SKIP() << "Test not supported with this HAL version";
        return;
    }

    hidl_string uri =
        "DPP:C:81/1,117/"
        "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj"