1 /*
2 * Copyright (c) 2022 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_sink_dev_ctrl_manager_test.h"
17
18 using namespace testing::ext;
19 namespace OHOS {
20 namespace DistributedHardware {
SetUpTestCase(void)21 void DAudioSinkDevCtrlMgrTest::SetUpTestCase(void) {}
22
TearDownTestCase(void)23 void DAudioSinkDevCtrlMgrTest::TearDownTestCase(void) {}
24
SetUp(void)25 void DAudioSinkDevCtrlMgrTest::SetUp(void)
26 {
27 std::string networkId = "devId";
28 std::shared_ptr<IAudioEventCallback> audioEventCallback = nullptr;
29 sinkDevCtrl_ = std::make_shared<DAudioSinkDevCtrlMgr>(networkId, audioEventCallback);
30 }
31
TearDown(void)32 void DAudioSinkDevCtrlMgrTest::TearDown(void)
33 {
34 sinkDevCtrl_ = nullptr;
35 }
36
37 /**
38 * @tc.name: SetUp_001
39 * @tc.desc: Verify the SetUp function.
40 * @tc.type: FUNC
41 * @tc.require: AR000H0E5F
42 */
43
44 HWTEST_F(DAudioSinkDevCtrlMgrTest, SetUp_001, TestSize.Level1)
45 {
46 EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->SetUp());
47 }
48
49 /**
50 * @tc.name: Start_001
51 * @tc.desc: Verify the Start function.
52 * @tc.type: FUNC
53 * @tc.require: AR000H0E5F
54 */
55 HWTEST_F(DAudioSinkDevCtrlMgrTest, Start_001, TestSize.Level1)
56 {
57 EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->Start());
58 }
59
60 /**
61 * @tc.name: Stop_001
62 * @tc.desc: Verify the Stop function.
63 * @tc.type: FUNC
64 * @tc.require: AR000H0E5F
65 */
66 HWTEST_F(DAudioSinkDevCtrlMgrTest, Stop_001, TestSize.Level1)
67 {
68 EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->Stop());
69 }
70
71 /**
72 * @tc.name: Release_001
73 * @tc.desc: Verify the Release function.
74 * @tc.type: FUNC
75 * @tc.require: AR000H0E5F
76 */
77 HWTEST_F(DAudioSinkDevCtrlMgrTest, Release_001, TestSize.Level1)
78 {
79 EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->Release());
80 }
81
82 /**
83 * @tc.name: IsOpened_001
84 * @tc.desc: Verify the IsOpened function.
85 * @tc.type: FUNC
86 * @tc.require: AR000H0E5F
87 */
88 HWTEST_F(DAudioSinkDevCtrlMgrTest, IsOpened_001, TestSize.Level1)
89 {
90 EXPECT_EQ(true, sinkDevCtrl_->IsOpened());
91 }
92
93 /**
94 * @tc.name: SendAudioEvent_001
95 * @tc.desc: Verify the SendAudioEvent function.
96 * @tc.type: FUNC
97 * @tc.require: AR000H0E5F
98 */
99 HWTEST_F(DAudioSinkDevCtrlMgrTest, SendAudioEvent_001, TestSize.Level1)
100 {
101 AudioEvent event;
102 EXPECT_EQ(DH_SUCCESS, sinkDevCtrl_->SendAudioEvent(event));
103 }
104 } // namespace DistributedHardware
105 } // namespace OHOS
106