• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2025 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 "daudio_handler_test.h"
17 
18 #include <cstdint>
19 #include <memory>
20 #include <vector>
21 
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace DistributedHardware {
SetUpTestCase(void)26 void DAudioHandlerTest::SetUpTestCase(void) {}
27 
TearDownTestCase(void)28 void DAudioHandlerTest::TearDownTestCase(void) {}
29 
SetUp(void)30 void DAudioHandlerTest::SetUp(void) {}
31 
TearDown(void)32 void DAudioHandlerTest::TearDown(void) {}
33 
34 /**
35  * @tc.name: Initialize_001
36  * @tc.desc: Verify the Initialize function.
37  * @tc.type: FUNC
38  * @tc.require: AR000H0E5F
39  */
40 HWTEST_F(DAudioHandlerTest, Initialize_001, TestSize.Level0)
41 {
42     int32_t actual = DAudioHandler::GetInstance().Initialize();
43     EXPECT_EQ(DH_SUCCESS, actual);
44 }
45 
46 /**
47  * @tc.name: QueryAudioInfo_001
48  * @tc.desc: Verify the QueryAudioInfo function.
49  * @tc.type: FUNC
50  * @tc.require: AR000H0E5F
51  */
52 HWTEST_F(DAudioHandlerTest, QueryAudioInfo_001, TestSize.Level0)
53 {
54     int32_t actual = DAudioHandler::GetInstance().QueryAudioInfo();
55     EXPECT_EQ(DH_SUCCESS, actual);
56 }
57 
58 /**
59  * @tc.name: Query_001
60  * @tc.desc: Verify the Query function.
61  * @tc.type: FUNC
62  * @tc.require: AR000H0E5F
63  */
64 HWTEST_F(DAudioHandlerTest, Query_001, TestSize.Level0)
65 {
66     int32_t actual = DAudioHandler::GetInstance().Query().size();
67     EXPECT_LE(DH_SUCCESS, actual);
68 }
69 
70 /**
71  * @tc.name: IsMimeSupported_001
72  * @tc.desc: Verify the IsMimeSupported function.
73  * @tc.type: FUNC
74  * @tc.require: AR000H0E5F
75  */
76 HWTEST_F(DAudioHandlerTest, IsMimeSupported_001, TestSize.Level0)
77 {
78     std::string coder = "AAAA";
79     bool isSupport = DAudioHandler::GetInstance().IsMimeSupported(coder);
80     EXPECT_EQ(false, isSupport);
81 }
82 
83 /**
84  * @tc.name: AddToVec_001
85  * @tc.desc: Verify the AddToVec function.
86  * @tc.type: FUNC
87  * @tc.require: AR000H0E5F
88  */
89 HWTEST_F(DAudioHandlerTest, AddToVec_001, TestSize.Level0)
90 {
91     std::vector<std::string> container;
92     std::string coder = "AAAA";
93     DAudioHandler::GetInstance().AddToVec(container, coder);
94     EXPECT_EQ(container.size(), 1);
95 }
96 } // namespace DistributedHardware
97 } // namespace OHOS