1 /*
2 * Copyright (c) 2023 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 #ifndef LOG_TAG
16 #define LOG_TAG "MultipleAudioCapturerUnitTest"
17 #endif
18
19 #include "multiple_audio_capturer_unit_test.h"
20 #include "audio_capturer.h"
21 #include "audio_errors.h"
22 #include "audio_info.h"
23
24 using namespace std;
25 using namespace testing::ext;
26
27 namespace OHOS {
28 namespace AudioStandard {
SetUpTestCase(void)29 void MultipleAudioCapturerUnitTest::SetUpTestCase(void) {}
TearDownTestCase(void)30 void MultipleAudioCapturerUnitTest::TearDownTestCase(void) {}
SetUp(void)31 void MultipleAudioCapturerUnitTest::SetUp(void) {}
TearDown(void)32 void MultipleAudioCapturerUnitTest::TearDown(void) {}
33
AudioCapUnitTestFunc(unique_ptr<AudioCapturer> & audioCapturer,shared_ptr<MultipleAudioCapturerCallbackTest> & cb,SourceType sourceType,bool isStarted)34 void MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(unique_ptr<AudioCapturer> &audioCapturer,
35 shared_ptr<MultipleAudioCapturerCallbackTest> &cb, SourceType sourceType, bool isStarted)
36 {
37 AudioCapturerOptions capturerOptions;
38 capturerOptions.streamInfo.samplingRate = AudioSamplingRate::SAMPLE_RATE_44100;
39 capturerOptions.streamInfo.encoding = AudioEncodingType::ENCODING_PCM;
40 capturerOptions.streamInfo.format = AudioSampleFormat::SAMPLE_U8;
41 capturerOptions.streamInfo.channels = AudioChannel::MONO;
42 capturerOptions.capturerInfo.sourceType = sourceType;
43 audioCapturer = AudioCapturer::Create(capturerOptions);
44 if (nullptr == audioCapturer) {
45 return ;
46 }
47
48 cb = make_shared<MultipleAudioCapturerCallbackTest>();
49 ASSERT_NE(nullptr, cb);
50 int32_t ret = audioCapturer->SetCapturerCallback(cb);
51 EXPECT_EQ(SUCCESS, ret);
52
53 bool startOK = audioCapturer->Start();
54 EXPECT_EQ(isStarted, startOK);
55
56 return;
57 }
58
TestUnitFunc(SourceType s1,SourceType s2,FOCUS_RULING exp1,SourceType s3,FOCUS_RULING exp2)59 void MultipleAudioCapturerUnitTest::TestUnitFunc(SourceType s1, SourceType s2, FOCUS_RULING exp1,
60 SourceType s3, FOCUS_RULING exp2)
61 {
62 constexpr uint32_t SLEEP_TIME = 300000;
63 unique_ptr<AudioCapturer> audioCapturer1 = nullptr;
64 shared_ptr<MultipleAudioCapturerCallbackTest> cb1 = nullptr;
65 unique_ptr<AudioCapturer> audioCapturer2 = nullptr;
66 shared_ptr<MultipleAudioCapturerCallbackTest> cb2 = nullptr;
67 unique_ptr<AudioCapturer> audioCapturer3 = nullptr;
68 shared_ptr<MultipleAudioCapturerCallbackTest> cb3 = nullptr;
69
70 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer1, cb1, s1);
71 if (exp1 == START_NORMAL) {
72 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer2, cb2, s2);
73 } else if (exp1 == START_FAIL) {
74 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer2, cb2, s2, false);
75 usleep(SLEEP_TIME);
76 EXPECT_EQ(INTERRUPT_HINT_STOP, cb2->GetInterruptEvent().hintType);
77 } else if (exp1 == STOP_CAP1) {
78 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer2, cb2, s2);
79 usleep(SLEEP_TIME);
80 EXPECT_EQ(INTERRUPT_HINT_STOP, cb1->GetInterruptEvent().hintType);
81 } else {
82 AUDIO_ERR_LOG("The input exp1 value exceeds the expected range.");
83 EXPECT_EQ(START_NORMAL, exp1);
84 }
85
86 if (exp2 == START_NORMAL) {
87 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer3, cb3, s3);
88 } else if (exp2 == START_FAIL) {
89 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer3, cb3, s3, false);
90 usleep(SLEEP_TIME);
91 EXPECT_EQ(INTERRUPT_HINT_STOP, cb3->GetInterruptEvent().hintType);
92 } else if (exp2 == STOP_CAP1) {
93 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer3, cb3, s3);
94 usleep(SLEEP_TIME);
95 EXPECT_EQ(INTERRUPT_HINT_STOP, cb1->GetInterruptEvent().hintType);
96 } else if (exp2 == STOP_CAP2) {
97 MultipleAudioCapturerUnitTest::AudioCapUnitTestFunc(audioCapturer3, cb3, s3);
98 usleep(SLEEP_TIME);
99 EXPECT_EQ(INTERRUPT_HINT_STOP, cb2->GetInterruptEvent().hintType);
100 } else {
101 AUDIO_ERR_LOG("The input exp2 value exceeds the expected range.");
102 EXPECT_EQ(START_NORMAL, exp1);
103 }
104
105 if (audioCapturer1 != nullptr) audioCapturer1->Release();
106 if (audioCapturer2 != nullptr) audioCapturer2->Release();
107 if (audioCapturer2 != nullptr) audioCapturer3->Release();
108 }
109
110 /**
111 * @tc.name : Test Multiple AudioCapturer Interrupt.
112 * @tc.number: Multiple_Audio_Capturer_001
113 * @tc.desc : Create three recording sources in sequence: MIC1, MIC2, and VOICE_RECOGNATION.
114 * Expected MIC1 source state is running, MIC2 source state is stoped,
115 * VOICE_RECOGNATION source state is stoped.
116 */
117 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_001, TestSize.Level1)
118 {
119 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC, SOURCE_TYPE_MIC, START_NORMAL,
120 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
121 }
122
123 /**
124 * @tc.name : Test Multiple AudioCapturer Interrupt.
125 * @tc.number: Multiple_Audio_Capturer_002
126 * @tc.desc : Create three recording sources in sequence: MIC, MIC2, and VOICE_COMMUNICATION.
127 * Expected MIC1 source state is stop, MIC2 source state is stoped,
128 * VOICE_COMMUNICATION source state is running.
129 */
130 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_002, TestSize.Level1)
131 {
132 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC, SOURCE_TYPE_MIC, START_NORMAL,
133 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
134 }
135
136 /**
137 * @tc.name : Test Multiple AudioCapturer Interrupt.
138 * @tc.number: Multiple_Audio_Capturer_004
139 * @tc.desc : Create three recording sources in sequence: MIC1, VOICE_RECOGNATION, and MIC2.
140 * Expected MIC source state is running, VOICE_RECOGNATION source state is stoped,
141 * MIC2 source state is stoped.
142 */
143 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_004, TestSize.Level1)
144 {
145 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL,
146 SOURCE_TYPE_MIC, START_NORMAL);
147 }
148
149 /**
150 * @tc.name : Test Multiple AudioCapturer Interrupt.
151 * @tc.number: Multiple_Audio_Capturer_005
152 * @tc.desc : Create three recording sources in sequence: MIC、 VOICE_RECOGNATION、VOICE_COMMUNICATION。
153 * Expected MIC source state is stoped, VOICE_RECOGNATION source state is stoped,
154 * VOICE_COMMUNICATION source state is running.
155 */
156 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_005, TestSize.Level1)
157 {
158 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL,
159 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
160 }
161
162 /**
163 * @tc.name : Test Multiple AudioCapturer Interrupt.
164 * @tc.number: Multiple_Audio_Capturer_007
165 * @tc.desc : Create three recording sources in sequence: MIC1、VOICE_COMMUNICATION、MIC2.
166 * Expected MIC1 source state is stoped, VOICE_COMMUNICATION source state is running,
167 * MIC2 source state is stoped.
168 */
169 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_007, TestSize.Level1)
170 {
171 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL,
172 SOURCE_TYPE_MIC, START_NORMAL);
173 }
174
175 /**
176 * @tc.name : Test Multiple AudioCapturer Interrupt.
177 * @tc.number: Multiple_Audio_Capturer_008
178 * @tc.desc : Create three recording sources in sequence: MIC、VOICE_COMMUNICATION、VOICE_RECOGNITION.
179 * Expected MIC source state is running, VOICE_COMMUNICATION source state is stoped,
180 * VOICE_RECOGNITION source state is stoped.
181 */
182 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_008, TestSize.Level1)
183 {
184 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL,
185 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
186 }
187
188 /**
189 * @tc.name : Test Multiple AudioCapturer Interrupt.
190 * @tc.number: Multiple_Audio_Capturer_013
191 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION1、VOICE_RECOGNITION2、MIC。
192 * Expected VOICE_RECOGNITION1 source state is running, VOICE_RECOGNITION2 source state is stoped,
193 * MIC source state is stoped.
194 */
195 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_013, TestSize.Level1)
196 {
197 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
198 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
199 }
200
201 /**
202 * @tc.name : Test Multiple AudioCapturer Interrupt.
203 * @tc.number: Multiple_Audio_Capturer_014
204 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION1、VOICE_RECOGNITION2、VOICE_COMMUNICATION。
205 * Expected VOICE_RECOGNITION1 source state is stoped, VOICE_RECOGNITION2 source state is stoped,
206 * VOICE_COMMUNICATION source state is running.
207 */
208 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_014, TestSize.Level1)
209 {
210 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
211 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
212 }
213
214 /**
215 * @tc.name : Test Multiple AudioCapturer Interrupt.
216 * @tc.number: Multiple_Audio_Capturer_016
217 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION1、MIC、VOICE_RECOGNITION2。
218 * Expected VOICE_RECOGNITION1 source state is running, MIC source state is stoped,
219 * VOICE_RECOGNITION2 source state is stoped.
220 */
221 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_016, TestSize.Level1)
222 {
223 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
224 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
225 }
226
227 /**
228 * @tc.name : Test Multiple AudioCapturer Interrupt.
229 * @tc.number: Multiple_Audio_Capturer_017
230 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION、MIC、VOICE_COMMUNICATION。
231 * Expected VOICE_RECOGNITION source state is stoped, MIC source state is stoped,
232 * VOICE_COMMUNICATION source state is running.
233 */
234 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_017, TestSize.Level1)
235 {
236 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
237 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
238 }
239
240 /**
241 * @tc.name : Test Multiple AudioCapturer Interrupt.
242 * @tc.number: Multiple_Audio_Capturer_019
243 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION、VOICE_COMMUNICATION、MIC。
244 * Expected VOICE_RECOGNITION source state is stoped, VOICE_COMMUNICATION source state is running,
245 * MIC source state is stoped.
246 */
247 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_019, TestSize.Level1)
248 {
249 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
250 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
251 }
252
253 /**
254 * @tc.name : Test Multiple AudioCapturer Interrupt.
255 * @tc.number: Multiple_Audio_Capturer_020
256 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION、VOICE_COMMUNICATION、VOICE_RECOGNITION。
257 * Expected VOICE_RECOGNITION source state is stoped, VOICE_COMMUNICATION source state is running,
258 * VOICE_RECOGNITION source state is stoped.
259 */
260 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_020, TestSize.Level1)
261 {
262 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
263 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
264 }
265
266 /**
267 * @tc.name : Test Multiple AudioCapturer Interrupt.
268 * @tc.number: Multiple_Audio_Capturer_025
269 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION1、VOICE_COMMUNICATION2、MIC。
270 * Expected VOICE_COMMUNICATION1 source state is running, VOICE_COMMUNICATION2 source state is stoped,
271 * MIC source state is stoped.
272 */
273 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_025, TestSize.Level1)
274 {
275 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
276 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
277 }
278
279 /**
280 * @tc.name : Test Multiple AudioCapturer Interrupt.
281 * @tc.number: Multiple_Audio_Capturer_026
282 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION1、VOICE_COMMUNICATION2、MIC。
283 * Expected VOICE_COMMUNICATION1 source state is running, VOICE_COMMUNICATION2 source state is stoped,
284 * MIC source state is stoped.
285 */
286 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_026, TestSize.Level1)
287 {
288 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
289 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
290 }
291
292 /**
293 * @tc.name : Test Multiple AudioCapturer Interrupt.
294 * @tc.number: Multiple_Audio_Capturer_028
295 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION、MIC、VOICE_RECOGNITION。
296 * Expected VOICE_COMMUNICATION source state is running, MIC source state is stoped,
297 * VOICE_RECOGNITION source state is stoped.
298 */
299 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_028, TestSize.Level1)
300 {
301 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
302 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
303 }
304
305 /**
306 * @tc.name : Test Multiple AudioCapturer Interrupt.
307 * @tc.number: Multiple_Audio_Capturer_029
308 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION1、MIC、VOICE_COMMUNICATION2。
309 * Expected VOICE_COMMUNICATION1 source state is running, MIC source state is stoped,
310 * VOICE_COMMUNICATION2 source state is stoped.
311 */
312 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_029, TestSize.Level1)
313 {
314 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
315 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
316 }
317
318 /**
319 * @tc.name : Test Multiple AudioCapturer Interrupt.
320 * @tc.number: Multiple_Audio_Capturer_031
321 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION、VOICE_RECOGNITION、MIC。
322 * Expected VOICE_COMMUNICATION source state is running, VOICE_RECOGNITION source state is stoped,
323 * MIC source state is stoped.
324 */
325 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_031, TestSize.Level1)
326 {
327 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
328 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
329 }
330
331 /**
332 * @tc.name : Test Multiple AudioCapturer Interrupt.
333 * @tc.number: Multiple_Audio_Capturer_032
334 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION1、VOICE_RECOGNITION、VOICE_COMMUNICATION2。
335 * Expected VOICE_COMMUNICATION1 source state is running, VOICE_RECOGNITION source state is stoped,
336 * VOICE_COMMUNICATION2 source state is stoped.
337 */
338 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_032, TestSize.Level1)
339 {
340 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
341 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
342 }
343
344 /**
345 * @tc.name : Test Multiple AudioCapturer Interrupt.
346 * @tc.number: Multiple_Audio_Capturer_049
347 * @tc.desc : Create three recording sources in sequence: MIC1, MIC2 and PLAYBACK_CAPTURE.
348 * Expected MIC1 source state is running, MIC2 source state is stoped,
349 * PLAYBACK_CAPTURE source state is running.
350 */
351 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_049, TestSize.Level1)
352 {
353 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC,
354 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
355 }
356
357 /**
358 * @tc.name : Test Multiple AudioCapturer Interrupt.
359 * @tc.number: Multiple_Audio_Capturer_050
360 * @tc.desc : Create three recording sources in sequence: MIC1, VOICE_RECOGNITION and PLAYBACK_CAPTURE.
361 * Expected MIC1 source state is running, VOICE_RECOGNITION source state is stoped,
362 * PLAYBACK_CAPTURE source state is running.
363 */
364 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_050, TestSize.Level1)
365 {
366 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC,
367 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
368 }
369
370 /**
371 * @tc.name : Test Multiple AudioCapturer Interrupt.
372 * @tc.number: Multiple_Audio_Capturer_051
373 * @tc.desc : Create three recording sources in sequence: MIC1, VOICE_COMMUNICATION and PLAYBACK_CAPTURE.
374 * Expected MIC1 source state is stoped, VOICE_COMMUNICATION source state is running,
375 * PLAYBACK_CAPTURE source state is running.
376 */
377 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_051, TestSize.Level1)
378 {
379 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC,
380 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
381 }
382
383 /**
384 * @tc.name : Test Multiple AudioCapturer Interrupt.
385 * @tc.number: Multiple_Audio_Capturer_053
386 * @tc.desc : Create three recording sources in sequence: MIC1、PLAYBACK_CAPTURE、MIC2。
387 * Expected MIC1 source state is running, PLAYBACK_CAPTURE source state is running,
388 * MIC2 source state is stoped.
389 */
390 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_053, TestSize.Level1)
391 {
392 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC,
393 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
394 }
395
396 /**
397 * @tc.name : Test Multiple AudioCapturer Interrupt.
398 * @tc.number: Multiple_Audio_Capturer_054
399 * @tc.desc : Create three recording sources in sequence: MIC、PLAYBACK_CAPTURE、VOICE_RECOGNITION。
400 * Expected MIC source state is running, PLAYBACK_CAPTURE source state is running,
401 * VOICE_RECOGNITION source state is stoped.
402 */
403 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_054, TestSize.Level1)
404 {
405 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC,
406 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
407 }
408
409 /**
410 * @tc.name : Test Multiple AudioCapturer Interrupt.
411 * @tc.number: Multiple_Audio_Capturer_055
412 * @tc.desc : Create three recording sources in sequence: MIC、PLAYBACK_CAPTURE、VOICE_COMMUNICATION。
413 * Expected MIC source state is running, PLAYBACK_CAPTURE source state is running,
414 * VOICE_COMMUNICATION source state is stoped.
415 */
416 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_055, TestSize.Level1)
417 {
418 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_MIC,
419 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
420 }
421
422 /**
423 * @tc.name : Test Multiple AudioCapturer Interrupt.
424 * @tc.number: Multiple_Audio_Capturer_057
425 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION1, VOICE_RECOGNITION2 and PLAYBACK_CAPTURE.
426 * Expected VOICE_RECOGNITION1 source state is running, VOICE_RECOGNITION2 source state is stoped,
427 * PLAYBACK_CAPTURE source state is running.
428 */
429 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_057, TestSize.Level1)
430 {
431 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
432 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
433 }
434
435 /**
436 * @tc.name : Test Multiple AudioCapturer Interrupt.
437 * @tc.number: Multiple_Audio_Capturer_058
438 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION, MIC and PLAYBACK_CAPTURE.
439 * Expected VOICE_RECOGNITION source state is running, MIC source state is stoped,
440 * PLAYBACK_CAPTURE source state is running.
441 */
442 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_058, TestSize.Level1)
443 {
444 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
445 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
446 }
447
448 /**
449 * @tc.name : Test Multiple AudioCapturer Interrupt.
450 * @tc.number: Multiple_Audio_Capturer_059
451 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION, VOICE_COMMUNICATION and PLAYBACK_CAPTURE.
452 * Expected VOICE_RECOGNITION source state is stoped, VOICE_COMMUNICATION source state is running,
453 * PLAYBACK_CAPTURE source state is running.
454 */
455 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_059, TestSize.Level1)
456 {
457 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
458 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
459 }
460
461 /**
462 * @tc.name : Test Multiple AudioCapturer Interrupt.
463 * @tc.number: Multiple_Audio_Capturer_061
464 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION、PLAYBACK_CAPTURE、MIC。
465 * Expected VOICE_RECOGNITION source state is running, PLAYBACK_CAPTURE source state is running,
466 * MIC source state is stoped.
467 */
468 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_061, TestSize.Level1)
469 {
470 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
471 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
472 }
473
474 /**
475 * @tc.name : Test Multiple AudioCapturer Interrupt.
476 * @tc.number: Multiple_Audio_Capturer_062
477 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION、PLAYBACK_CAPTURE、VOICE_RECOGNITION。
478 * Expected VOICE_RECOGNITION source state is running, PLAYBACK_CAPTURE source state is running,
479 * VOICE_RECOGNITION source state is stoped.
480 */
481 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_062, TestSize.Level1)
482 {
483 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
484 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
485 }
486
487 /**
488 * @tc.name : Test Multiple AudioCapturer Interrupt.
489 * @tc.number: Multiple_Audio_Capturer_063
490 * @tc.desc : Create three recording sources in sequence: VOICE_RECOGNITION、PLAYBACK_CAPTURE、VOICE_COMMUNICATION。
491 * Expected VOICE_RECOGNITION source state is running, PLAYBACK_CAPTURE source state is running,
492 * VOICE_COMMUNICATION source state is stoped.
493 */
494 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_063, TestSize.Level1)
495 {
496 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_RECOGNITION,
497 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
498 }
499
500 /**
501 * @tc.name : Test Multiple AudioCapturer Interrupt.
502 * @tc.number: Multiple_Audio_Capturer_065
503 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION1、VOICE_COMMUNICATION2、PLAYBACK_CAPTURE.
504 * Expected VOICE_COMMUNICATION1 source state is running, VOICE_COMMUNICATION2 source state is stoped,
505 * PLAYBACK_CAPTURE source state is running.
506 */
507 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_065, TestSize.Level1)
508 {
509 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
510 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
511 }
512
513 /**
514 * @tc.name : Test Multiple AudioCapturer Interrupt.
515 * @tc.number: Multiple_Audio_Capturer_066
516 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION, MIC and PLAYBACK_CAPTURE.
517 * Expected VOICE_COMMUNICATION source state is running, MIC source state is stoped,
518 * PLAYBACK_CAPTURE source state is running.
519 */
520 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_066, TestSize.Level1)
521 {
522 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
523 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
524 }
525
526 /**
527 * @tc.name : Test Multiple AudioCapturer Interrupt.
528 * @tc.number: Multiple_Audio_Capturer_067
529 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION, VOICE_RECOGNITION and PLAYBACK_CAPTURE.
530 * Expected VOICE_COMMUNICATION source state is running, VOICE_RECOGNITION source state is stoped,
531 * PLAYBACK_CAPTURE source state is running.
532 */
533 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_067, TestSize.Level1)
534 {
535 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
536 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
537 }
538
539 /**
540 * @tc.name : Test Multiple AudioCapturer Interrupt.
541 * @tc.number: Multiple_Audio_Capturer_069
542 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION、PLAYBACK_CAPTURE、MIC。
543 * Expected VOICE_COMMUNICATION source state is running, PLAYBACK_CAPTURE source state is running,
544 * MIC source state is stoped.
545 */
546 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_069, TestSize.Level1)
547 {
548 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
549 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
550 }
551
552 /**
553 * @tc.name : Test Multiple AudioCapturer Interrupt.
554 * @tc.number: Multiple_Audio_Capturer_070
555 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION、PLAYBACK_CAPTURE、VOICE_RECOGNITION。
556 * Expected VOICE_COMMUNICATION source state is running, PLAYBACK_CAPTURE source state is running,
557 * VOICE_RECOGNITION source state is stoped.
558 */
559 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_070, TestSize.Level1)
560 {
561 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
562 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
563 }
564
565 /**
566 * @tc.name : Test Multiple AudioCapturer Interrupt.
567 * @tc.number: Multiple_Audio_Capturer_071
568 * @tc.desc : Create three recording sources in sequence: VOICE_COMMUNICATION1、PLAYBACK_CAPTURE、VOICE_COMMUNICATION2。
569 * Expected VOICE_COMMUNICATION1 source state is running, PLAYBACK_CAPTURE source state is running,
570 * VOICE_COMMUNICATION2 source state is stoped.
571 */
572 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_071, TestSize.Level1)
573 {
574 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_VOICE_COMMUNICATION,
575 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
576 }
577
578 /**
579 * @tc.name : Test Multiple AudioCapturer Interrupt.
580 * @tc.number: Multiple_Audio_Capturer_081
581 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE1、PLAYBACK_CAPTURE2、MIC.
582 * Expected PLAYBACK_CAPTURE1 source state is running, PLAYBACK_CAPTURE2 source state is running,
583 * MIC source state is running.
584 */
585 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_081, TestSize.Level1)
586 {
587 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
588 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
589 }
590
591 /**
592 * @tc.name : Test Multiple AudioCapturer Interrupt.
593 * @tc.number: Multiple_Audio_Capturer_082
594 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE1、PLAYBACK_CAPTURE2、VOICE_RECOGNITION.
595 * Expected PLAYBACK_CAPTURE1 source state is running, PLAYBACK_CAPTURE2 source state is running,
596 * VOICE_RECOGNITION source state is running.
597 */
598 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_082, TestSize.Level1)
599 {
600 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
601 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
602 }
603
604 /**
605 * @tc.name : Test Multiple AudioCapturer Interrupt.
606 * @tc.number: Multiple_Audio_Capturer_083
607 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE1、PLAYBACK_CAPTURE2 and VOICE_COMMUNICATION.
608 * Expected PLAYBACK_CAPTURE1 source state is running, PLAYBACK_CAPTURE2 source state is running,
609 * VOICE_COMMUNICATION source state is running.
610 */
611 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_083, TestSize.Level1)
612 {
613 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
614 SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
615 }
616
617 /**
618 * @tc.name : Test Multiple AudioCapturer Interrupt.
619 * @tc.number: Multiple_Audio_Capturer_085
620 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE、MIC、VOICE_RECOGNITION。
621 * Expected PLAYBACK_CAPTURE source state is running, MIC source state is running,
622 * VOICE_RECOGNITION source state is stop.
623 */
624 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_085, TestSize.Level1)
625 {
626 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
627 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
628 }
629
630 /**
631 * @tc.name : Test Multiple AudioCapturer Interrupt.
632 * @tc.number: Multiple_Audio_Capturer_086
633 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE、MIC、VOICE_COMMUNICATION。
634 * Expected PLAYBACK_CAPTURE source state is running, MIC source state is stop,
635 * VOICE_COMMUNICATION source state is running.
636 */
637 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_086, TestSize.Level1)
638 {
639 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
640 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
641 }
642
643 /**
644 * @tc.name : Test Multiple AudioCapturer Interrupt.
645 * @tc.number: Multiple_Audio_Capturer_088
646 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE1、MIC、PLAYBACK_CAPTURE2。
647 * Expected PLAYBACK_CAPTURE1 source state is running, MIC source state is running,
648 * PLAYBACK_CAPTURE2 source state is running.
649 */
650 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_088, TestSize.Level1)
651 {
652 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
653 SOURCE_TYPE_MIC, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
654 }
655
656 /**
657 * @tc.name : Test Multiple AudioCapturer Interrupt.
658 * @tc.number: Multiple_Audio_Capturer_089
659 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE、VOICE_RECOGNITION、MIC。
660 * Expected PLAYBACK_CAPTURE source state is running, VOICE_RECOGNITION source state is running,
661 * MIC source state is stoped.
662 */
663 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_089, TestSize.Level1)
664 {
665 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
666 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
667 }
668
669 /**
670 * @tc.name : Test Multiple AudioCapturer Interrupt.
671 * @tc.number: Multiple_Audio_Capturer_090
672 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE、VOICE_RECOGNITION、VOICE_COMMUNICATION。
673 * Expected PLAYBACK_CAPTURE source state is running, VOICE_RECOGNITION source state is stoped,
674 * VOICE_COMMUNICATION source state is running.
675 */
676 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_090, TestSize.Level1)
677 {
678 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
679 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL);
680 }
681
682 /**
683 * @tc.name : Test Multiple AudioCapturer Interrupt.
684 * @tc.number: Multiple_Audio_Capturer_092
685 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE1、VOICE_RECOGNITION、PLAYBACK_CAPTURE2。
686 * Expected PLAYBACK_CAPTURE1 source state is running, VOICE_RECOGNITION source state is running,
687 * PLAYBACK_CAPTURE2 source state is running.
688 */
689 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_092, TestSize.Level1)
690 {
691 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
692 SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
693 }
694
695 /**
696 * @tc.name : Test Multiple AudioCapturer Interrupt.
697 * @tc.number: Multiple_Audio_Capturer_093
698 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE、VOICE_COMMUNICATION、MIC。
699 * Expected PLAYBACK_CAPTURE source state is running, VOICE_COMMUNICATION source state is running,
700 * MIC source state is stoped.
701 */
702 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_093, TestSize.Level1)
703 {
704 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
705 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_MIC, START_NORMAL);
706 }
707
708 /**
709 * @tc.name : Test Multiple AudioCapturer Interrupt.
710 * @tc.number: Multiple_Audio_Capturer_094
711 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE、VOICE_COMMUNICATION、VOICE_RECOGNITION。
712 * Expected PLAYBACK_CAPTURE source state is running, VOICE_COMMUNICATION source state is running,
713 * VOICE_RECOGNITION source state is stoped.
714 */
715 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_094, TestSize.Level1)
716 {
717 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
718 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_VOICE_RECOGNITION, START_NORMAL);
719 }
720
721 /**
722 * @tc.name : Test Multiple AudioCapturer Interrupt.
723 * @tc.number: Multiple_Audio_Capturer_096
724 * @tc.desc : Create three recording sources in sequence: PLAYBACK_CAPTURE1、VOICE_COMMUNICATION、PLAYBACK_CAPTURE2。
725 * Expected PLAYBACK_CAPTURE1 source state is running, VOICE_COMMUNICATION source state is running,
726 * PLAYBACK_CAPTURE2 source state is running.
727 */
728 HWTEST(MultipleAudioCapturerUnitTest, Multiple_Audio_Capturer_096, TestSize.Level1)
729 {
730 MultipleAudioCapturerUnitTest::TestUnitFunc(SOURCE_TYPE_PLAYBACK_CAPTURE,
731 SOURCE_TYPE_VOICE_COMMUNICATION, START_NORMAL, SOURCE_TYPE_PLAYBACK_CAPTURE, START_NORMAL);
732 }
733 } // namespace AudioStandard
734 } // namespace OHOS
735