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

Commit 0849bacc authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "wifi(vts): Add framework for gtests"

parents f5f75be7 1ae4cbbb
Loading
Loading
Loading
Loading
+50 −0
Original line number 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.
//

cc_test {
    name: "wifi_hidl_test",
    gtest: true,
    srcs: [
        "main.cpp",
        "wifi_ap_iface_hidl_test.cpp",
        "wifi_chip_hidl_test.cpp",
        "wifi_hidl_test.cpp",
        "wifi_hidl_test_utils.cpp",
        "wifi_nan_iface_hidl_test.cpp",
        "wifi_p2p_iface_hidl_test.cpp",
        "wifi_rtt_controller_hidl_test.cpp",
        "wifi_sta_iface_hidl_test.cpp"],
    shared_libs: [
        "libbase",
        "liblog",
        "libcutils",
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
        "libnativehelper",
        "libutils",
        "android.hardware.wifi@1.0",
    ],
    static_libs: ["libgtest"],
    cflags: [
        "--coverage",
        "-O0",
        "-g",
    ],
    ldflags: [
        "--coverage"
    ]
}
+19 −0
Original line number 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.
#

LOCAL_PATH := $(call my-dir)

include $(call all-subdir-makefiles)
+37 −0
Original line number 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 <android-base/logging.h>

#include <gtest/gtest.h>

#include "wifi_hidl_test_utils.h"

class WifiHidlEnvironment : public ::testing::Environment {
   public:
    virtual void SetUp() override { stopFramework(); }
    virtual void TearDown() override { startFramework(); }

   private:
};

int main(int argc, char** argv) {
    ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment);
    ::testing::InitGoogleTest(&argc, argv);
    int status = RUN_ALL_TESTS();
    LOG(INFO) << "Test result = " << status;
    return status;
}
+48 −0
Original line number 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 <android-base/logging.h>

#include <android/hardware/wifi/1.0/IWifiApIface.h>

#include <gtest/gtest.h>

#include "wifi_hidl_test_utils.h"

using ::android::hardware::wifi::V1_0::IWifiApIface;
using ::android::sp;

/**
 * Fixture to use for all AP Iface HIDL interface tests.
 */
class WifiApIfaceHidlTest : public ::testing::Test {
   public:
    virtual void SetUp() override {}

    virtual void TearDown() override { stopWifi(); }

   protected:
};

/*
 * Create:
 * Ensures that an instance of the IWifiApIface proxy object is
 * successfully created.
 */
TEST(WifiApIfaceHidlTestNoFixture, Create) {
    EXPECT_NE(nullptr, getWifiApIface().get());
    stopWifi();
}
+48 −0
Original line number 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 <android-base/logging.h>

#include <android/hardware/wifi/1.0/IWifiChip.h>

#include <gtest/gtest.h>

#include "wifi_hidl_test_utils.h"

using ::android::hardware::wifi::V1_0::IWifiChip;
using ::android::sp;

/**
 * Fixture to use for all Wifi chip HIDL interface tests.
 */
class WifiChipHidlTest : public ::testing::Test {
   public:
    virtual void SetUp() override {}

    virtual void TearDown() override { stopWifi(); }

   protected:
};

/*
 * Create:
 * Ensures that an instance of the IWifiChip proxy object is
 * successfully created.
 */
TEST(WifiChipHidlTestNoFixture, Create) {
    EXPECT_NE(nullptr, getWifiChip().get());
    stopWifi();
}
Loading