1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 *
4 * HDF is dual licensed: you can use it either under the terms of
5 * the GPL, or the BSD license, at your option.
6 * See the LICENSE file in the root of this repository for complete details.
7 */
8
9 #include "audio_common_test.h"
10 #include <gtest/gtest.h>
11 #include "hdf_uhdf_test.h"
12
13 using namespace testing::ext;
14 namespace {
15 class AudioCoreTest : public testing::Test {
16 public:
17 static void SetUpTestCase();
18 static void TearDownTestCase();
19 void SetUp();
20 void TearDown();
21 };
22
SetUpTestCase()23 void AudioCoreTest::SetUpTestCase()
24 {
25 HdfTestOpenService();
26 }
27
TearDownTestCase()28 void AudioCoreTest::TearDownTestCase()
29 {
30 HdfTestCloseService();
31 }
32
SetUp()33 void AudioCoreTest::SetUp()
34 {
35 }
36
TearDown()37 void AudioCoreTest::TearDown()
38 {
39 }
40
41 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioDeviceReadReg, TestSize.Level1)
42 {
43 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIODEVICEREADREG, -1};
44 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
45 }
46
47 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioDeviceWriteReg, TestSize.Level1)
48 {
49 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIODEVICEWRITEREG, -1};
50 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
51 }
52
53 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioSocRegisterPlatform, TestSize.Level1)
54 {
55 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOSOCREGISTERPLATFORM, -1};
56 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
57 }
58
59 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioSocRegisterDai, TestSize.Level1)
60 {
61 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOSOCREGISTERDAI, -1};
62 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
63 }
64
65 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioRegisterDsp, TestSize.Level1)
66 {
67 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOREGISTERDSP, -1};
68 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
69 }
70
71 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioRegisterCodec, TestSize.Level1)
72 {
73 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOREGISTERCODEC, -1};
74 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
75 }
76
77 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioBindDaiLink, TestSize.Level1)
78 {
79 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOBINDDAILINK, -1};
80 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
81 }
82
83 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioUpdateCodecRegBits, TestSize.Level1)
84 {
85 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOUPDATECODECREGBITS, -1};
86 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
87 }
88
89 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioUpdateDaiRegBits, TestSize.Level1)
90 {
91 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOUPDATEDAIREGBITS, -1};
92 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
93 }
94
95 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioKcontrolGetCpuDai, TestSize.Level1)
96 {
97 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOKCONTROLGETCPUDAI, -1};
98 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
99 }
100
101 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioKcontrolGetCodec, TestSize.Level1)
102 {
103 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOKCONTROLGETCODEC, -1};
104 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
105 }
106
107 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioAddControls, TestSize.Level1)
108 {
109 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOADDCONTROLS, -1};
110 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
111 }
112
113 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioAddControl, TestSize.Level1)
114 {
115 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOADDCONTROL, -1};
116 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
117 }
118
119 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioGetCtrlOpsRReg, TestSize.Level1)
120 {
121 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOGETCTRLOPSRREG, -1};
122 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
123 }
124
125 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioGetCtrlOpsReg, TestSize.Level1)
126 {
127 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOGETCTRLOPSREG, -1};
128 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
129 }
130
131 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioSetCtrlOpsReg, TestSize.Level1)
132 {
133 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOSETCTRLOPSREG, -1};
134 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
135 }
136
137 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioSetCtrlOpsRReg, TestSize.Level1)
138 {
139 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOSETCTRLOPSRREG, -1};
140 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
141 }
142
143 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioDaiReadReg, TestSize.Level1)
144 {
145 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIODAIREADREG, -1};
146 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
147 }
148
149 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioDaiWriteReg, TestSize.Level1)
150 {
151 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIODAIWRITEREG, -1};
152 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
153 }
154
155 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioCodecReadReg, TestSize.Level1)
156 {
157 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOCODECREADREG, -1};
158 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
159 }
160
161 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioCodecWriteReg, TestSize.Level1)
162 {
163 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOCODECWRITEREG, -1};
164 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
165 }
166
167 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioInfoCtrlOps, TestSize.Level1)
168 {
169 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOINFOCTRLOPS, -1};
170 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
171 }
172
173 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioCodecGetCtrlOps, TestSize.Level1)
174 {
175 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOCODECGETCTRLOPS, -1};
176 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
177 }
178
179 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioCodecSetCtrlOps, TestSize.Level1)
180 {
181 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOCODECSETCTRLOPS, -1};
182 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
183 }
184
185 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioCpuDaiSetCtrlOps, TestSize.Level1)
186 {
187 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOCPUDAISETCTRLOPS, -1};
188 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
189 }
190
191 HWTEST_F(AudioCoreTest, AudioCoreTest_AudioCpuDaiGetCtrlOps, TestSize.Level1)
192 {
193 struct HdfTestMsg msg = {g_testAudioType, TEST_AUDIOCPUDAIGETCTRLOPS, -1};
194 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
195 }
196 }
197