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

Commit 7666bf06 authored by Roshan Pius's avatar Roshan Pius Committed by android-build-merger
Browse files

Merge "wifi(tests): Unit tests for iface event cb's" into qt-dev am: 4ae7dd19

am: 37b6df0a

Change-Id: Ib35b4e4eccdbfd5881c51ad60fb7448d17796461
parents afe8867f 37b6df0a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -142,12 +142,14 @@ LOCAL_CPPFLAGS := -Wall -Werror -Wextra
LOCAL_SRC_FILES := \
    tests/hidl_struct_util_unit_tests.cpp \
    tests/main.cpp \
    tests/mock_interface_tool.cpp \
    tests/mock_wifi_feature_flags.cpp \
    tests/mock_wifi_iface_util.cpp \
    tests/mock_wifi_legacy_hal.cpp \
    tests/mock_wifi_mode_controller.cpp \
    tests/ringbuffer_unit_tests.cpp \
    tests/wifi_ap_iface_unit_tests.cpp \
    tests/wifi_nan_iface_unit_tests.cpp \
    tests/wifi_chip_unit_tests.cpp \
    tests/wifi_iface_util_unit_tests.cpp
LOCAL_STATIC_LIBRARIES := \
+4 −2
Original line number Diff line number Diff line
@@ -48,12 +48,14 @@ int main(int /*argc*/, char** argv) {

    configureRpcThreadpool(1, true /* callerWillJoin */);

    const auto iface_tool =
        std::make_shared<android::wifi_system::InterfaceTool>();
    // Setup hwbinder service
    android::sp<android::hardware::wifi::V1_3::IWifi> service =
        new android::hardware::wifi::V1_3::implementation::Wifi(
            std::make_shared<WifiLegacyHal>(),
            iface_tool, std::make_shared<WifiLegacyHal>(iface_tool),
            std::make_shared<WifiModeController>(),
            std::make_shared<WifiIfaceUtil>(),
            std::make_shared<WifiIfaceUtil>(iface_tool),
            std::make_shared<WifiFeatureFlags>());
    if (kLazyService) {
        LazyServiceRegistrar registrar;
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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 <android-base/macros.h>
#include <gmock/gmock.h>

#undef NAN  // This is weird, NAN is defined in bionic/libc/include/math.h:38
#include "mock_interface_tool.h"

namespace android {
namespace wifi_system {

MockInterfaceTool::MockInterfaceTool() {}

}  // namespace wifi_system
}  // namespace android
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.
 */

#ifndef MOCK_INTERFACE_TOOL_H
#define MOCK_INTERFACE_TOOL_H

#include <gmock/gmock.h>
#include <wifi_system/interface_tool.h>

namespace android {
namespace wifi_system {

class MockInterfaceTool : public InterfaceTool {
   public:
    MockInterfaceTool();

    MOCK_METHOD1(GetUpState, bool(const char* if_name));
    MOCK_METHOD2(SetUpState, bool(const char* if_name, bool request_up));
    MOCK_METHOD1(SetWifiUpState, bool(bool request_up));
    MOCK_METHOD2(SetMacAddress,
                 bool(const char* if_name,
                      const std::array<uint8_t, ETH_ALEN>& address));
    MOCK_METHOD1(GetFactoryMacAddress,
                 std::array<uint8_t, ETH_ALEN>(const char* if_name));

};  // class MockInterfaceTool

}  // namespace wifi_system
}  // namespace android

#endif  // MOCK_INTERFACE_TOOL_H
+3 −1
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@ namespace V1_3 {
namespace implementation {
namespace iface_util {

MockWifiIfaceUtil::MockWifiIfaceUtil() : WifiIfaceUtil() {}
MockWifiIfaceUtil::MockWifiIfaceUtil(
    const std::weak_ptr<wifi_system::InterfaceTool> iface_tool)
    : WifiIfaceUtil(iface_tool) {}
}  // namespace iface_util
}  // namespace implementation
}  // namespace V1_3
Loading