• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 #include <hdf_log.h>
18 #include "../../../chip/hdi_service/wifi.h"
19 
20 using namespace testing::ext;
21 using namespace OHOS::HDI::Wlan::Chip::V2_0;
22 
23 namespace WifiTest {
24 class WifiTest : public testing::Test {
25 public:
SetUpTestCase()26     static void SetUpTestCase() {}
TearDownTestCase()27     static void TearDownTestCase() {}
SetUp()28     void SetUp()
29     {
30         wifiTest = std::make_shared<Wifi>();
31     }
TearDown()32     void TearDown()
33     {
34         wifiTest.reset();
35     }
36 
37 public:
38     std::shared_ptr<Wifi> wifiTest;
39 };
40 
41 /**
42  * @tc.name: IsInitTest
43  * @tc.desc: IsInit
44  * @tc.type: FUNC
45  * @tc.require:
46  */
47 HWTEST_F(WifiTest, IsInitTest, TestSize.Level1)
48 {
49     HDF_LOGI("IsInitTest started");
50     bool inited = true;
51     wifiTest->IsInit(inited);
52     EXPECT_FALSE(inited);
53     wifiTest->Init();
54     wifiTest->IsInit(inited);
55     EXPECT_TRUE(inited);
56 }
57 
58 /**
59  * @tc.name: GetAvailableChipsTest
60  * @tc.desc: GetAvailableChips
61  * @tc.type: FUNC
62  * @tc.require:
63  */
64 HWTEST_F(WifiTest, GetAvailableChipsTest, TestSize.Level1)
65 {
66     HDF_LOGI("GetAvailableChipsTest started");
67     std::vector<uint32_t> chipIds;
68     EXPECT_TRUE(wifiTest->GetAvailableChips(chipIds) == HDF_SUCCESS);
69 }
70 
71 /**
72  * @tc.name: IsInitTest
73  * @tc.desc: IsInit
74  * @tc.type: FUNC
75  * @tc.require:
76  */
77 HWTEST_F(WifiTest, ReleaseTest, TestSize.Level1)
78 {
79     HDF_LOGI("ReleaseTest started");
80     EXPECT_TRUE(wifiTest->Release() == HDF_SUCCESS);
81 }
82 }