1 /*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the P2pache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <android-base/logging.h>
18
19 #include <android/hardware/wifi/1.0/IWifi.h>
20 #include <android/hardware/wifi/1.0/IWifiP2pIface.h>
21 #include <gtest/gtest.h>
22 #include <hidl/GtestPrinter.h>
23 #include <hidl/ServiceManagement.h>
24
25 #include "wifi_hidl_test_utils.h"
26
27 using ::android::sp;
28 using ::android::hardware::wifi::V1_0::IWifi;
29 using ::android::hardware::wifi::V1_0::IWifiP2pIface;
30
31 /**
32 * Fixture to use for all P2P Iface HIDL interface tests.
33 */
34 class WifiP2pIfaceHidlTest : public ::testing::TestWithParam<std::string> {
35 public:
SetUp()36 virtual void SetUp() override {
37 // Make sure test starts with a clean state
38 stopWifi(GetInstanceName());
39 }
40
TearDown()41 virtual void TearDown() override { stopWifi(GetInstanceName()); }
42
43 protected:
GetInstanceName()44 std::string GetInstanceName() { return GetParam(); }
45 };
46
47 /*
48 * Create:
49 * Ensures that an instance of the IWifiP2pIface proxy object is
50 * successfully created.
51 */
TEST_P(WifiP2pIfaceHidlTest,Create)52 TEST_P(WifiP2pIfaceHidlTest, Create) {
53 stopWifi(GetInstanceName());
54 EXPECT_NE(nullptr, getWifiP2pIface(GetInstanceName()).get());
55 }
56
57 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiP2pIfaceHidlTest);
58 INSTANTIATE_TEST_SUITE_P(
59 PerInstance, WifiP2pIfaceHidlTest,
60 testing::ValuesIn(
61 android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
62 android::hardware::PrintInstanceNameToString);
63