1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache 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 
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::hardware::wifi::V1_0::IWifi;
28 using ::android::sp;
29 
30 /**
31  * Fixture to use for all root Wifi HIDL interface tests.
32  */
33 class WifiHidlTest : public ::testing::TestWithParam<std::string> {
34    public:
SetUp()35     virtual void SetUp() override {
36         // Make sure test starts with a clean state
37         stopWifi(GetInstanceName());
38     }
39 
TearDown()40     virtual void TearDown() override { stopWifi(GetInstanceName()); }
41 
42    protected:
GetInstanceName()43     std::string GetInstanceName() { return GetParam(); }
44 };
45 
46 /*
47  * Create:
48  * Ensures that an instance of the IWifi proxy object is
49  * successfully created.
50  */
TEST_P(WifiHidlTest,Create)51 TEST_P(WifiHidlTest, Create) {
52     // The creation of a proxy object is tested as part of SetUp method.
53 }
54 
55 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiHidlTest);
56 INSTANTIATE_TEST_SUITE_P(
57     PerInstance, WifiHidlTest,
58     testing::ValuesIn(
59         android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
60     android::hardware::PrintInstanceNameToString);
61