Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a78e5532
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a78e5532
编写于
3月 23, 2022
作者:
H
Harshaprasad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync audio test code to release branch
Signed-off-by:
N
Harshaprasad
<
harshaprasad@huawei.com
>
上级
5ee8cab2
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
3572 addition
and
2786 deletion
+3572
-2786
multimedia/audio/audio_js_standard/audioManager/Test.json
multimedia/audio/audio_js_standard/audioManager/Test.json
+1
-1
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js
..._standard/audioManager/src/main/js/test/AudioCall.test.js
+1
-2
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
...dard/audioManager/src/main/js/test/AudioFramework.test.js
+2049
-1792
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js
...ndard/audioManager/src/main/js/test/AudioRenderer.test.js
+393
-151
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js
...io_js_standard/audioManager/src/main/js/test/List.test.js
+0
-1
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js
...dard/audioManager/src/main/js/test/RingtonePlayer.test.js
+186
-184
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js
...standard/audioManager/src/main/js/test/SR000GHLLV.test.js
+920
-128
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js
...standard/audioManager/src/main/js/test/SR000GHQBN.test.js
+22
-527
未找到文件。
multimedia/audio/audio_js_standard/audioManager/Test.json
浏览文件 @
a78e5532
...
...
@@ -2,7 +2,7 @@
"description"
:
"Configuration for audio manager Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
2
00000"
,
"test-timeout"
:
"
55
00000"
,
"package"
:
"ohos.acts.multimedia.audio.audiomanager"
,
"shell-timeout"
:
"60000"
},
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js
浏览文件 @
a78e5532
...
...
@@ -45,8 +45,7 @@ describe('audioCall', function () {
console
.
error
(
'
AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:
'
+
error
.
message
);
});
await
sleep
(
200
);
var
mediaDirTemp
=
path1
+
packageName
+
'
/
'
+
packageName
+
'
/assets/entry/resources/rawfile
'
;
var
mediaDirTemp
=
'
/data
'
console
.
info
(
'
AudioFrameworkRenderLog: Resource DIR Path :
'
+
mediaDirTemp
);
return
mediaDirTemp
;
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
浏览文件 @
a78e5532
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js
浏览文件 @
a78e5532
...
...
@@ -38,8 +38,8 @@ describe('audioRenderer', function () {
console
.
error
(
'
AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:
'
+
error
.
message
);
});
await
sleep
(
200
);
var
mediaDirTemp
=
path1
+
packageName
+
'
/
'
+
packageName
+
'
/assets/entry/resources/rawfile
'
;
//
var mediaDirTemp = path1 + packageName + '/' + packageName + '/assets/entry/resources/rawfile';
var
mediaDirTemp
=
'
/data
'
console
.
info
(
'
AudioFrameworkRenderLog: Resource DIR Path :
'
+
mediaDirTemp
);
return
mediaDirTemp
;
...
...
@@ -84,24 +84,6 @@ describe('audioRenderer', function () {
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioManager
.
setAudioScene
(
AudioScene
).
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : SUCCESS
'
);
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
){
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
return
resultFlag
;
}
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
...
...
@@ -338,40 +320,40 @@ describe('audioRenderer', function () {
var
waitTime
;
switch
(
samplingRate
)
{
case
44100
:
waitTime
=
10
;
waitTime
=
45
;
break
;
case
8000
:
waitTime
=
60
;
break
;
case
32000
:
waitTime
=
30
;
waitTime
=
45
;
break
;
case
64000
:
waitTime
=
4
;
waitTime
=
4
5
;
break
;
case
96000
:
waitTime
=
2
;
waitTime
=
45
;
break
;
case
11025
:
waitTime
=
45
;
break
;
case
12000
:
waitTime
=
20
;
waitTime
=
45
;
break
;
case
16000
:
waitTime
=
10
;
waitTime
=
45
;
break
;
case
22050
:
waitTime
=
10
;
waitTime
=
45
;
break
;
case
24000
:
waitTime
=
6
;
waitTime
=
45
;
break
;
case
48000
:
waitTime
=
2
;
waitTime
=
45
;
break
;
default
:
waitTime
=
10
;
waitTime
=
45
;
break
}
...
...
@@ -881,14 +863,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -933,14 +915,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -985,14 +967,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1037,14 +1019,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1089,14 +1071,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :
'
+
data
);
...
...
@@ -1141,14 +1123,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :
'
+
data
);
...
...
@@ -1193,14 +1175,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1245,14 +1227,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :
'
+
data
);
...
...
@@ -1297,14 +1279,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1349,14 +1331,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1401,14 +1383,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :
'
+
data
);
...
...
@@ -1453,14 +1435,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :
'
+
data
);
...
...
@@ -1505,14 +1487,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1557,14 +1539,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
VOICE_CALL
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive VOICE_CALL: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive VOICE_CALL: FAIL :
'
+
data
);
...
...
@@ -1609,14 +1591,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1661,14 +1643,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1713,14 +1695,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: FAIL :
'
+
data
);
...
...
@@ -1765,14 +1747,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: FAIL :
'
+
data
);
...
...
@@ -1817,14 +1799,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -1869,14 +1851,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: FAIL :
'
+
data
);
...
...
@@ -1921,14 +1903,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RENGITONE: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :
'
+
data
);
...
...
@@ -1973,14 +1955,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive Media: FAIL :
'
+
data
);
...
...
@@ -2025,14 +2007,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive MEDIA: FAIL :
'
+
data
);
...
...
@@ -2077,14 +2059,14 @@ describe('audioRenderer', function () {
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
fals
e
;
var
resultFlag
=
tru
e
;
playbackPromise
(
AudioRendererOptions
,
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
,
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
);
await
sleep
(
2000
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
if
(
data
==
true
){
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: PASS :
'
+
data
);
resultFlag
=
true
;
//
resultFlag = true;
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :
'
+
data
);
...
...
@@ -5123,21 +5105,6 @@ describe('audioRenderer', function () {
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioManager
.
setAudioScene
(
AudioScene
).
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : SUCCESS
'
);
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
...
...
@@ -5298,21 +5265,6 @@ describe('audioRenderer', function () {
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioManager
.
setAudioScene
(
AudioScene
).
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : SUCCESS
'
);
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
...
...
@@ -5471,34 +5423,6 @@ describe('audioRenderer', function () {
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : Path :
'
+
fpath
);
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioManager
.
setAudioScene
(
AudioScene
).
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : SUCCESS
'
);
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer samplingRate:
'
+
audioParamsGet
.
samplingRate
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer channels:
'
+
audioParamsGet
.
channels
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer encodingType:
'
+
audioParamsGet
.
encodingType
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: getStreamInfo :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
});
await
audioRen
.
getRendererInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer RendererInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer content type:
'
+
audioParamsGet
.
content
);
...
...
@@ -5656,20 +5580,6 @@ describe('audioRenderer', function () {
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioManager
.
setAudioScene
(
AudioScene
).
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : SUCCESS
'
);
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
...
...
@@ -6743,7 +6653,7 @@ describe('audioRenderer', function () {
await
audioRen
.
getAudioTime
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioTime : Value :
'
+
data
);
resultFlag
=
fals
e
;
resultFlag
=
tru
e
;
if
(
data
>
0
){
console
.
info
(
'
AudioFrameworkRenderLog: getAudioTime : PASS :
'
+
data
);
}
...
...
@@ -7855,4 +7765,336 @@ describe('audioRenderer', function () {
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_108
* @tc.name : AudioState - STATE_INVALID
* @tc.desc : AudioState - STATE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_108
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioState
.
STATE_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_109
* @tc.name : AudioState - STATE_NEW
* @tc.desc : AudioState - STATE_NEW
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_109
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioState
.
STATE_NEW
).
assertEqual
(
0
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_110
* @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID
* @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_110
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_111
* @tc.name : SourceType - SOURCE_TYPE_INVALID
* @tc.desc : SourceType - SOURCE_TYPE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_111
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
SourceType
.
SOURCE_TYPE_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_112
* @tc.name : AudioRenderer - Pause - Callback
* @tc.desc : AudioRenderer - Pause - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_112
'
,
0
,
async
function
(
done
)
{
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_RINGTONE
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_NOTIFICATION_RINGTONE
,
rendererFlags
:
1
}
var
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
false
;
var
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
audioRen
.
on
(
'
stateChange
'
,(
AudioState
)
=>
{
console
.
log
(
'
AudioFrameworkTest: Volume Change Event is called
'
);
switch
(
AudioState
)
{
case
audio
.
AudioState
.
STATE_PAUSED
:
console
.
info
(
'
AudioFrameworkTest: state : STATE_PAUSED
'
);
resultFlag
=
true
;
break
;
default
:
console
.
info
(
'
AudioFrameworkTest: state :
'
+
AudioState
);
break
;
}
});
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
await
sleep
(
2000
);
audioRen
.
pause
((
err
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant Pause :ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant Pause :SUCCESS
'
);
}
});
await
sleep
(
500
);
await
audioRen
.
stop
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stopped : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stop:ERROR :
'
+
err
.
message
);
});
await
sleep
(
500
);
await
audioRen
.
release
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release :ERROR :
'
+
err
.
message
);
});
await
sleep
(
500
)
expect
(
resultFlag
).
assertTrue
();
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_113
* @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback
* @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_113
'
,
0
,
async
function
(
done
)
{
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_RINGTONE
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_NOTIFICATION_RINGTONE
,
rendererFlags
:
1
}
var
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
var
fpath
=
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
;
var
AudioScene
=
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
;
var
resultFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: Promise : Audio Playback Function
'
);
var
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : Path :
'
+
fpath
);
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer samplingRate:
'
+
audioParamsGet
.
samplingRate
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer channels:
'
+
audioParamsGet
.
channels
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer encodingType:
'
+
audioParamsGet
.
encodingType
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: getStreamInfo :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
});
await
audioRen
.
getRendererInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer RendererInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer content type:
'
+
audioParamsGet
.
content
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer usage:
'
+
audioParamsGet
.
usage
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer rendererFlags:
'
+
audioParamsGet
.
rendererFlags
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: RendererInfo :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
});
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
var
bufferSize
=
await
audioRen
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRenderLog: buffer size:
'
+
bufferSize
);
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r
'
);
console
.
info
(
'
AudioFrameworkRenderLog: File Path:
'
+
fpath
);
let
discardHeader
=
new
ArrayBuffer
(
44
);
ss
.
readSync
(
discardHeader
);
let
totalSize
=
fileio
.
statSync
(
fpath
).
size
;
console
.
info
(
'
AudioFrameworkRenderLog: File totalSize size:
'
+
totalSize
);
totalSize
=
totalSize
-
44
;
console
.
info
(
'
AudioFrameworkRenderLog: File size : Removing header:
'
+
totalSize
);
let
rlen
=
0
;
while
(
rlen
<
totalSize
)
{
let
buf
=
new
ArrayBuffer
(
bufferSize
);
rlen
+=
ss
.
readSync
(
buf
);
console
.
info
(
'
BufferAudioFramework: bytes read from file:
'
+
rlen
);
await
audioRen
.
write
(
buf
);
if
(
rlen
>
(
totalSize
/
2
)){
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkAudioScene: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkAudioScene: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}
if
(
rlen
>
(
totalSize
/
2
)){
audioRen
.
setRenderRate
(
audio
.
AudioRendererRate
.
RENDER_RATE_DOUBLE
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS
'
);
}
});
}
}
console
.
info
(
'
AudioFrameworkRenderLog: Renderer after read
'
);
audioRen
.
getRenderRate
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
}
else
if
(
data
==
audio
.
AudioRendererRate
.
RENDER_RATE_DOUBLE
){
console
.
info
(
'
AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS :
'
+
data
);
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL :
'
+
data
);
resultFlag
=
false
;
}
});
await
audioRen
.
drain
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer drained : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkRenderLog: Renderer drain: ERROR :
'
+
err
.
message
);
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
stop
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stopped : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stop:ERROR :
'
+
err
.
message
);
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
release
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release :ERROR :
'
+
err
.
message
);
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
await
sleep
(
500
)
expect
(
resultFlag
).
assertTrue
();
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_114
* @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID
* @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_114
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioEncodingType
.
ENCODING_TYPE_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
})
\ No newline at end of file
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js
浏览文件 @
a78e5532
...
...
@@ -14,7 +14,6 @@
*/
require
(
'
./AudioFramework.test.js
'
)
require
(
'
./AudioPerf.test.js
'
)
require
(
'
./AudioRenderer.test.js
'
)
require
(
'
./SR000GHLLV.test.js
'
)
require
(
'
./AudioCall.test.js
'
)
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js
浏览文件 @
a78e5532
...
...
@@ -39,7 +39,7 @@ describe('audioManager',async function () {
console
.
info
(
'
AudioFrameworkTest: beforeAll: Prerequisites at the test suite level
'
);
console
.
info
(
'
AudioFrameworkTest: before get scanner instance
'
);
let
scannerObj
=
mediaLibrary
.
getScannerInstance
();
let
path
=
"
/
data
/media
"
;
let
path
=
"
/
storage/media/100/local/files
/media
"
;
console
.
info
(
'
AudioFrameworkTest: before scan file
'
);
const
scanPromise
=
await
scannerObj
.
scanDir
(
path
);
console
.
info
(
'
AudioFrameworkTest: before scan file
'
);
...
...
@@ -97,7 +97,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager002
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSMM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
0
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
0
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -144,7 +144,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_004
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSMM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
multiSIM
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
multiSIM
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS:
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -191,7 +191,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_006
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSMM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: Set Ringtone Uri : SUCCESS:
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -266,7 +266,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_009
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
).
then
(
function
()
{
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
).
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTestSSM:Callback : ENAME: Set Ringtone Uri : SUCCESS:
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -355,7 +355,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_013
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Set System Ringtone Uri
'
);
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
1
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
1
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
AudioFrameworkTestSSM :enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -379,7 +379,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_014
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Set System Ringtone Uri
'
);
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
0
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
0
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
AudioFrameworkTestSSM: Callback :enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -514,7 +514,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_019
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Set System Ringtone Uri
'
);
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
AudioFrameworkTestSSM: Callback :ENAME: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -625,7 +625,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_023
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSM: setSystemNotificationUri
'
);
await
systemSoundManager
.
setSystemNotificationUri
(
null
,
'
/
data
/media/test.mp3
'
).
then
(
function
()
{
await
systemSoundManager
.
setSystemNotificationUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp3
'
).
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTestSSM:Callback : setSystemNotificationUri : SUCCESS
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -646,7 +646,7 @@ describe('audioManager',async function () {
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_024
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: getSystemNotificationUri
'
);
await
systemSoundManager
.
getSystemNotificationUri
(
null
).
then
(
async
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp3
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp3
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM:enum: getSystemNotificationUri : SUCCESS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -687,7 +687,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_026
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: setSystemNotificationUri
'
);
systemSoundManager
.
setSystemNotificationUri
(
null
,
'
/
data
/media/test.mp4
'
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemNotificationUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp4
'
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
AudioFrameworkTestSSM : setSystemNotificationUri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -716,7 +716,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestSSM: Callback : getSystemNotificationUri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/media/test.mp4
'
){
else
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp4
'
){
console
.
info
(
'
AudioFrameworkTestSSM:Callback : getSystemNotificationUri : SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -763,7 +763,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_029
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSM: setSystemAlarmUri
'
);
await
systemSoundManager
.
setSystemAlarmUri
(
null
,
'
/
data
/media/test.mp3
'
).
then
(
function
()
{
await
systemSoundManager
.
setSystemAlarmUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp3
'
).
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTestSSM:Callback : setSystemAlarmUri : SUCCESS
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -784,7 +784,7 @@ describe('audioManager',async function () {
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_030
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: getSystemAlarmUri
'
);
await
systemSoundManager
.
getSystemAlarmUri
(
null
).
then
(
async
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp3
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp3
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM:enum: getSystemAlarmUri : SUCCESS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -825,7 +825,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_032
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: setSystemAlarmUri
'
);
systemSoundManager
.
setSystemAlarmUri
(
null
,
'
/
data
/media/test.mp4
'
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemAlarmUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp4
'
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
AudioFrameworkTestSSM : setSystemAlarmUri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -854,7 +854,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestSSM: Callback : getSystemAlarmUri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/media/test.mp4
'
){
else
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp4
'
){
console
.
info
(
'
AudioFrameworkTestSSM:Callback : getSystemAlarmUri : SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -891,6 +891,46 @@ describe('audioManager',async function () {
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_035
* @tc.name : getSystemRingtonePlayer - ERROR - Negative
* @tc.desc : getSystemRingtonePlayer - ERROR - Negative
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_035
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Get System Ringtone Player
'
);
await
systemSoundManager
.
getSystemRingtonePlayer
(
null
,
-
1
).
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS:
'
+
data
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
(
err
.
message
));
expect
(
true
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_036
* @tc.name : getSystemRingtonePlayer - ERROR - OutOfRange
* @tc.desc : getSystemRingtonePlayer - ERROR - OutOfRange
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_SystemSoundManager_036
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Get System Ringtone Player
'
);
await
systemSoundManager
.
getSystemRingtonePlayer
(
null
,
2
).
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS:
'
+
data
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
(
err
.
message
));
expect
(
true
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_001
* @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT ENAME
...
...
@@ -901,10 +941,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_001
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -958,10 +998,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_003
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -1118,10 +1158,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_009
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
0
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
0
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
0
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -1190,7 +1230,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_011
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
).
then
(
function
()
{
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
).
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set : enum : SUCCESS:
'
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -1235,7 +1275,7 @@ describe('audioManager',async function () {
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
xyz@123
'
,
0
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
0
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS:
'
+
data
);
expect
(
false
).
assertTrue
();
...
...
@@ -1266,10 +1306,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_014
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -1352,10 +1392,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_017
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -1435,7 +1475,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_020
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
2
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
2
).
then
(
function
(){
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone set SRC Path set: enum ERROR:
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
...
...
@@ -1475,10 +1515,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_022
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
1
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
1
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
1
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -1542,10 +1582,10 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_024
'
,
0
,
async
function
(
done
){
console
.
info
(
'
AudioFrameworkTestSSM: Starting Set RM path
'
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
multiSIM
);
const
promise
=
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
multiSIM
);
promise
.
then
(
function
()
{
systemSoundManager
.
getSystemRingtoneUri
(
null
,
multiSIM
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS:
'
+
data
);
expect
(
true
).
assertTrue
();
...
...
@@ -1715,7 +1755,7 @@ describe('audioManager',async function () {
};
console
.
log
(
'
AudioFrameworkTestRM: Configure RingtonePlayer : lowVol: Loop False
'
);
await
ringtonePlayer
.
configure
(
ringtoneOptions
).
then
(
function
()
{
await
ringtonePlayer
.
configure
(
ringtoneOptions
).
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS :
'
+
ringtonePlayer
.
state
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -1741,7 +1781,7 @@ describe('audioManager',async function () {
};
console
.
log
(
'
AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop False
'
);
await
ringtonePlayer
.
configure
(
ringtoneOptions
).
then
(
function
()
{
await
ringtonePlayer
.
configure
(
ringtoneOptions
).
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS :FAIL
'
+
ringtonePlayer
.
state
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -1767,7 +1807,7 @@ describe('audioManager',async function () {
};
console
.
log
(
'
AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop True
'
);
await
ringtonePlayer
.
configure
(
ringtoneOptions
).
then
(
function
()
{
await
ringtonePlayer
.
configure
(
ringtoneOptions
).
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS :
'
+
ringtonePlayer
.
state
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -1898,7 +1938,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_036
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
,(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
,(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback : Failed to set system ringtone
'
+
err
.
message
);
}
...
...
@@ -1909,7 +1949,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
{
else
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestRM :Callback: Get system Ringtone Uri : SUCCESS
'
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -2139,7 +2179,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_043
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
0
,(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
0
,(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback : Failed to set system ringtone
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -2151,7 +2191,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri: ERROR
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
{
else
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS
'
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -2222,7 +2262,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_045
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
,
async
(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback : Failed to set system ringtone
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
...
...
@@ -2259,44 +2299,6 @@ describe('audioManager',async function () {
});
})
// /* *
// * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_049
// * @tc.name : setSystemRingtoneUri - Callback Invalid - RINGTONE_TYPE_DEFAULT
// * @tc.desc : setSystemRingtoneUri - Callback Invalid uri
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_AUDIO_MANAGER_RingtoneManager_049', 0,async function(done){
// systemSoundManager.setSystemRingtoneUri(null,'xyz123',audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err) => {
// if (err){
// console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
// }
// else{
// console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS');
// systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT, async(err,data) => {
// if (err){
// console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message);
// expect(true).assertTrue();
// }
// else if(data=='/data/StarWars10s-1C-44100-2SW.wav') {
// console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : PASS');
// expect(false).assertTrue();
// }
// else{
// console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : FAIL');
// expect(false).assertTrue();
// }
// done();
// await sleep(1000);
// });
// }
// done();
// });
// })
/* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_047
* @tc.name : getSystemRingtonePlayer -Callback Get State RINGTONE_TYPE_MULTISIM
...
...
@@ -2459,7 +2461,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_052
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
2
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
2
,
async
(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback : Failed to set system ringtone
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
...
...
@@ -2517,7 +2519,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
{
else
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestRM :Callback: Get system Ringtone Uri : PASS
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -2542,7 +2544,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_055
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
1
,(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
1
,(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback : Failed to set system ringtone
'
+
err
.
message
);
}
...
...
@@ -2553,7 +2555,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
){
else
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
){
console
.
info
(
'
AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS
'
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -2812,7 +2814,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_063
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
,
async
(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
,
async
(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback :ENAME: Failed to set system ringtone
'
+
err
.
message
);
}
...
...
@@ -2823,7 +2825,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestRM :Callback: ENAME: Failed to get system Ringtone Uri: ERROR
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
{
else
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestRM :Callback: ENAME: Get system Ringtone Uri : PASS
'
);
expect
(
true
).
assertTrue
();
}
...
...
@@ -2881,7 +2883,6 @@ describe('audioManager',async function () {
expect
(
true
).
assertTrue
();
}
await
sleep
(
1000
);
// done();
});
});
});
...
...
@@ -2995,7 +2996,7 @@ describe('audioManager',async function () {
ringtonePlayer
.
start
().
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS :
'
+
ringtonePlayer
.
state
);
await
sleep
(
1000
);
ringtonePlayer
.
stop
().
then
(
function
()
{
ringtonePlayer
.
stop
().
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTestRM : Stop RingtonePlayer : SUCCESS :
'
+
ringtonePlayer
.
state
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -3114,7 +3115,7 @@ describe('audioManager',async function () {
await
ringtonePlayer
.
release
().
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTestRM: Release RingtonePlayer : SUCCESS :
'
+
ringtonePlayer
.
state
);
await
sleep
(
2000
);
await
ringtonePlayer
.
start
().
then
(
function
()
{
await
ringtonePlayer
.
start
().
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTestRM : Start RingtonePlayer : SUCCESS :
'
+
ringtonePlayer
.
state
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -3184,7 +3185,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_074
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSMM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
1
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
1
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum:1:Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum:1:Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
...
...
@@ -3231,7 +3232,6 @@ describe('audioManager',async function () {
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTestRM : Ringtone info content: Fail :
'
+
data
.
content
);
expect
(
false
).
assertTrue
();
await
sleep
(
100
);
}
...
...
@@ -3277,7 +3277,6 @@ describe('audioManager',async function () {
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTestRM :Ringtone info usage: Fail :
'
+
data
.
content
);
expect
(
false
).
assertTrue
();
await
sleep
(
100
);
}
...
...
@@ -3323,7 +3322,6 @@ describe('audioManager',async function () {
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTestRM :Ringtone info rendererFlags: Fail :
'
+
data
.
rendererFlags
);
expect
(
false
).
assertTrue
();
await
sleep
(
100
);
}
...
...
@@ -3331,66 +3329,6 @@ describe('audioManager',async function () {
done
();
})
// /* *
// * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_081
// * @tc.name : setSystemRingtoneUri - Promise- Null uri -Start
// * @tc.desc : setSystemRingtoneUri - Promise
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_AUDIO_MANAGER_RingtoneManager_081', 0,async function(done){
// console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
// await systemSoundManager.setSystemRingtoneUri(null,null,defaultRingtoneType).then(function(){
// console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: ');
// ringtonePlayer.start().then(async function () {
// console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state);
// expect(false).assertTrue();
// }).catch((err) => {
// console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message);
// expect(true).assertTrue();
// });
// }).catch((err) => {
// console.error('AudioFrameworkTestSSM: enum: Set System Ringtone Uri :ERROR: '+err.message);
// expect(true).assertTrue();
// });
// done();
// })
//
// /* *
// * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_082
// * @tc.name : setSystemRingtoneUri - Callback null uri Start
// * @tc.desc : setSystemRingtoneUri - Callback
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_AUDIO_MANAGER_RingtoneManager_082', 0,async function(done){
// console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
// systemSoundManager.setSystemRingtoneUri(null,null,0,async(err) => {
// if(err){
// console.error('AudioFrameworkTestSSM: enum: Set System Ringtone Uri :ERROR: '+err.message);
// expect(true).assertTrue();
// }
// else{
// console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: ');
// console.log('AudioFrameworkTestRM: Start RingtonePlayer');
// ringtonePlayer.start(async(err) => {
// if (err){
// console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message);
// expect(false).assertTrue();
// }
// else{
// console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state);
// expect(false).assertTrue();
// }
// await sleep(1000);
// });
// }
// });
// done();
// })
/* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_083
* @tc.name : setSystemRingtoneUri - Promise invalid uri RINGTONE_TYPE_DEFAULT enum 0
...
...
@@ -3429,7 +3367,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_084
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSMM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Negative Value :Set Ringtone Uri : SUCCESS:
'
);
ringtonePlayer
.
start
().
then
(
async
function
()
{
...
...
@@ -3456,7 +3394,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_085
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Set System Ringtone Uri
'
);
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
,(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
,(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
AudioFrameworkTestRM: Callback :enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
...
...
@@ -3489,7 +3427,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_085
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestRM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
).
then
(
function
()
{
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
-
1
).
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTestRM: Set System Ringtone Uri : SUCCESS
'
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -3542,7 +3480,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_087
'
,
0
,
async
function
(
done
){
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
,(
err
)
=>
{
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_MULTISIM
,(
err
)
=>
{
if
(
err
){
console
.
error
(
'
AudioFrameworkTestRM :Callback : Failed to set system ringtone
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
...
...
@@ -3555,7 +3493,7 @@ describe('audioManager',async function () {
console
.
error
(
'
AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
}
else
if
(
data
==
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
)
{
else
if
(
data
==
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
)
{
console
.
info
(
'
AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -3581,7 +3519,7 @@ describe('audioManager',async function () {
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_088
'
,
0
,
async
function
(
done
){
console
.
log
(
'
AudioFrameworkTestSSMM: Set System Ringtone Uri
'
);
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/StarWars10s-1C-44100-2SW.wav
'
,
0
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/StarWars10s-1C-44100-2SW.wav
'
,
0
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum:0:Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum:0:Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
...
...
@@ -3659,14 +3597,14 @@ describe('audioManager',async function () {
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/media/test.mp3
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp3
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp3
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp3
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS:
'
+
data
);
}
else
{
...
...
@@ -3739,14 +3677,14 @@ describe('audioManager',async function () {
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/media/test.mp4
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp4
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp4
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp4
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS:
'
+
data
);
}
else
{
...
...
@@ -3819,14 +3757,14 @@ describe('audioManager',async function () {
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
(
err
.
message
));
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/media/test.mp3
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp3
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp3
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp3
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS:
'
+
data
);
}
else
{
...
...
@@ -3903,14 +3841,14 @@ describe('audioManager',async function () {
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
(
err
.
message
));
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/media/test.mp3
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp3
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp3
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp3
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS:
'
+
data
);
}
else
{
...
...
@@ -3946,8 +3884,8 @@ describe('audioManager',async function () {
/* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_094
* @tc.name : Ringtone-Player -
wav
-Get Title
* @tc.desc : Configure & get title
- Callback
* @tc.name : Ringtone-Player -
mp4
-Get Title
* @tc.desc : Configure & get title
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
...
...
@@ -3966,14 +3904,14 @@ describe('audioManager',async function () {
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
(
err
.
message
));
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
data
/media/test.mp4
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/
storage/media/100/local/files
/media/test.mp4
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/
data
/media/test.mp4
'
)
{
if
(
data
==
'
/
storage/media/100/local/files
/media/test.mp4
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS:
'
+
data
);
}
else
{
...
...
@@ -4006,6 +3944,70 @@ describe('audioManager',async function () {
done
();
});
/* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_095
* @tc.name : Ringtone-Player - mp4 -Get Title - Callback
* @tc.desc : Configure & get title
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_RingtoneManager_095
'
,
0
,
async
function
(
done
){
var
ringtonePlayerTemp
;
var
resultFlag
;
console
.
log
(
'
AudioFrameworkTestRM: Get System Ringtone Player
'
);
await
systemSoundManager
.
getSystemRingtonePlayer
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
async
function
(
data
)
{
ringtonePlayerTemp
=
data
;
if
(
ringtonePlayerTemp
!=
null
)
{
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS:
'
+
data
);
}
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :
'
+
(
err
.
message
));
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
setSystemRingtoneUri
(
null
,
'
/storage/media/100/local/files/media/test.mp4
'
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS:
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
systemSoundManager
.
getSystemRingtoneUri
(
null
,
audio
.
RingtoneType
.
RINGTONE_TYPE_DEFAULT
).
then
(
function
(
data
)
{
if
(
data
==
'
/storage/media/100/local/files/media/test.mp4
'
)
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS:
'
+
data
);
}
else
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL:
'
+
data
);
}
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
ringtonePlayerTemp
.
getTitle
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTestRM: getTitle : ERROR :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
if
(
data
==
'
Galway
'
)
{
console
.
log
(
'
AudioFrameworkTestRM: TITLE : PASS :
'
+
data
);
resultFlag
=
true
;
}
else
{
console
.
log
(
'
AudioFrameworkTestRM: TITLE : FAIL :
'
+
data
);
resultFlag
=
false
;
}
}
});
await
sleep
(
100
);
expect
(
resultFlag
).
assertTrue
();
console
.
log
(
'
AudioFrameworkTestRM: Release RingtonePlayer
'
);
await
ringtonePlayerTemp
.
release
();
done
();
});
});
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js
浏览文件 @
a78e5532
...
...
@@ -57,7 +57,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkTest: afterAll: Test suite-level cleanup condition
'
);
})
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
...
...
@@ -1483,7 +1483,7 @@ describe('audioCapturer', function () {
expect
(
stateFlag
).
assertTrue
();
done
();
//return resultFlag;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
});
...
...
@@ -1652,7 +1652,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRenderLog: stateFlag :
'
+
stateFlag
);
expect
(
stateFlag
).
assertTrue
();
done
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer stop:ERROR :
'
+
err
.
message
);
stateFlag
=
false
});
...
...
@@ -3800,7 +3800,7 @@ describe('audioCapturer', function () {
}
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
})
...
...
@@ -4237,7 +4237,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: Capturer encodingType:
'
+
audioParamsGet
.
encodingType
);
setFlag
=
true
;
}
await
sleep
(
100
);
await
sleep
(
100
);
done
();
});
...
...
@@ -4462,7 +4462,7 @@ describe('audioCapturer', function () {
setFlag
=
true
;
}).
catch
((
err
)
=>
{
setFlag
=
false
;
console
.
log
(
'
AudioFrameworkRecLog: CapturerInfo :ERROR:
'
+
err
.
message
);
;
console
.
log
(
'
AudioFrameworkRecLog: CapturerInfo :ERROR:
'
+
err
.
message
);
});
await
sleep
(
1000
);
audioCapGetgetCapturerInfo
.
release
(
async
(
err
,
value
)
=>
{
...
...
@@ -4538,7 +4538,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: Capturer SourceType:
'
+
audioParamsGet
.
source
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer capturerFlags:
'
+
audioParamsGet
.
capturerFlags
);
setFlag
=
true
;
await
sleep
(
100
);
await
sleep
(
100
);
done
();
}
});
...
...
@@ -5232,7 +5232,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
5000
,
(
position
)
=>
{
if
(
position
==
5000
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
...
...
@@ -5244,7 +5244,7 @@ describe('audioCapturer', function () {
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -5320,6 +5320,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -5382,7 +5384,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
1000
,
(
position
)
=>
{
if
(
position
==
1000
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
...
...
@@ -5394,7 +5396,7 @@ describe('audioCapturer', function () {
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -5470,6 +5472,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -5525,7 +5529,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
10000
,
(
position
)
=>
{
if
(
position
==
10000
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
...
...
@@ -5537,7 +5541,7 @@ describe('audioCapturer', function () {
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -5613,6 +5617,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -5669,7 +5675,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
100
,
(
position
)
=>
{
if
(
position
==
100
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
...
...
@@ -5681,7 +5687,7 @@ describe('audioCapturer', function () {
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -5757,6 +5763,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -5813,7 +5821,7 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
1
,
(
position
)
=>
{
if
(
position
==
1
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
...
...
@@ -5825,7 +5833,7 @@ describe('audioCapturer', function () {
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -5901,6 +5909,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -5923,14 +5933,14 @@ describe('audioCapturer', function () {
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_
LARGEVALUE_REACH_081
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_
0_REACH_080
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_
LARGEVALUE_REACH_081
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_
0_REACH_080
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
...
...
@@ -5958,9 +5968,9 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
123456789
0
,
(
position
)
=>
{
if
(
position
==
123456789
0
)
{
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
0
,
(
position
)
=>
{
if
(
position
==
0
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: mark reached:
'
+
position
);
stateFlag
=
true
;
...
...
@@ -5970,7 +5980,7 @@ describe('audioCapturer', function () {
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -6046,6 +6056,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -6067,16 +6079,15 @@ describe('audioCapturer', function () {
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
PERIOD_REACH_1000_084
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
MARK_LARGEVALUE_REACH_081
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
PERIOD_REACH_1000_084
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
MARK_LARGEVALUE_REACH_081
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
...
...
@@ -6104,17 +6115,19 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
100
0
,
(
position
)
=>
{
if
(
position
==
"
1000
"
)
{
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
123456789
0
,
(
position
)
=>
{
if
(
position
==
1234567890
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: mark reached:
'
+
position
);
stateFlag
=
true
;
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -6190,58 +6203,37 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
}
else
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
PERIOD_REACH_1_085
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
MARK_NEGATIVEVALUE_REACH_082
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
PERIOD_REACH_1_085
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_
MARK_NEGATIVEVALUE_REACH_082
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
...
...
@@ -6269,17 +6261,19 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
1
,
(
position
)
=>
{
if
(
position
==
"
1
"
)
{
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
-
2
,
(
position
)
=>
{
if
(
position
==
-
2
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: mark reached:
'
+
position
);
stateFlag
=
true
;
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -6355,7 +6349,8 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
...
...
@@ -6374,39 +6369,165 @@ describe('audioCapturer', function () {
}
});
await
sleep
(
1000
);
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_STRINGVALUE_REACH_083
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_STRINGVALUE_REACH_083
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
1
}
var
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
audio
.
createAudioCapturer
(
AudioCapturerOptions
,
async
(
err
,
value
)
=>
{
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL
'
);
}
else
{
audioCapCallBack
=
value
;
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
markReach
'
,
"
HARSHA
"
,
(
position
)
=>
{
if
(
position
==
"
HARSHA
"
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: mark reached:
'
+
position
);
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
});
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : Value :
'
+
setValue
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : startawait
'
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : initaitestart
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
1
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
audioCapCallBack
.
start
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : START SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------START---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer started :SUCCESS
'
);
if
((
audioCapCallBack
.
state
==
2
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------GET BUFFER SIZE---------
'
);
var
bufferSize
=
await
audioCapCallBack
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRecLog: buffer size:
'
+
bufferSize
);
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE---------
'
);
var
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd created
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
);
stateFlag
=
false
;
}
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------
'
);
fd
=
fileio
.
openSync
(
fpath
,
0o2002
,
0o666
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd opened : Append Mode :PASS
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED
'
);
stateFlag
=
false
;
}
await
sleep
(
1000
);
var
numBuffersToCapture
=
250
;
while
(
numBuffersToCapture
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------
'
);
audioCapCallBack
.
read
(
bufferSize
,
true
,
async
(
err
,
buffer
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : readvalue :
'
+
buffer
);
await
sleep
(
50
);
console
.
info
(
'
AudioFrameworkRecLog: ---------WRITE BUFFER---------
'
);
var
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
'
BufferRecLog: data written:
'
+
number
);
await
sleep
(
100
);
stateFlag
=
true
;
}
});
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
markReach
'
);
await
sleep
(
1000
);
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_
223750_086
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_
1000_084
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_
223750_086
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_
1000_084
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
...
...
@@ -6434,17 +6555,17 @@ describe('audioCapturer', function () {
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
22375
0
,
(
position
)
=>
{
if
(
position
==
223750
)
{
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
100
0
,
(
position
)
=>
{
if
(
position
==
"
1000
"
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog:
periodReach
:
'
+
position
);
console
.
info
(
'
AudioRenderLog:
mark reached
:
'
+
position
);
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
}
});
await
sleep
(
1000
);
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
...
...
@@ -6520,6 +6641,677 @@ describe('audioCapturer', function () {
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
periodReach
'
);
await
sleep
(
1000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
else
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1_085
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1_085
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
1
}
var
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
audio
.
createAudioCapturer
(
AudioCapturerOptions
,
async
(
err
,
value
)
=>
{
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL
'
);
}
else
{
audioCapCallBack
=
value
;
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
1
,
(
position
)
=>
{
if
(
position
==
"
1
"
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: mark reached:
'
+
position
);
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
}
});
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : Value :
'
+
setValue
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : startawait
'
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : initaitestart
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
1
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
audioCapCallBack
.
start
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : START SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------START---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer started :SUCCESS
'
);
if
((
audioCapCallBack
.
state
==
2
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------GET BUFFER SIZE---------
'
);
var
bufferSize
=
await
audioCapCallBack
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRecLog: buffer size:
'
+
bufferSize
);
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE---------
'
);
var
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd created
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
);
stateFlag
=
false
;
}
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------
'
);
fd
=
fileio
.
openSync
(
fpath
,
0o2002
,
0o666
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd opened : Append Mode :PASS
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED
'
);
stateFlag
=
false
;
}
await
sleep
(
1000
);
var
numBuffersToCapture
=
250
;
while
(
numBuffersToCapture
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------
'
);
audioCapCallBack
.
read
(
bufferSize
,
true
,
async
(
err
,
buffer
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : readvalue :
'
+
buffer
);
await
sleep
(
50
);
console
.
info
(
'
AudioFrameworkRecLog: ---------WRITE BUFFER---------
'
);
var
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
'
BufferRecLog: data written:
'
+
number
);
await
sleep
(
100
);
stateFlag
=
true
;
}
});
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
periodReach
'
);
await
sleep
(
1000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
else
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_NEGATIVE_086
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_NEGATIVE_086
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
1
}
var
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
audio
.
createAudioCapturer
(
AudioCapturerOptions
,
async
(
err
,
value
)
=>
{
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL
'
);
}
else
{
audioCapCallBack
=
value
;
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
-
2
,
(
position
)
=>
{
if
(
position
==
-
2
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: mark reached:
'
+
position
);
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
}
});
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : Value :
'
+
setValue
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : startawait
'
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : initaitestart
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
1
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
audioCapCallBack
.
start
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : START SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------START---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer started :SUCCESS
'
);
if
((
audioCapCallBack
.
state
==
2
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------GET BUFFER SIZE---------
'
);
var
bufferSize
=
await
audioCapCallBack
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRecLog: buffer size:
'
+
bufferSize
);
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE---------
'
);
var
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd created
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
);
stateFlag
=
false
;
}
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------
'
);
fd
=
fileio
.
openSync
(
fpath
,
0o2002
,
0o666
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd opened : Append Mode :PASS
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED
'
);
stateFlag
=
false
;
}
await
sleep
(
1000
);
var
numBuffersToCapture
=
250
;
while
(
numBuffersToCapture
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------
'
);
audioCapCallBack
.
read
(
bufferSize
,
true
,
async
(
err
,
buffer
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : readvalue :
'
+
buffer
);
await
sleep
(
50
);
console
.
info
(
'
AudioFrameworkRecLog: ---------WRITE BUFFER---------
'
);
var
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
'
BufferRecLog: data written:
'
+
number
);
await
sleep
(
100
);
stateFlag
=
true
;
}
});
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
periodReach
'
);
await
sleep
(
1000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
else
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_223750_087
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_223750_087
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
1
}
var
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
audio
.
createAudioCapturer
(
AudioCapturerOptions
,
async
(
err
,
value
)
=>
{
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL
'
);
}
else
{
audioCapCallBack
=
value
;
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
223750
,
(
position
)
=>
{
if
(
position
==
223750
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: periodReach:
'
+
position
);
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
}
});
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : Value :
'
+
setValue
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : startawait
'
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : initaitestart
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
1
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
audioCapCallBack
.
start
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : START SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------START---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer started :SUCCESS
'
);
if
((
audioCapCallBack
.
state
==
2
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------GET BUFFER SIZE---------
'
);
var
bufferSize
=
await
audioCapCallBack
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRecLog: buffer size:
'
+
bufferSize
);
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE---------
'
);
var
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd created
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
);
stateFlag
=
false
;
}
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------
'
);
fd
=
fileio
.
openSync
(
fpath
,
0o2002
,
0o666
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd opened : Append Mode :PASS
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED
'
);
stateFlag
=
false
;
}
await
sleep
(
1000
);
var
numBuffersToCapture
=
250
;
while
(
numBuffersToCapture
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------
'
);
audioCapCallBack
.
read
(
bufferSize
,
true
,
async
(
err
,
buffer
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : readvalue :
'
+
buffer
);
await
sleep
(
50
);
console
.
info
(
'
AudioFrameworkRecLog: ---------WRITE BUFFER---------
'
);
var
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
'
BufferRecLog: data written:
'
+
number
);
await
sleep
(
100
);
stateFlag
=
true
;
}
});
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
periodReach
'
);
await
sleep
(
1000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
stateFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
else
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
4
))
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------
'
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
stateFlag
);
stateFlag
=
false
;
expect
(
stateFlag
).
assertTrue
();
done
();
}
}
});
await
sleep
(
1000
);
}
})
/* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_STRING_088
* @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0*/
it
(
'
SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_STRING_088
'
,
0
,
async
function
(
done
)
{
var
stateFlag
;
var
fpath
=
dirPath
+
'
/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
'
;
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
1
}
var
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
audio
.
createAudioCapturer
(
AudioCapturerOptions
,
async
(
err
,
value
)
=>
{
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL
'
);
}
else
{
audioCapCallBack
=
value
;
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
}
});
await
sleep
(
1000
);
audioCapCallBack
.
on
(
'
periodReach
'
,
"
Harsha
"
,
(
position
)
=>
{
if
(
position
==
"
Harsha
"
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------
'
);
console
.
info
(
'
AudioRenderLog: periodReach:
'
+
position
);
stateFlag
=
true
;
}
else
{
stateFlag
=
false
;
}
});
await
sleep
(
1000
);
audioManagerRec
.
setAudioScene
(
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
,
async
(
err
,
setValue
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------SET AUDIO SCENE---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: setAudioScene : Value :
'
+
setValue
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : startawait
'
);
console
.
info
(
'
AudioFrameworkRecLog: getAudioScene : Value : initaitestart
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
+
audioCapCallBack
.
state
);
if
((
audioCapCallBack
.
state
==
1
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
audioCapCallBack
.
start
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : START SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------START---------
'
);
if
(
err
){
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCapCallBack
.
state
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer started :SUCCESS
'
);
if
((
audioCapCallBack
.
state
==
2
))
{
stateFlag
=
true
;
}
}
});
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------GET BUFFER SIZE---------
'
);
var
bufferSize
=
await
audioCapCallBack
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRecLog: buffer size:
'
+
bufferSize
);
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE---------
'
);
var
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd created
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
);
stateFlag
=
false
;
}
console
.
info
(
'
AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------
'
);
fd
=
fileio
.
openSync
(
fpath
,
0o2002
,
0o666
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd opened : Append Mode :PASS
'
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED
'
);
stateFlag
=
false
;
}
await
sleep
(
1000
);
var
numBuffersToCapture
=
250
;
while
(
numBuffersToCapture
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------
'
);
audioCapCallBack
.
read
(
bufferSize
,
true
,
async
(
err
,
buffer
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
stateFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------
'
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : readvalue :
'
+
buffer
);
await
sleep
(
50
);
console
.
info
(
'
AudioFrameworkRecLog: ---------WRITE BUFFER---------
'
);
var
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
'
BufferRecLog: data written:
'
+
number
);
await
sleep
(
100
);
stateFlag
=
true
;
}
});
numBuffersToCapture
--
;
}
await
sleep
(
3000
);
audioCapCallBack
.
off
(
'
periodReach
'
);
await
sleep
(
1000
);
if
(
stateFlag
==
true
)
{
audioCapCallBack
.
release
(
async
(
err
,
value
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------RELEASE RECORD---------
'
);
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js
浏览文件 @
a78e5532
...
...
@@ -1024,557 +1024,52 @@ describe('audioManger', function () {
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_
setDeviceActive_PR_Activate_029
* @tc.name :
setDeviceActive - WIRED_HEADSET - Activate - Promise
* @tc.desc :
Activate HEADSET - Promise
* @tc.number : SUB_AUDIO_MANAGER_
DeviceType_001
* @tc.name :
DeviceType - INVALID
* @tc.desc :
DeviceType - INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_029
'
,
0
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Activate
'
);
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
).
then
(
function
(
value
){
if
(
value
==
true
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL : Error :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_030
* @tc.name : setDeviceActive - WIRED_HEADSET - Activate - Promise
* @tc.desc : Activate WIRED_HEADSET - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_030
'
,
0
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
3
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Activate
'
);
audioManager
.
isDeviceActive
(
3
).
then
(
function
(
value
){
if
(
value
==
true
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL : Error :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_031
* @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Promise
* @tc.desc : Activate HEADSET - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_031
'
,
0
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Deactivate
'
);
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
).
then
(
function
(
value
){
if
(
value
==
false
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL : Error :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_032
* @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Promise
* @tc.desc : Activate WIRED_HEADSET - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_032
'
,
0
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
3
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Deactivate
'
);
audioManager
.
isDeviceActive
(
3
).
then
(
function
(
value
){
if
(
value
==
false
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL : Error :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_033
* @tc.name : setDeviceActive - WIRED_HEADSET - activate - Callback
* @tc.desc : Activate WIRED_HEADSET - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_033
'
,
0
,
async
function
(
done
)
{
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Active
'
);
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
true
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Active : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Active : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_ENUM_034
* @tc.name : setDeviceActive - WIRED_HEADSET - activate - Callback
* @tc.desc : Activate WIRED_HEADSET - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_ENUM_034
'
,
0
,
async
function
(
done
)
{
audioManager
.
setDeviceActive
(
3
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
audioManager
.
isDeviceActive
(
3
,(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
true
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Active : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Active : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_035
* @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Callback
* @tc.desc : Activate WIRED_HEADSET - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_035
'
,
0
,
async
function
(
done
)
{
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
false
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Deactive: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Deactive
'
);
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Deactive: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
true
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Deactive : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Deactive : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_ENUM_036
* @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Callback
* @tc.desc : Deactivate WIRED_HEADSET - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_ENUM_036
'
,
0
,
async
function
(
done
)
{
var
setflag
;
audioManager
.
setDeviceActive
(
3
,
true
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
audioManager
.
setDeviceActive
(
3
,
false
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Deactive: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Deactive
'
);
audioManager
.
isDeviceActive
(
3
,
async
(
err
,
value
)
=>
{
if
(
!
value
)
{
expect
(
true
).
assertTrue
();
//console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Deactive : PASS :' + value);
//setflag = true ;
//console.info('AudioFrameworkTest: Device Test: setFlag' + setflag);
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Deactive : FAIL :
'
+
value
);
setflag
=
false
;
console
.
info
(
'
AudioFrameworkTest: Device Test: setFlag
'
+
setflag
);
expect
(
false
).
assertTrue
();
}
done
();
});
await
sleep
(
100
);
}
done
();
});
await
sleep
(
1000
);
}
});
done
();
await
sleep
(
1000
);
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037
* @tc.name : setDeviceActive - SPEAKER
* @tc.desc : Listner on speaker active
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037
'
,
0
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
audio
.
DeviceType
.
SPEAKER
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
var
setflag
;
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
if
(
deviceList
[
0
].
deviceType
==
2
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : PASS :
'
+
deviceList
[
0
].
deviceType
);
setflag
=
true
;
console
.
info
(
'
AudioManagerLog: setFlag is :
'
+
setflag
);
expect
(
setflag
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : FAIL :
'
+
deviceList
[
0
].
deviceType
);
setflag
=
false
;
console
.
info
(
'
AudioManagerLog: setFlag is :
'
+
setflag
);
expect
(
setflag
).
assertTrue
();
done
();
}
});
await
audioManager
.
setDeviceActive
(
audio
.
DeviceType
.
SPEAKER
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
done
();
})
it
(
'
SUB_AUDIO_MANAGER_DeviceType_001
'
,
0
,
async
function
(
done
)
{
/* *
* @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_ENUM_038
* @tc.name : setDeviceActive - SPEAKER
* @tc.desc : Listner on speaker active
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_ENUM_038
'
,
0
,
async
function
(
done
)
{
audioManager
.
setDeviceActive
(
2
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactive
'
);
});
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
if
(
deviceList
[
0
].
deviceType
==
2
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : PASS :
'
+
deviceList
[
0
].
deviceType
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : FAIL :
'
+
deviceList
[
0
].
deviceType
);
expect
(
false
).
assertTrue
();
expect
(
audio
.
DeviceType
.
INVALID
).
assertEqual
(
0
);
await
sleep
(
50
);
done
();
}
});
await
audioManager
.
setDeviceActive
(
2
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_
ON_setDeviceActive_BLUETOOTH_SCO_039
* @tc.name :
setDeviceActive - BLUETOOTH_SCO
* @tc.desc :
Listner on speaker active
* @tc.number : SUB_AUDIO_MANAGER_
DeviceType_002
* @tc.name :
DeviceType - WIRED_HEADSET
* @tc.desc :
DeviceType - WIRED_HEADSET
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_039
'
,
0
,
async
function
(
done
)
{
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
if
(
deviceList
[
0
].
deviceType
==
7
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : PASS :
'
+
deviceList
[
0
].
deviceType
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : FAIL :
'
+
deviceList
[
0
].
deviceType
);
expect
(
false
).
assertTrue
();
done
();
}
});
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
BLUETOOTH_SCO
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error:
${
err
.
message
}
`
);
});
done
();
})
it
(
'
SUB_AUDIO_MANAGER_DeviceType_001
'
,
0
,
async
function
(
done
)
{
/* *
* @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_ENUM_040
* @tc.name : setDeviceActive - BLUETOOTH_SCO
* @tc.desc : Listner on speaker active
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_ENUM_040
'
,
0
,
async
function
(
done
)
{
audioManager
.
setDeviceActive
(
7
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactive
'
);
});
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
if
(
deviceList
[
0
].
deviceType
==
7
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : BLUETOOTH_SCO ACTIVE : PASS :
'
+
deviceList
[
0
].
deviceType
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : BLUETOOTH_SCO ACTIVE : FAIL :
'
+
deviceList
[
0
].
deviceType
);
expect
(
false
).
assertTrue
();
expect
(
audio
.
DeviceType
.
WIRED_HEADSET
).
assertEqual
(
3
);
await
sleep
(
50
);
done
();
}
});
await
audioManager
.
setDeviceActive
(
7
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error:
${
err
.
message
}
`
);
});
done
();
await
sleep
(
1000
);
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_
ON_setDeviceActive_WIRED_HEADSET_041
* @tc.name :
setDeviceActive - WIRED
_HEADSET
* @tc.desc :
Listner on WIRED_HEADSET active
* @tc.number : SUB_AUDIO_MANAGER_
DeviceType_003
* @tc.name :
DeviceType - USB
_HEADSET
* @tc.desc :
DeviceType - USB_HEADSET
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_ENUM_041
'
,
0
,
async
function
(
done
)
{
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
if
(
deviceList
[
0
].
deviceType
==
3
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : PASS :
'
+
deviceList
[
0
].
deviceType
);
expect
(
true
).
assertTrue
();
it
(
'
SUB_AUDIO_MANAGER_DeviceType_003
'
,
0
,
async
function
(
done
)
{
var
resultflag
=
false
;
if
(
audio
.
DeviceType
.
USB_HEADSET
==
22
||
audio
.
DeviceType
.
USB_HEADSET
==
undefined
)
resultflag
=
true
;
expect
(
resultflag
).
assertTrue
();
await
sleep
(
50
);
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : FAIL :
'
+
deviceList
[
0
].
deviceType
);
expect
(
false
).
assertTrue
();
done
();
}
});
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
});
done
();
await
sleep
(
1000
);
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_ENUM_042
* @tc.name : setDeviceActive - WIRED_HEADSET
* @tc.desc : Listner on WIRED_HEADSET active
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_ENUM_042
'
,
0
,
async
function
(
done
)
{
let
setflag
;
audioManager
.
setDeviceActive
(
3
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Deactive
'
);
});
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
if
(
deviceList
[
0
].
deviceType
==
3
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : PASS :
'
+
deviceList
[
0
].
deviceType
);
setflag
=
true
;
console
.
info
(
'
AudioManagerLog: device type: setFlag is
'
+
setflag
);
expect
(
setflag
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : FAIL :
'
+
deviceList
[
0
].
deviceType
);
setflag
=
false
;
console
.
info
(
'
AudioManagerLog: device type: setFlag is
'
+
setflag
);
expect
(
false
).
assertTrue
();
done
();
}
});
await
audioManager
.
setDeviceActive
(
3
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
});
done
();
await
sleep
(
1000
);
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_Combination1_043
* @tc.name : setDeviceActive - WIRED_HEADSET
* @tc.desc : Listner on WIRED_HEADSET active
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_Combination1_043
'
,
0
,
async
function
(
done
)
{
var
setFalg
;
await
audioManager
.
on
(
'
deviceChange
'
,
(
deviceChangeAction
)
=>
{
console
.
info
(
'
AudioManagerLog: ON device connected:
'
+
deviceChangeAction
.
type
);
let
deviceList
=
deviceChangeAction
.
deviceDescriptors
;
for
(
let
i
=
0
;
i
<
deviceList
.
length
;
i
++
)
{
console
.
info
(
'
AudioManagerLog: device role:
'
+
deviceList
[
i
].
deviceRole
);
console
.
info
(
'
AudioManagerLog: device type:
'
+
deviceList
[
i
].
deviceType
);
}
});
await
sleep
(
1000
);
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
});
await
sleep
(
5000
);
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
await
sleep
(
5000
);
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active Again
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate Again: Error:
${
err
.
message
}
`
);
});
await
sleep
(
5000
);
await
audioManager
.
isDeviceActive
(
3
).
then
(
function
(
value
){
setFalg
=
value
;
if
(
value
==
true
){
if
(
setFalg
==
true
){
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : PASS :
'
+
value
);
console
.
info
(
'
AudioFrameworkTest: Device Test: after asseert
'
);
}
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL :
'
+
value
);
}
});
console
.
info
(
'
AudioFrameworkTest: Device Test: after COMPLETE
'
);
await
sleep
(
1000
);
expect
(
setFalg
).
assertTrue
();
done
();
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录