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

Commit 8f7c08f7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove dependency on VtsHalHidlTargetTestEnvBase" into rvc-dev am: ec78149a

Change-Id: I1c6f03b1830bdf4f016aae48d9d1dae1c899258d
parents 49007d98 ec78149a
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -38,7 +38,6 @@ cc_test {
    name: "VtsHalWifiV1_0TargetTest",
    name: "VtsHalWifiV1_0TargetTest",
    defaults: ["VtsHalTargetTestDefaults"],
    defaults: ["VtsHalTargetTestDefaults"],
    srcs: [
    srcs: [
        "VtsHalWifiV1_0TargetTest.cpp",
        "wifi_chip_hidl_test.cpp",
        "wifi_chip_hidl_test.cpp",
        "wifi_p2p_iface_hidl_test.cpp",
        "wifi_p2p_iface_hidl_test.cpp",
        "wifi_rtt_controller_hidl_test.cpp",
        "wifi_rtt_controller_hidl_test.cpp",
@@ -61,7 +60,6 @@ cc_test {
    name: "VtsHalWifiNanV1_0TargetTest",
    name: "VtsHalWifiNanV1_0TargetTest",
    defaults: ["VtsHalTargetTestDefaults"],
    defaults: ["VtsHalTargetTestDefaults"],
    srcs: [
    srcs: [
        "VtsHalWifiV1_0TargetTest.cpp",
        "wifi_chip_hidl_nan_test.cpp",
        "wifi_chip_hidl_nan_test.cpp",
        "wifi_nan_iface_hidl_test.cpp",
        "wifi_nan_iface_hidl_test.cpp",
    ],
    ],
@@ -79,7 +77,6 @@ cc_test {
    name: "VtsHalWifiApV1_0TargetTest",
    name: "VtsHalWifiApV1_0TargetTest",
    defaults: ["VtsHalTargetTestDefaults"],
    defaults: ["VtsHalTargetTestDefaults"],
    srcs: [
    srcs: [
        "VtsHalWifiV1_0TargetTest.cpp",
        "wifi_ap_iface_hidl_test.cpp",
        "wifi_ap_iface_hidl_test.cpp",
        "wifi_chip_hidl_ap_test.cpp",
        "wifi_chip_hidl_ap_test.cpp",
    ],
    ],
+0 −21
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2016 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 <VtsHalHidlTargetTestEnvBase.h>

// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
// updated.
::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
 No newline at end of file
+0 −2
Original line number Original line Diff line number Diff line
@@ -44,8 +44,6 @@ using ::android::hardware::wifi::V1_0::WifiDebugRingBufferVerboseLevel;
using ::android::hardware::wifi::V1_0::WifiStatus;
using ::android::hardware::wifi::V1_0::WifiStatus;
using ::android::hardware::wifi::V1_0::WifiStatusCode;
using ::android::hardware::wifi::V1_0::WifiStatusCode;


extern WifiHidlEnvironment* gEnv;

namespace {
namespace {
constexpr WifiDebugRingBufferVerboseLevel kDebugRingBufferVerboseLvl =
constexpr WifiDebugRingBufferVerboseLevel kDebugRingBufferVerboseLvl =
    WifiDebugRingBufferVerboseLevel::VERBOSE;
    WifiDebugRingBufferVerboseLevel::VERBOSE;
+2 −17
Original line number Original line Diff line number Diff line
@@ -41,8 +41,6 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_vec;
using ::android::wifi_system::InterfaceTool;
using ::android::wifi_system::InterfaceTool;


extern WifiHidlEnvironment* gEnv;

namespace {
namespace {
constexpr uint32_t kHalStartRetryMaxCount = 5;
constexpr uint32_t kHalStartRetryMaxCount = 5;
constexpr uint32_t kHalStartRetryIntervalInMs = 2;
constexpr uint32_t kHalStartRetryIntervalInMs = 2;
@@ -93,21 +91,8 @@ bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip,
}
}
}  // namespace
}  // namespace


sp<IWifi> getWifi(const std::string& instance_name) {
    if ((!gEnv && instance_name.empty()) || (gEnv && !instance_name.empty())) {
        ALOGE("instance_name and gEnv must have one and only one set.");
        return nullptr;
    }
    if (gEnv) {
        return ::testing::VtsHalHidlTargetTestBase::getService<IWifi>(
            gEnv->getServiceName<IWifi>());
    } else {
        return IWifi::getService(instance_name);
    }
}

sp<IWifiChip> getWifiChip(const std::string& instance_name) {
sp<IWifiChip> getWifiChip(const std::string& instance_name) {
    sp<IWifi> wifi = getWifi(instance_name);
    sp<IWifi> wifi = IWifi::getService(instance_name);
    if (!wifi.get()) {
    if (!wifi.get()) {
        return nullptr;
        return nullptr;
    }
    }
@@ -217,7 +202,7 @@ bool configureChipToSupportIfaceType(const sp<IWifiChip>& wifi_chip,
}
}


void stopWifi(const std::string& instance_name) {
void stopWifi(const std::string& instance_name) {
    sp<IWifi> wifi = getWifi(instance_name);
    sp<IWifi> wifi = IWifi::getService(instance_name);
    ASSERT_NE(wifi, nullptr);
    ASSERT_NE(wifi, nullptr);
    HIDL_INVOKE(wifi, stop);
    HIDL_INVOKE(wifi, stop);
}
}
+6 −17
Original line number Original line Diff line number Diff line
@@ -31,19 +31,16 @@
// Note: We only have a single instance of each of these objects currently.
// 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
// These helper functions should be modified to return vectors if we support
// multiple instances.
// multiple instances.
// TODO(b/143892896): Remove the default value as part of the cleanup.
android::sp<android::hardware::wifi::V1_0::IWifi> getWifi(
    const std::string& instance_name = "");
android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip(
android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip(
    const std::string& instance_name = "");
    const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface(
android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface(
    const std::string& instance_name = "");
    const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiNanIface> getWifiNanIface(
android::sp<android::hardware::wifi::V1_0::IWifiNanIface> getWifiNanIface(
    const std::string& instance_name = "");
    const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiP2pIface> getWifiP2pIface(
android::sp<android::hardware::wifi::V1_0::IWifiP2pIface> getWifiP2pIface(
    const std::string& instance_name = "");
    const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiStaIface> getWifiStaIface(
android::sp<android::hardware::wifi::V1_0::IWifiStaIface> getWifiStaIface(
    const std::string& instance_name = "");
    const std::string& instance_name);
// Configure the chip in a mode to support the creation of the provided
// Configure the chip in a mode to support the creation of the provided
// iface type.
// iface type.
bool configureChipToSupportIfaceType(
bool configureChipToSupportIfaceType(
@@ -51,12 +48,4 @@ bool configureChipToSupportIfaceType(
    android::hardware::wifi::V1_0::IfaceType type,
    android::hardware::wifi::V1_0::IfaceType type,
    android::hardware::wifi::V1_0::ChipModeId* configured_mode_id);
    android::hardware::wifi::V1_0::ChipModeId* configured_mode_id);
// Used to trigger IWifi.stop() at the end of every test.
// Used to trigger IWifi.stop() at the end of every test.
void stopWifi(const std::string& instance_name = "");
void stopWifi(const std::string& instance_name);

class WifiHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
   protected:
    virtual void HidlSetUp() override {
        stopWifi();
        sleep(5);
    }
};
Loading