Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
93ded1b4
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看板
未验证
提交
93ded1b4
编写于
9月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5784 audio_xts整改
Merge pull request !5784 from liuxueqi/master
上级
8534017d
ba12adaf
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
2500 addition
and
2841 deletion
+2500
-2841
multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
...angeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
+193
-413
multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js
...angeInfo/src/main/js/test/AudioRendererChangeInfo.test.js
+938
-938
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
...dard/audioManager/src/main/js/test/AudioFramework.test.js
+1244
-1369
multimedia/audio/audio_js_standard/audioRenderer/Test.json
multimedia/audio/audio_js_standard/audioRenderer/Test.json
+3
-7
multimedia/audio/audio_js_standard/audioVoip/Test.json
multimedia/audio/audio_js_standard/audioVoip/Test.json
+2
-1
multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js
..._js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js
+120
-113
未找到文件。
multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
浏览文件 @
93ded1b4
...
...
@@ -99,8 +99,7 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
async
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
console
.
info
(
Tag
+
'
StrId for
'
+
i
+
'
is:
'
+
AudioCapturerChangeInfoArray
[
i
].
streamId
);
...
...
@@ -120,34 +119,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
1
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-001] ResultFlag for element
'
+
i
+
'
is:
'
+
resultFlag
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
audioCap
.
release
();
expect
(
true
).
assertTrue
();
done
();
}
}
});
await
sleep
(
100
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-001] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -188,9 +173,7 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManagerCB
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
audioStreamManagerCB
.
on
(
'
audioCapturerChange
'
,
async
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
console
.
info
(
Tag
+
'
StrId for
'
+
i
+
'
is:
'
+
AudioCapturerChangeInfoArray
[
i
].
streamId
);
...
...
@@ -212,31 +195,24 @@ describe('audioCapturerChange', function () {
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
2
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-002] ResultFlag for element
'
+
i
+
'
is:
'
+
resultFlag
);
}
}
});
await
sleep
(
100
);
await
audioCap
.
start
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManagerCB
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-002] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
}
}
});
expect
(
resultFlag
).
assertTrue
();
done
();
await
audioCap
.
start
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer start :ERROR :
'
+
err
.
message
);
});
})
/**
...
...
@@ -457,8 +433,6 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
let
audioCap
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
...
...
@@ -481,35 +455,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerInfo
.
source
==
0
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-005] ResultFlag for element
'
+
i
+
'
is:
'
+
resultFlag
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
});
await
sleep
(
100
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-005] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
release
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -620,8 +579,6 @@ describe('audioCapturerChange', function () {
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
...
...
@@ -642,34 +599,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
streamId
!=
undefined
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-007] ResultFlag for element
'
+
i
+
'
is:
'
+
resultFlag
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
});
await
sleep
(
100
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-007] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
release
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
...
...
@@ -699,8 +642,6 @@ describe('audioCapturerChange', function () {
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
...
...
@@ -723,34 +664,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
clientUid
!=
undefined
&&
capFlags
==
0
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-008] ResultFlag for element
'
+
i
+
'
is:
'
+
resultFlag
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
});
await
sleep
(
100
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-008] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
release
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -779,8 +706,6 @@ describe('audioCapturerChange', function () {
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
...
...
@@ -805,34 +730,21 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CC:
'
+
i
+
'
:
'
+
cCount
);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
cMask
);
if
(
Id
>
0
&&
dType
==
15
&&
dRole
==
1
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
resultFlag
=
true
;
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
});
await
sleep
(
100
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-ON-009] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
release
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
...
...
@@ -863,8 +775,6 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
true
;
let
audioCap
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
...
...
@@ -885,32 +795,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
C
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelCounts
[
0
]);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
resultFlag
=
false
;
}
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-001] ######### CapturerChange Off is called #########
'
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-001] ResultFlag is:
'
+
resultFlag
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
expect
(
true
).
assertTrue
();
done
();
}
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
release
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -940,17 +838,15 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
true
;
let
audioCap
;
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
start
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
...
...
@@ -970,31 +866,17 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
C
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelCounts
[
0
]);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
resultFlag
=
false
;
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-002] ######### CapturerChange Off is called #########
'
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-002] ResultFlag is:
'
+
resultFlag
);
await
audioCap
.
start
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer start :ERROR :
'
+
err
.
message
);
});
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
done
();
})
/**
...
...
@@ -1024,23 +906,17 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
true
;
let
audioCap
;
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
audioCap
.
start
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
start
();
await
audioCap
.
stop
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
...
...
@@ -1060,32 +936,18 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
C
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelCounts
[
0
]);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
resultFlag
=
false
;
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-003] ######### CapturerChange Off is called #########
'
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-003] ResultFlag is:
'
+
resultFlag
);
await
audioCap
.
stop
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer stopped : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer stop:ERROR :
'
+
err
.
message
);
});
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
done
();
})
/**
...
...
@@ -1115,29 +977,17 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
true
;
let
audioCap
;
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
audioCap
.
start
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer start :ERROR :
'
+
err
.
message
);
});
await
audioCap
.
stop
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer stopped : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer stop:ERROR :
'
+
err
.
message
);
});
await
sleep
(
100
);
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
start
();
await
audioCap
.
stop
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
...
...
@@ -1157,25 +1007,18 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
C
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelCounts
[
0
]);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
resultFlag
=
false
;
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
'
AFCapturerChangeLog: [CAP-CH-OFF-004] ## CapCh Off is called ##
'
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-004] ResultFlag is:
'
+
resultFlag
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
done
();
})
/**
...
...
@@ -1204,9 +1047,6 @@ describe('audioCapturerChange', function () {
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
true
;
let
audioCap
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
...
...
@@ -1233,34 +1073,21 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CC:
'
+
i
+
'
:
'
+
cCount
);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
cMask
);
if
(
Id
>
0
&&
dType
==
15
&&
dRole
==
1
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
resultFlag
=
false
;
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
});
await
sleep
(
100
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-005] ######### CapturerChange Off is called #########
'
);
console
.
info
(
Tag
+
'
[CAPTURER-CHANGE-OFF-005] ResultFlag is:
'
+
resultFlag
);
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
});
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
await
audioCap
.
release
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -1289,8 +1116,6 @@ describe('audioCapturerChange', function () {
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
audioStreamManagerCB
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
...
...
@@ -1318,6 +1143,8 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
done
();
});
await
sleep
(
100
);
...
...
@@ -1343,28 +1170,26 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
1
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
State :
'
+
AudioCapturerChangeInfoArray
[
i
].
capturerState
);
audioStreamManagerCB
.
off
(
'
audioCapturerChange
'
);
console
.
info
(
'
audioCapturerChange off success
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
}).
catch
((
err
)
=>
{
console
.
log
(
Tag
+
'
getCurrentAudioCapturerInfoArray :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
});
audioStreamManagerCB
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_STATE_1_PR] ## CapCh Off is called ##
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
})
/**
...
...
@@ -1393,9 +1218,6 @@ describe('audioCapturerChange', function () {
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
let
audioCap
;
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
...
...
@@ -1433,6 +1255,8 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
Capturer started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer start :ERROR :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
done
();
});
await
sleep
(
100
);
...
...
@@ -1458,29 +1282,25 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
2
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
State :
'
+
AudioCapturerChangeInfoArray
[
i
].
capturerState
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
}).
catch
((
err
)
=>
{
console
.
log
(
Tag
+
'
getCurrentAudioCapturerInfoArray :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
});
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_STATE_2_PROMISE] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
})
/**
...
...
@@ -1510,8 +1330,6 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
let
audioCap
;
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
...
...
@@ -1581,29 +1399,25 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
3
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
State :
'
+
AudioCapturerChangeInfoArray
[
i
].
capturerState
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
}).
catch
((
err
)
=>
{
console
.
log
(
Tag
+
'
getCurrentAudioCapturerInfoArray :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
});
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_STATE_3_PROMISE] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
})
/**
...
...
@@ -1690,7 +1504,9 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CC:
'
+
i
+
'
:
'
+
cCount
);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
cMask
);
if
(
Id
>
0
&&
dType
==
15
&&
dRole
==
1
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
resultFlag
=
true
;
audioStreamManagerCB
.
off
(
'
audioCapturerChange
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
...
...
@@ -1700,10 +1516,6 @@ describe('audioCapturerChange', function () {
resultFlag
=
false
;
});
audioStreamManagerCB
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_DD_PR] ## CapCh Off is called ##
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
...
...
@@ -1800,28 +1612,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
1
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
State :
'
+
AudioCapturerChangeInfoArray
[
i
].
capturerState
);
}
}
}
}
});
await
sleep
(
1000
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_STATE_1_CALLBACK] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
}
}
}
}
});
})
/**
...
...
@@ -1921,29 +1725,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
2
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
State :
'
+
AudioCapturerChangeInfoArray
[
i
].
capturerState
);
}
}
}
}
});
await
sleep
(
1000
);
audioStreamManagerCB
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_STATE_2_CALLBACK] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
}
}
}
}
});
})
/**
...
...
@@ -2050,29 +1845,20 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
AudioCapturerChangeInfoArray
[
i
].
deviceDescriptors
[
j
].
channelMasks
);
}
if
(
AudioCapturerChangeInfoArray
[
i
].
capturerState
==
3
&&
devDescriptor
!=
null
)
{
resultFlag
=
true
;
console
.
info
(
Tag
+
'
State :
'
+
AudioCapturerChangeInfoArray
[
i
].
capturerState
);
}
}
}
}
});
await
sleep
(
1000
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_STATE_3_CALLBACK] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
}
}
}
}
});
})
/**
...
...
@@ -2102,7 +1888,6 @@ describe('audioCapturerChange', function () {
capturerInfo
:
AudioCapturerInfo
}
let
resultFlag
=
false
;
audioStreamManager
.
on
(
'
audioCapturerChange
'
,
(
AudioCapturerChangeInfoArray
)
=>
{
for
(
let
i
=
0
;
i
<
AudioCapturerChangeInfoArray
.
length
;
i
++
)
{
console
.
info
(
Tag
+
'
## CapChange on is called for element
'
+
i
+
'
##
'
);
...
...
@@ -2130,6 +1915,8 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
AudioCapturer Created : ERROR :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
done
();
});
await
sleep
(
100
);
...
...
@@ -2165,28 +1952,21 @@ describe('audioCapturerChange', function () {
console
.
info
(
Tag
+
'
CC:
'
+
i
+
'
:
'
+
cCount
);
console
.
info
(
Tag
+
'
CM:
'
+
i
+
'
:
'
+
cMask
);
if
(
Id
>
0
&&
dType
==
15
&&
dRole
==
1
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
resultFlag
=
true
;
}
}
}
}
}
});
await
sleep
(
1000
);
audioStreamManager
.
off
(
'
audioCapturerChange
'
);
await
sleep
(
100
);
console
.
info
(
Tag
+
'
[GET_CAPTURER_DD_CALLBACK] ######### CapturerChange Off is called #########
'
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
Tag
+
'
Capturer release : SUCCESS
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
Capturer release :ERROR :
'
+
err
.
message
);
});
expect
(
resultFlag
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
});
}
}
}
}
}
});
})
})
multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js
浏览文件 @
93ded1b4
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
浏览文件 @
93ded1b4
...
...
@@ -13,7 +13,6 @@
* limitations under the License.
*/
import
audio
from
'
@ohos.multimedia.audio
'
;
import
*
as
audioTestBase
from
'
../../../../../AudioTestBase
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
...
...
@@ -136,6 +135,7 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOMANAGER_0200
'
,
1
,
async
function
(
done
)
{
try
{
const
AUDIOMANAGER1
=
audio
.
getAudioManager
();
const
AUDIOMANAGER2
=
audio
.
getAudioManager
();
const
AUDIOMANAGER3
=
audio
.
getAudioManager
();
...
...
@@ -146,43 +146,40 @@ describe('audioFramework', function () {
const
AUDIOMANAGER8
=
audio
.
getAudioManager
();
const
AUDIOMANAGER9
=
audio
.
getAudioManager
();
const
AUDIOMANAGER10
=
audio
.
getAudioManager
();
const
PROMISE
=
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
PROMISE
.
then
(
function
()
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
AudioFrameworkTest: Media setVolume promise: successful
'
);
AUDIOMANAGER1
.
setVolume
(
audioMedia
,
highVol
);
await
AUDIOMANAGER1
.
setVolume
(
audioMedia
,
highVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager1 : Media setVolume promise: successful
'
);
AUDIOMANAGER2
.
setVolume
(
audioMedia
,
highVol
);
await
AUDIOMANAGER2
.
setVolume
(
audioMedia
,
highVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager2 : Media setVolume promise: successful
'
);
AUDIOMANAGER3
.
setVolume
(
audioMedia
,
highVol
);
await
AUDIOMANAGER3
.
setVolume
(
audioMedia
,
highVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager3 : Media setVolume promise: successful
'
);
AUDIOMANAGER4
.
setVolume
(
audioMedia
,
lowVol
);
await
AUDIOMANAGER4
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager4 : Media setVolume promise: successful
'
);
AUDIOMANAGER5
.
setVolume
(
audioMedia
,
highVol
);
await
AUDIOMANAGER5
.
setVolume
(
audioMedia
,
highVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager5 : Media setVolume promise: successful
'
);
AUDIOMANAGER6
.
setVolume
(
audioMedia
,
lowVol
);
await
AUDIOMANAGER6
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager6 : Media setVolume promise: successful
'
);
AUDIOMANAGER7
.
setVolume
(
audioMedia
,
highVol
);
await
AUDIOMANAGER7
.
setVolume
(
audioMedia
,
highVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager7 : Media setVolume promise: successful
'
);
AUDIOMANAGER8
.
setVolume
(
audioMedia
,
lowVol
);
await
AUDIOMANAGER8
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager8 : Media setVolume promise: successful
'
);
AUDIOMANAGER9
.
setVolume
(
audioMedia
,
highVol
);
await
AUDIOMANAGER9
.
setVolume
(
audioMedia
,
highVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager9 : Media setVolume promise: successful
'
);
AUDIOMANAGER10
.
setVolume
(
audioMedia
,
lowVol
);
await
AUDIOMANAGER10
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
AudioFrameworkTest:audioManager10 : Media setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioMedia
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
getVolume
(
audioMedia
);
if
(
data
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
((
err
)
=>
{
}
catch
(
err
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: Error :
'
+
err
.
message
);
});
});
await
PROMISE
;
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -195,21 +192,21 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0100
'
,
1
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
AudioFrameworkTest: Media setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioMedia
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
getVolume
(
audioMedia
);
if
(
data
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -222,21 +219,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0200
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audioMedia
,
maxVol
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Media setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioMedia
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
maxVol
);
let
data
=
await
audioManager
.
getVolume
(
audioMedia
);
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -249,22 +245,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0300
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audioMedia
,
minVol
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Media setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioMedia
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
minVol
);
let
data
=
await
audioManager
.
getVolume
(
audioMedia
);
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -277,7 +271,6 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0400
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
AudioFrameworkTest: Media setVolume Promise:Out of range: Setvol 100
'
);
await
audioManager
.
setVolume
(
audioMedia
,
outOfRangeVol
).
then
(()
=>
{
console
.
info
(
'
AudioFrameworkTest: Media setVolume Promise:Out of range: FAIL
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -301,26 +294,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : Media setVolume successful `
);
audioManager
.
getVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
}
else
if
(
value
==
highVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -337,26 +327,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : Media setVolume successful `
);
audioManager
.
getVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -373,26 +360,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : Media setVolume successful `
);
audioManager
.
getVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -409,8 +393,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: setVolume: Out of range: Callback: PASS:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: setVolume: callback : Media Out of range: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -427,21 +410,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0900
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Ringtone setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioRingtone
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
let
data
=
await
audioManager
.
getVolume
(
audioRingtone
);
if
(
data
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -454,21 +436,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1000
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audioRingtone
,
maxVol
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Ringtone setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioRingtone
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
maxVol
);
let
data
=
await
audioManager
.
getVolume
(
audioRingtone
);
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
err
);
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -481,21 +462,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1100
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audioRingtone
,
minVol
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Ringtone setVolume promise: successful
'
);
audioManager
.
getVolume
(
audioRingtone
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
minVol
);
let
data
=
await
audioManager
.
getVolume
(
audioRingtone
);
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
err
);
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -532,6 +512,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : Ringtone setVolume successful `
);
...
...
@@ -539,19 +520,16 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
}
else
if
(
value
==
highVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -568,27 +546,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : Ringtone setVolume successful `
);
audioManager
.
getVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -605,26 +579,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : Ringtone setVolume successful `
);
audioManager
.
getVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -641,8 +612,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Out of range Volume: Callback:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Out of range Volume: callback : Ringtone set volume: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -685,8 +655,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: setVolume Callback: Negative: PASS:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: setVolume callback : Media Negative: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -729,8 +698,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest:Ringtone setVolume Callback:Negative: PASS :
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: setVolume: Negative: callback : Ringtone set volume: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -747,20 +715,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2100
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
PROMISE
.
then
(
function
()
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
let
data
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
);
if
(
data
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
err
);
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -777,26 +745,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback: ENAME :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : ENAME : Media setVolume successful `
);
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media: ENAME : Error
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
}
else
if
(
value
==
highVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -809,21 +774,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2300
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
highVol
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful
'
);
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
highVol
);
let
data
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
);
if
(
data
==
highVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: ENAME
: PASS :
'
+
data
);
console
.
info
(
'
AudioFrameworkTest: RINGTONE getVolume Promise: ENAME
: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: RINGTONE getVolume Promise: ENAME : FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
err
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
done
();
})
...
...
@@ -840,26 +804,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback: ENAME:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `
);
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
lowVol
)
{
}
else
if
(
value
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -872,21 +833,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2500
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
PROMISE
.
then
(
function
()
{
a
udioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
maxVol
);
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
a
wait
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
maxVol
)
let
data
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
);
if
(
data
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -901,29 +862,33 @@ describe('audioFramework', function () {
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2600
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
highVol
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback: ENAME :
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: failed to set volume
MEDIA
: Callback: ENAME :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : ENAME : Media setVolume successful `
);
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
lowVol
);
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
lowVol
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume RINGTONE: Callback: ENAME :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media: ENAME : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
}
else
if
(
value
==
highVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
}
});
})
...
...
@@ -936,22 +901,22 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2700
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
highVol
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
highVol
);
console
.
info
(
'
AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful
'
);
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
a
wait
a
udioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
let
data
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
);
if
(
data
==
highVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
info
(
'
err=
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -968,27 +933,31 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to set volume: Callback: ENAME:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `
);
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
highVol
);
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
highVol
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: failed to setVolume: Callback: ENAME:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
lowVol
)
{
}
else
if
(
value
==
lowVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
}
});
})
...
...
@@ -1006,8 +975,7 @@ describe('audioFramework', function () {
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getMaxVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getMaxVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1029,12 +997,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media : failed to getMaxVolume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMaxVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMaxVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1056,11 +1022,13 @@ describe('audioFramework', function () {
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1079,12 +1047,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1107,12 +1073,14 @@ describe('audioFramework', function () {
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getMaxVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getMaxVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});;
await
PROMISE
;
done
();
})
...
...
@@ -1126,20 +1094,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0600
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
const
PROMISE
=
audioManager
.
getMaxVolume
(
audioRingtone
);
PROMISE
.
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
let
data
=
await
audioManager
.
getMaxVolume
(
audioRingtone
);
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -1152,18 +1120,15 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0700
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
a
wait
a
udioManager
.
setVolume
(
audioRingtone
,
lowVol
);
audioManager
.
getMaxVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media : failed to getMaxVolume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMaxVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMaxVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1180,17 +1145,15 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0800
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
a
wait
a
udioManager
.
setVolume
(
audioMedia
,
lowVol
);
audioManager
.
getMaxVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1207,19 +1170,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0900
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
const
PROMISE
=
audioManager
.
getMaxVolume
(
audioMedia
);
PROMISE
.
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
let
data
=
await
audioManager
.
getMaxVolume
(
audioMedia
);
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getMaxVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getMaxVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -1232,19 +1196,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1000
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
const
PROMISE
=
audioManager
.
getMaxVolume
(
audioRingtone
);
PROMISE
.
then
(
function
(
data
)
{
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
let
data
=
await
audioManager
.
getMaxVolume
(
audioRingtone
);
if
(
data
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -1257,17 +1222,15 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1100
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
highVol
);
a
wait
a
udioManager
.
setVolume
(
audioMedia
,
highVol
);
audioManager
.
getMaxVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media : failed to getMaxVolume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMaxVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMaxVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1284,17 +1247,15 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1200
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
highVol
);
a
wait
a
udioManager
.
setVolume
(
audioRingtone
,
highVol
);
audioManager
.
getMaxVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
maxVol
)
{
}
else
if
(
value
==
maxVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1316,11 +1277,13 @@ describe('audioFramework', function () {
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getMinVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getMinVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1339,12 +1302,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media : failed to getMinVolume
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMinVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMinVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1366,12 +1327,13 @@ describe('audioFramework', function () {
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMinVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMinVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1390,12 +1352,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1412,17 +1372,25 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0500
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
const
PROMISE
=
audioManager
.
getMinVolume
(
audioMedia
);
PROMISE
.
then
(
function
(
data
)
{
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getMinVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getMinVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1437,17 +1405,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0600
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
audioManager
.
getMinVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media : failed to getMinVolume
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMinVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMinVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1464,17 +1436,25 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0700
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
highVol
);
try
{
await
audioManager
.
setVolume
(
audioMedia
,
highVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
const
PROMISE
=
audioManager
.
getMinVolume
(
audioRingtone
);
PROMISE
.
then
(
function
(
data
)
{
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMinVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Ringtone getMinVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1489,17 +1469,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0800
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
audioManager
.
getMinVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1516,17 +1500,25 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0900
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
const
PROMISE
=
audioManager
.
getMinVolume
(
audioMedia
);
PROMISE
.
then
(
function
(
data
)
{
if
(
data
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: Media getMinVolume promise : PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Media getMinVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1541,17 +1533,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1000
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioMedia
,
highVol
);
try
{
await
audioManager
.
setVolume
(
audioMedia
,
highVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
audioManager
.
getMinVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Media : failed to getMinVolume
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
minVol
)
{
}
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMinVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Media: getMinVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1568,7 +1564,13 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1100
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
const
PROMISE
=
audioManager
.
getMinVolume
(
audioRingtone
)
PROMISE
.
then
(
function
(
data
)
{
if
(
data
==
minVol
)
{
...
...
@@ -1579,6 +1581,9 @@ describe('audioFramework', function () {
console
.
info
(
'
AudioFrameworkTest: Ringtone getMinVolume promise : FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1593,7 +1598,13 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1200
'
,
2
,
async
function
(
done
)
{
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
return
done
();
}
audioManager
.
getMinVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume
${
err
.
message
}
`
);
...
...
@@ -1602,8 +1613,7 @@ describe('audioFramework', function () {
else
if
(
value
==
minVol
)
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL:
'
+
value
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1628,11 +1638,13 @@ describe('audioFramework', function () {
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1652,15 +1664,16 @@ describe('audioFramework', function () {
PROMISE
.
then
(
function
(
value
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1678,18 +1691,18 @@ describe('audioFramework', function () {
const
PROMISE
=
audioManager
.
getDevices
(
3
);
// Getting all devies connected 3 = ALL_DEVICES_FLAG
PROMISE
.
then
(
function
(
value
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1706,20 +1719,17 @@ describe('audioFramework', function () {
audioManager
.
getDevices
(
1
,
(
err
,
value
)
=>
{
// Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG
'
);
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1739,9 +1749,7 @@ describe('audioFramework', function () {
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0500
'
,
2
,
async
function
(
done
)
{
audioManager
.
getDevices
(
2
,
(
err
,
value
)
=>
{
// Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG
'
);
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
...
...
@@ -1749,12 +1757,10 @@ describe('audioFramework', function () {
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1774,9 +1780,7 @@ describe('audioFramework', function () {
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0600
'
,
2
,
async
function
(
done
)
{
audioManager
.
getDevices
(
3
,
(
err
,
value
)
=>
{
// Getting all devies connected 3 = ALL_DEVICES_FLAG
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG
'
);
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
...
...
@@ -1788,8 +1792,7 @@ describe('audioFramework', function () {
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1809,17 +1812,18 @@ describe('audioFramework', function () {
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0700
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
)
PROMISE
.
then
(
function
(
value
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1838,15 +1842,16 @@ describe('audioFramework', function () {
PROMISE
.
then
(
function
(
value
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1869,11 +1874,13 @@ describe('audioFramework', function () {
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
});
await
PROMISE
;
done
();
...
...
@@ -1893,15 +1900,13 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1924,16 +1929,13 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1956,15 +1958,13 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -1982,22 +1982,20 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0100
'
,
1
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setRingerMode
(
2
);
// Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL
'
);
audioManager
.
getRingerMode
().
then
(
function
(
value
)
{
try
{
await
audioManager
.
setRingerMode
(
2
);
let
value
=
await
audioManager
.
getRingerMode
();
if
(
value
==
2
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -2010,22 +2008,20 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0200
'
,
1
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setRingerMode
(
0
);
// Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT
'
);
audioManager
.
getRingerMode
().
then
(
function
(
value
)
{
try
{
await
audioManager
.
setRingerMode
(
0
);
let
value
=
await
audioManager
.
getRingerMode
();
if
(
value
==
0
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -2038,22 +2034,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0300
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setRingerMode
(
1
);
// Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE
'
);
audioManager
.
getRingerMode
().
then
(
function
(
value
)
{
try
{
await
audioManager
.
setRingerMode
(
1
);
let
value
=
await
audioManager
.
getRingerMode
();
if
(
value
==
1
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -2072,25 +2066,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
audioManager
.
getRingerMode
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
2
)
{
}
else
if
(
value
==
2
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -2109,26 +2100,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
audioManager
.
getRingerMode
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
if
(
value
==
0
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -2147,26 +2135,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
audioManager
.
getRingerMode
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : RINGER_MODE_VIBRATE: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
if
(
value
==
1
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -2179,21 +2164,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0700
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_NORMAL
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL
'
);
audioManager
.
getRingerMode
().
then
(
function
(
value
)
{
try
{
await
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_NORMAL
);
let
value
=
await
audioManager
.
getRingerMode
();
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_NORMAL
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -2206,22 +2190,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0800
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_SILENT
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT
'
);
audioManager
.
getRingerMode
().
then
(
function
(
value
)
{
try
{
await
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_SILENT
);
let
value
=
await
audioManager
.
getRingerMode
();
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_SILENT
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
done
();
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
/**
...
...
@@ -2233,21 +2216,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0900
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_VIBRATE
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE
'
);
audioManager
.
getRingerMode
().
then
(
function
(
value
)
{
try
{
await
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_VIBRATE
);
let
value
=
await
audioManager
.
getRingerMode
();
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_VIBRATE
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -2265,25 +2247,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
audioManager
.
getRingerMode
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_NORMAL
)
{
}
else
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_NORMAL
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -2301,26 +2280,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
audioManager
.
getRingerMode
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_SILENT
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -2338,26 +2314,23 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
audioManager
.
getRingerMode
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : RINGER_MODE_VIBRATE: Error:
${
err
.
message
}
`
);
expect
().
assertFail
();
}
if
(
value
==
audio
.
AudioRingMode
.
RINGER_MODE_VIBRATE
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -2383,36 +2356,34 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getVolume
(
audioMedia
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
done
();
}
else
if
(
value
==
highVol
)
{
audioManager
.
isMute
(
audioMedia
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
});
})
...
...
@@ -2426,43 +2397,31 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0200
'
,
1
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
await
audioManager
.
mute
(
audioMedia
,
true
).
then
(()
=>
{
await
audioManager
.
mute
(
audioMedia
,
true
)
console
.
log
(
'
AudioFrameworkTest: Promise returned to indicate that the stream is muted.
'
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
audioManager
.
mute
(
audioMedia
,
false
).
then
(
async
function
()
{
await
audioManager
.
mute
(
audioMedia
,
false
)
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE
'
);
await
audioManager
.
getVolume
(
audioMedia
).
then
((
value
)
=>
{
let
value
=
await
audioManager
.
getVolume
(
audioMedia
)
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
isMute
(
audioMedia
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audioMedia
)
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: ERROR:
'
+
err
.
message
);
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
);
}
done
();
})
...
...
@@ -2488,36 +2447,34 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getVolume
(
audioRingtone
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
done
();
}
else
if
(
value
==
highVol
)
{
audioManager
.
isMute
(
audioRingtone
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
});
})
...
...
@@ -2531,43 +2488,29 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0400
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
await
audioManager
.
mute
(
audioRingtone
,
true
).
then
(()
=>
{
await
audioManager
.
mute
(
audioRingtone
,
true
);
console
.
log
(
'
AudioFrameworkTest: Promise returned to indicate that the stream is muted.
'
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
audioManager
.
mute
(
audioRingtone
,
false
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE
'
);
await
audioManager
.
getVolume
(
audioRingtone
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audioRingtone
,
false
);
let
value
=
await
audioManager
.
getVolume
(
audioRingtone
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
isMute
(
audioRingtone
).
then
(
function
(
data
)
{
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:
'
+
data
);
let
data
=
await
audioManager
.
isMute
(
audioRingtone
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL:
'
+
data
);
}
else
{
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Ringtone: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: ERROR:
'
+
err
.
message
);
}
catch
(
err
)
{
console
.
info
(
'
err:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
);
}
done
();
})
...
...
@@ -2593,36 +2536,35 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
done
();
}
else
if
(
value
==
highVol
)
{
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
MEDIA
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
});
})
...
...
@@ -2636,43 +2578,27 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0600
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
MEDIA
,
lowVol
);
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
MEDIA
,
true
).
then
(()
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
MEDIA
,
true
);
console
.
log
(
'
AudioFrameworkTest: Promise returned to indicate that the stream is muted.
'
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
MEDIA
,
false
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
MEDIA
,
false
);
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
MEDIA
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
MEDIA
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
MEDIA
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err:
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -2698,36 +2624,34 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
done
();
}
else
if
(
value
==
highVol
)
{
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
RINGTONE
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
});
})
...
...
@@ -2741,43 +2665,27 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0800
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
RINGTONE
,
lowVol
);
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
RINGTONE
,
true
).
then
(()
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
RINGTONE
,
true
);
console
.
log
(
'
AudioFrameworkTest: Promise returned to indicate that the stream is muted.
'
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Ringtone: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
RINGTONE
,
false
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
RINGTONE
,
false
);
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
RINGTONE
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
RINGTONE
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
RINGTONE
)
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err:
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Ringtone: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -2803,36 +2711,34 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Callback: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
highVol
)
{
done
();
}
else
if
(
value
==
highVol
)
{
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: VOICE_CALL : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
});
})
...
...
@@ -2846,43 +2752,27 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1000
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
lowVol
);
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
true
).
then
(()
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
true
);
console
.
log
(
'
AudioFrameworkTest: Promise returned to indicate that the stream is muted.
'
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute VOICE_CALL: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
false
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Promise: FALSE
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
false
);
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_CALL
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_CALL
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err:
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute VOICE_CALL: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -2908,36 +2798,36 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Callback: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
if
(
value
==
highVol
)
{
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: VOICE_ASSISTANT : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
});
})
...
...
@@ -2951,43 +2841,27 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1200
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
lowVol
);
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
true
).
then
(()
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
true
);
console
.
log
(
'
AudioFrameworkTest: Promise returned to indicate that the stream is muted.
'
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute VOICE_ASSISTANT: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
false
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Promise: FALSE
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
false
);
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
lowVol
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute VOICE_ASSISTANT: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -3000,37 +2874,29 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1300
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audioMedia
,
highVol
);
await
audioManager
.
mute
(
audioMedia
,
true
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Media: Promise: TRUE
'
);
await
audioManager
.
getVolume
(
audioMedia
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audioMedia
,
true
);
let
value
=
await
audioManager
.
getVolume
(
audioMedia
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
0
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
await
audioManager
.
isMute
(
audioMedia
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audioMedia
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Media: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: ERROR:
'
+
err
.
message
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
);
}
done
();
})
...
...
@@ -3048,16 +2914,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE
'
);
audioManager
.
getVolume
(
audioMedia
,
async
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
if
(
value
==
0
)
{
await
audioManager
.
setVolume
(
audioMedia
,
highVol
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
else
if
(
value
==
0
)
{
await
audioManager
.
setVolume
(
audioMedia
,
highVol
);
audioManager
.
isMute
(
audioMedia
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status
${
err
.
message
}
`
);
...
...
@@ -3071,15 +2943,16 @@ describe('audioFramework', function () {
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
});
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
})
...
...
@@ -3092,10 +2965,11 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1500
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
await
audioManager
.
mute
(
audioRingtone
,
true
).
then
(
async
function
()
{
await
audioManager
.
mute
(
audioRingtone
,
true
);
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: SetVolume
'
);
await
audioManager
.
getVolume
(
audioRingtone
).
then
((
value
)
=>
{
let
value
=
await
audioManager
.
getVolume
(
audioRingtone
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
0
)
{
expect
(
true
).
assertTrue
();
...
...
@@ -3103,26 +2977,16 @@ describe('audioFramework', function () {
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
setVolume
(
audioRingtone
,
highVol
);
await
audioManager
.
isMute
(
audioRingtone
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audioRingtone
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute Ringtone: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -3140,38 +3004,36 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to set Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume
'
);
audioManager
.
getVolume
(
audioRingtone
,
async
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
0
)
{
done
();
}
else
if
(
value
==
0
)
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
audioManager
.
isMute
(
audioRingtone
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
})
...
...
@@ -3184,37 +3046,26 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1700
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
highVol
);
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
true
).
then
(
async
function
()
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Promise: TRUE
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
).
then
((
value
)
=>
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
true
);
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
)
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
0
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
lowVol
);
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_CALL
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_CALL
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err:
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute VOICE_CALL: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -3227,11 +3078,19 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1800
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
highVol
);
}
catch
(
err
)
{
console
.
error
(
`setVolume : failed to set Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
return
;
}
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
true
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to set Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Callback : SetVolume
'
);
...
...
@@ -3239,31 +3098,37 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`Failed to obtain the volume.
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
0
)
{
done
();
}
else
if
(
value
==
0
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
lowVol
);
}
catch
(
err
)
{
console
.
error
(
`setVolume : failed to set Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
return
;
}
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
else
{
}
else
{
console
.
info
(
`AudioFrameworkTest: mute fail: value
${
value
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
});
}
done
();
});
})
...
...
@@ -3276,37 +3141,27 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1900
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
highVol
);
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
true
).
then
(
async
function
()
{
await
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
true
);
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Promise: TRUE
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
).
then
((
value
)
=>
{
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
);
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
if
(
value
==
0
)
{
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
lowVol
);
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
).
then
(
function
(
data
)
{
let
data
=
await
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
);
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL:
'
+
data
);
}
catch
(
err
)
{
console
.
info
(
'
err :
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream isMute VOICE_ASSISTANT: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: ERROR:
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
});
done
();
})
...
...
@@ -3319,41 +3174,50 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2000
'
,
2
,
async
function
(
done
)
{
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
highVol
);
}
catch
(
err
)
{
console
.
log
(
'
setVolume err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
return
;
}
audioManager
.
mute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
true
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: VOICE_ASSISTANT : failed to set Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
done
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Callback : SetVolume
'
);
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
).
then
((
value
)
=>
{
try
{
let
value
=
await
audioManager
.
getVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
);
if
(
value
==
0
)
{
console
.
info
(
"
AudioFrameworkTest: value is
"
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
}
});
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
lowVol
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
return
;
}
audioManager
.
isMute
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : SetVolume: VOICE_ASSISTANT : failed to get Mute Status
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -3372,11 +3236,13 @@ describe('audioFramework', function () {
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
});
await
PROMISE
;
done
();
...
...
@@ -3396,12 +3262,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : Media : isActive: failed
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -3424,11 +3288,13 @@ describe('audioFramework', function () {
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
});
await
PROMISE
;
done
();
...
...
@@ -3448,12 +3314,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : Ringtone : isActive: failed
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -3476,11 +3340,13 @@ describe('audioFramework', function () {
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
});
await
PROMISE
;
done
();
...
...
@@ -3495,17 +3361,14 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0600
'
,
2
,
async
function
(
done
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS
'
);
audioManager
.
isActive
(
audio
.
AudioVolumeType
.
MEDIA
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : Media : ENAME: isActive: failed
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -3528,11 +3391,13 @@ describe('audioFramework', function () {
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
}).
catch
(
err
=>
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
});
await
PROMISE
;
done
();
...
...
@@ -3552,12 +3417,10 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : Ringtone : ENAME: isActive: failed
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -3574,22 +3437,20 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0100
'
,
1
,
async
function
(
done
)
{
await
audioManager
.
setMicrophoneMute
(
true
).
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTest: setMicrophoneMute: Promise: TRUE
'
);
audioManager
.
isMicrophoneMute
().
then
(
function
(
data
)
{
try
{
await
audioManager
.
setMicrophoneMute
(
true
);
let
data
=
await
audioManager
.
isMicrophoneMute
();
if
(
data
==
true
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: setMicrophoneMute: TRUE: FAIL: Error :
'
+
err
.
message
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
);
}
done
();
})
...
...
@@ -3602,22 +3463,20 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0200
'
,
1
,
async
function
(
done
)
{
await
audioManager
.
setMicrophoneMute
(
false
).
then
(
function
()
{
console
.
log
(
'
AudioFrameworkTest: setMicrophoneMute: Promise: FALSE
'
);
audioManager
.
isMicrophoneMute
().
then
(
function
(
data
)
{
try
{
await
audioManager
.
setMicrophoneMute
(
false
);
let
data
=
await
audioManager
.
isMicrophoneMute
();
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Promise: setMicrophoneMute: FALSE: FAIL: Error :
'
+
err
.
message
);
}
catch
(
err
)
{
console
.
info
(
'
Error :
'
+
err
.
message
);
expect
(
false
).
assertTrue
();
}
);
}
done
();
})
...
...
@@ -3634,6 +3493,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: setMicrophoneMute: Callback : TRUE: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: setMicrophoneMute: Callback : TRUE
'
);
...
...
@@ -3641,19 +3501,16 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : TRUE: isMicrophoneMute : Error
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
true
)
{
}
else
if
(
data
==
true
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -3670,6 +3527,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: setMicrophoneMute: Callback : FALSE: Error :
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
log
(
'
AudioFrameworkTest: setMicrophoneMute: Callback : FALSE
'
);
...
...
@@ -3677,19 +3535,16 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : FALSE: isMicrophoneMute : Error
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
data
==
false
)
{
}
else
if
(
data
==
false
)
{
console
.
log
(
'
AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS:
'
+
data
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL:
'
+
data
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -3702,23 +3557,37 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100
'
,
1
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
2
,
false
).
then
(
function
()
{
// Setting device active ENUM 2 = SPEAKER
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate
'
);
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
).
then
(
function
(
value
)
{
if
(
value
==
false
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :
'
+
value
);
try
{
let
flag
=
true
;
let
outputDeviceDescription
=
await
audioManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
);
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 outputDeviceDescription is
'
+
JSON
.
stringify
(
outputDeviceDescription
));
if
(
outputDeviceDescription
.
length
==
1
&&
outputDeviceDescription
[
0
].
deviceType
==
audio
.
DeviceType
.
SPEAKER
)
{
flag
=
false
;
}
await
audioManager
.
setDeviceActive
(
2
,
false
).
then
(()
=>
{
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 Promise returned to indicate that the device is set to the active status.
'
);
});
await
audioManager
.
isDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
).
then
(
function
(
value
)
{
if
(
flag
==
true
&&
value
==
false
)
{
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :
'
+
value
+
'
flag is
'
+
flag
);
expect
(
true
).
assertTrue
();
}
else
if
(
flag
==
false
&&
value
==
true
)
{
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :
'
+
value
+
'
flag is
'
+
flag
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :
'
+
value
);
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : fail :
'
+
value
+
'
flag is
'
+
flag
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :
'
+
err
.
message
);
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
)
);
expect
(
false
).
assertTrue
();
});
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -3731,22 +3600,20 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0200
'
,
1
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
,
true
).
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate
'
);
audioManager
.
isDeviceActive
(
2
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
,
true
);
let
value
=
await
audioManager
.
isDeviceActive
(
2
);
if
(
value
==
true
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :
'
+
err
.
message
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
);
}
done
();
})
...
...
@@ -3760,30 +3627,37 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300
'
,
2
,
async
function
(
done
)
{
let
flag
=
true
let
outputDeviceDescription
=
await
audioManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
);
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300 outputDeviceDescription is
'
+
JSON
.
stringify
(
outputDeviceDescription
));
if
(
outputDeviceDescription
.
length
==
1
&&
outputDeviceDescription
[
0
].
deviceType
==
audio
.
DeviceType
.
SPEAKER
)
{
flag
=
false
;
}
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
,
false
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
audioManager
.
isDeviceActive
(
2
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
false
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
'
+
value
);
}
else
if
(
value
==
false
&&
flag
==
true
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
'
+
value
+
'
flag is
'
+
flag
);
expect
(
true
).
assertTrue
();
}
else
if
(
value
==
true
&&
flag
==
false
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :
'
+
value
+
'
flag is
'
+
flag
);
//1�?
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :
'
+
value
);
console
.
info
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300 AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :value
'
+
value
+
'
flag is
'
+
flag
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -3800,6 +3674,7 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
...
...
@@ -3807,19 +3682,16 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
true
)
{
}
else
if
(
value
==
true
)
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -3833,21 +3705,20 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0100
'
,
1
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
8 bit
'
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
8 bit
'
);
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
8 bit
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -3860,21 +3731,21 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0200
'
,
1
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
4800
'
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
4800
'
);
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
4800
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -3887,21 +3758,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0300
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
longValue
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
longValue
);
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
longValue
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -3914,21 +3785,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0400
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
10.000000234324324324
'
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
10.000000234324324324
'
);
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
10.000000234324324324
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -3941,21 +3812,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0500
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
PPNumber
'
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
PPNumber
'
);
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
PPNumber
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -3968,21 +3838,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0600
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
[]
\
:";<>?,./~!@#$%^*()_+-={}|
'
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
[]
\
:";<>?,./~!@#$%^*()_+-={}|
'
);
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
[]
\
:";<>?,./~!@#$%^*()_+-={}|
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4000,8 +3870,8 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
...
...
@@ -4018,7 +3888,6 @@ describe('audioFramework', function () {
done
();
});
}
done
();
});
})
...
...
@@ -4036,25 +3905,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParam: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
~!@#$%^*()_+-={}|[]
\
:";<>?,./
'
)
{
}
else
if
(
value
==
'
~!@#$%^*()_+-={}|[]
\
:";<>?,./
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -4072,25 +3938,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback :getAudioParm: VOICE_PHONE_STATUS:Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
10000.21321432432432
'
)
{
}
else
if
(
value
==
'
10000.21321432432432
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -4108,25 +3971,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
{
done
();
}
else
{
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParam: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
5454
'
)
{
}
else
if
(
value
==
'
5454
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
}
done
();
});
})
...
...
@@ -4144,23 +4004,21 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
longValue
)
{
}
else
if
(
value
==
longValue
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4178,23 +4036,21 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
xyza
'
)
{
}
else
if
(
value
==
'
xyza
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4207,21 +4063,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0100
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
8 bit
'
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
8 bit
'
);
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
8 bit
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4234,21 +4089,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0200
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
4800
'
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
4800
'
);
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
4800
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4261,21 +4116,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0300
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
longValue
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
longValue
);
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
longValue
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4288,21 +4142,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0400
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
10.0000000000234
'
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
10.0000000000234
'
);
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
10.0000000000234
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4315,21 +4168,20 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0500
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
PPNumber
'
);
PROMISE
.
then
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
PPNumber
'
);
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
PPNumber
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4342,21 +4194,21 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0600
'
,
2
,
async
function
(
done
)
{
const
PROMISE
=
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
[]
\
:";<>?,./~!@#$%^*()_+-={}|
'
);
PROMISE
.
then
(
function
()
{
try
{
await
audioManager
.
setAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
'
[]
\
:";<>?,./~!@#$%^*()_+-={}|
'
);
console
.
info
(
'
AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter
'
);
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
).
then
(
function
(
value
)
{
let
value
=
await
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
);
if
(
value
==
'
[]
\
:";<>?,./~!@#$%^*()_+-={}|
'
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
});
});
await
PROMISE
;
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
done
();
})
...
...
@@ -4374,23 +4226,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
16 bit
'
)
{
}
else
if
(
value
==
'
16 bit
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4408,23 +4259,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
~!@#$%^*()_+-={}|[]
\
:";<>?,./
'
)
{
}
else
if
(
value
==
'
~!@#$%^*()_+-={}|[]
\
:";<>?,./
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4442,23 +4292,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
10000.21321432432432
'
)
{
}
else
if
(
value
==
'
10000.21321432432432
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4476,23 +4325,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
5454
'
)
{
}
else
if
(
value
==
'
5454
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4510,23 +4358,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
longValue
)
{
}
else
if
(
value
==
longValue
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4546,23 +4393,22 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
done
();
return
;
}
audioManager
.
getAudioParameter
(
'
VOICE_PHONE_STATUS
'
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
value
==
'
xyza
'
)
{
}
else
if
(
value
==
'
xyza
'
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :
'
+
value
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :
'
+
value
);
expect
(
false
).
assertTrue
();
}
done
();
});
done
();
});
})
...
...
@@ -4575,6 +4421,7 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0100
'
,
1
,
async
function
(
done
)
{
audioManager
=
audio
.
getAudioManager
();
audioManager
.
on
(
'
volumeChange
'
,
(
VolumeEvent
)
=>
{
console
.
log
(
'
AudioFrameworkTest: Volume Change Event is called
'
);
switch
(
VolumeEvent
.
volumeType
)
{
...
...
@@ -4594,9 +4441,16 @@ describe('audioFramework', function () {
expect
(
false
).
assertTrue
();
break
;
}
done
();
});
try
{
await
audioManager
.
setVolume
(
audioMedia
,
lowVol
);
console
.
info
(
'
setVolume success
'
)
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -4608,6 +4462,7 @@ describe('audioFramework', function () {
*@tc.level : Level 1
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0200
'
,
1
,
async
function
(
done
)
{
audioManager
=
audio
.
getAudioManager
();
audioManager
.
on
(
'
volumeChange
'
,
(
VolumeEvent
)
=>
{
console
.
log
(
'
AudioFrameworkTest: Volume Change Event is called
'
);
switch
(
VolumeEvent
.
volumeType
)
{
...
...
@@ -4627,9 +4482,16 @@ describe('audioFramework', function () {
expect
(
false
).
assertTrue
();
break
;
}
done
();
});
try
{
await
audioManager
.
setVolume
(
audioRingtone
,
lowVol
);
console
.
info
(
'
setVolume success
'
)
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -4641,6 +4503,7 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0300
'
,
2
,
async
function
(
done
)
{
audioManager
=
audio
.
getAudioManager
();
audioManager
.
on
(
'
volumeChange
'
,
(
VolumeEvent
)
=>
{
console
.
log
(
'
AudioFrameworkTest: Volume Change Event is called
'
);
switch
(
VolumeEvent
.
volumeType
)
{
...
...
@@ -4660,9 +4523,16 @@ describe('audioFramework', function () {
expect
(
false
).
assertTrue
();
break
;
}
done
();
});
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_CALL
,
lowVol
);
console
.
info
(
'
setVolume success
'
)
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -4674,6 +4544,7 @@ describe('audioFramework', function () {
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0400
'
,
2
,
async
function
(
done
)
{
audioManager
=
audio
.
getAudioManager
();
audioManager
.
on
(
'
volumeChange
'
,
(
VolumeEvent
)
=>
{
console
.
log
(
'
AudioFrameworkTest: Volume Change Event is called
'
);
switch
(
VolumeEvent
.
volumeType
)
{
...
...
@@ -4693,9 +4564,17 @@ describe('audioFramework', function () {
expect
(
false
).
assertTrue
();
break
;
}
done
();
});
try
{
await
audioManager
.
setVolume
(
audio
.
AudioVolumeType
.
VOICE_ASSISTANT
,
lowVol
);
console
.
info
(
'
setVolume success
'
)
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -4745,9 +4624,16 @@ describe('audioFramework', function () {
expect
(
false
).
assertTrue
();
break
;
}
done
();
});
try
{
await
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_VIBRATE
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -4771,9 +4657,16 @@ describe('audioFramework', function () {
expect
(
false
).
assertTrue
();
break
;
}
done
();
});
try
{
await
audioManager
.
setRingerMode
(
audio
.
AudioRingMode
.
RINGER_MODE_NORMAL
);
}
catch
(
err
)
{
console
.
log
(
'
err :
'
+
JSON
.
stringify
(
err
))
expect
(
false
).
assertTrue
();
done
();
}
})
/**
...
...
@@ -5033,7 +4926,6 @@ describe('audioFramework', function () {
AudioRoutingManager
.
getDevices
(
1
,
(
err
,
value
)
=>
{
// Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG
'
);
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest:Callback: OUTPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
...
...
@@ -5046,8 +4938,7 @@ describe('audioFramework', function () {
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5068,9 +4959,7 @@ describe('audioFramework', function () {
let
AudioRoutingManager
=
await
audioManager
.
getRoutingManager
();
AudioRoutingManager
.
getDevices
(
2
,
(
err
,
value
)
=>
{
// Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG
'
);
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest:Callback:INPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
...
...
@@ -5078,13 +4967,11 @@ describe('audioFramework', function () {
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5105,14 +4992,11 @@ describe('audioFramework', function () {
let
AudioRoutingManager
=
await
audioManager
.
getRoutingManager
();
AudioRoutingManager
.
getDevices
(
3
,
(
err
,
value
)
=>
{
// Getting all devies connected 3 = ALL_DEVICES_FLAG
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG
'
);
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest:Callback:ALL_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
...
...
@@ -5120,8 +5004,7 @@ describe('audioFramework', function () {
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5153,8 +5036,7 @@ describe('audioFramework', function () {
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5178,17 +5060,14 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest:Callback:INPUT_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5212,16 +5091,14 @@ describe('audioFramework', function () {
if
(
err
)
{
console
.
error
(
`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices
${
err
.
message
}
`
);
expect
().
assertFail
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG
'
);
value
.
forEach
(
displayDeviceProp
);
if
(
dTValue
!=
null
&&
dRValue
!=
null
&&
devId
>
0
&&
sRate
!=
null
&&
cCount
!=
null
&&
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5247,8 +5124,7 @@ describe('audioFramework', function () {
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices:OUTPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices:OUTPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
@@ -5277,8 +5153,7 @@ describe('audioFramework', function () {
cMask
!=
null
)
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS
'
);
expect
(
true
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL
'
);
expect
(
false
).
assertTrue
();
}
...
...
multimedia/audio/audio_js_standard/audioRenderer/Test.json
浏览文件 @
93ded1b4
...
...
@@ -17,7 +17,8 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/media"
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files"
,
"chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry"
],
"cleanup-apps"
:
true
},
...
...
@@ -38,12 +39,7 @@
"./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/"
,
"./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/"
,
"./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/"
,
"./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/"
,
"./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/media"
,
"./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/media"
,
"./resource/audio/audioManager/safe_and_sound_32.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/media"
,
"./resource/audio/audioManager/test.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/media"
,
"./resource/audio/audioManager/test.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/media"
"./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/"
]
}
]
...
...
multimedia/audio/audio_js_standard/audioVoip/Test.json
浏览文件 @
93ded1b4
...
...
@@ -17,7 +17,8 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiovoip/haps/entry/files/media"
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiovoip/haps/entry/files"
,
"chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiovoip/haps/entry"
],
"cleanup-apps"
:
true
},
...
...
multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js
浏览文件 @
93ded1b4
...
...
@@ -27,30 +27,32 @@ describe('audioVoip', function () {
let
readpath
;
let
fdPath
;
let
filePath
;
let
TagRender
=
"
AudioFrameworkRenderLog
"
;
let
TagRec
=
"
AudioFrameworkRecLog
"
;
const
AUDIOMANAGER
=
audio
.
getAudioManager
();
console
.
info
(
'
AudioFrameworkRenderLog: Create AudioManger Object JS Framework
'
);
console
.
info
(
`
${
TagRender
}
: Create AudioManger Object JS Framework`
);
beforeAll
(
async
function
()
{
console
.
info
(
'
AudioFrameworkTest: beforeAll: Prerequisites at the test suite level
'
);
console
.
info
(
`AudioFrameworkTest: beforeAll: Prerequisites at the test suite level`
);
let
permissionName1
=
'
ohos.permission.MICROPHONE
'
;
let
permissionNameList
=
[
permissionName1
];
let
appName
=
'
ohos.acts.multimedia.audio.audiovoip
'
;
await
audioTestBase
.
applyPermission
(
appName
,
permissionNameList
);
await
sleep
(
100
);
console
.
info
(
'
AudioFrameworkTest: beforeAll: END
'
);
console
.
info
(
`AudioFrameworkTest: beforeAll: END`
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
AudioFrameworkTest: beforeEach: Prerequisites at the test case level
'
);
console
.
info
(
`AudioFrameworkTest: beforeEach: Prerequisites at the test case level`
);
await
sleep
(
1000
);
})
afterEach
(
function
()
{
console
.
info
(
'
AudioFrameworkTest: afterEach: Test case-level clearance conditions
'
);
console
.
info
(
`AudioFrameworkTest: afterEach: Test case-level clearance conditions`
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
AudioFrameworkTest: afterAll: Test suite-level cleanup condition
'
);
console
.
info
(
`AudioFrameworkTest: afterAll: Test suite-level cleanup condition`
);
})
function
sleep
(
ms
)
{
...
...
@@ -59,176 +61,181 @@ describe('audioVoip', function () {
async
function
getAbilityInfo
(
fileName
)
{
let
context
=
await
featureAbility
.
getContext
();
console
.
info
(
"
case0 context is
"
+
context
);
console
.
info
(
`case0 context is "
${
context
}
`
);
await
context
.
getFilesDir
().
then
((
data
)
=>
{
console
.
info
(
"
case1 getFilesDir is path
"
+
data
);
console
.
info
(
`case1 getFilesDir path is :
${
data
}
`
);
mediaDir
=
data
+
'
/
'
+
fileName
;
console
.
info
(
'
case2 mediaDir is
'
+
mediaDir
);
})
console
.
info
(
`case2 mediaDir is :
${
mediaDir
}
`
);
}).
catch
(
error
=>
{
console
.
log
(
`
${
TagRender
}
:case getFileDir err:
${
error
}
`
);
});
}
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
'
AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:
'
+
fileName
);
}).
catch
(
err
or
=>
{
console
.
log
(
'
AudioFrameworkRenderLog:case closeRawFileDescriptor err:
'
+
error
);
console
.
log
(
`
${
TagRender
}
:case closeRawFileDescriptor success for file:
${
fileName
}
`
);
}).
catch
(
err
=>
{
console
.
log
(
`
${
TagRender
}
:case closeRawFileDescriptor err:
${
err
}
`
);
});
}).
catch
(
error
=>
{
console
.
log
(
`
${
TagRender
}
:case getResourceManager err:
${
error
}
`
);
});
}
async
function
getFdRead
(
pathName
)
{
let
context
=
await
featureAbility
.
getContext
();
console
.
info
(
"
case0 context is
"
+
context
);
console
.
info
(
`case0 context is
${
context
}
`
);
await
context
.
getFilesDir
().
then
((
data
)
=>
{
console
.
info
(
"
case1 getFilesDir is path
"
+
data
);
console
.
info
(
`case1 getFilesDir path is :
${
data
}
`
);
filePath
=
data
+
'
/
'
+
pathName
;
console
.
info
(
'
case4 filePath is
'
+
filePath
);
})
console
.
info
(
`case4 filePath is :
${
filePath
}
`
);
}).
catch
(
err
=>
{
console
.
log
(
`
${
TagRender
}
:case getFilesDir err:
${
err
}
`
);
});
fdPath
=
'
fd://
'
;
await
fileio
.
open
(
filePath
).
then
((
fdNumber
)
=>
{
fdPath
=
fdPath
+
''
+
fdNumber
;
fdRead
=
fdNumber
;
console
.
info
(
'
[fileIO]case open fd success,fdPath is
'
+
fdPath
);
console
.
info
(
'
[fileIO]case open fd success,fdRead is
'
+
fdRead
);
console
.
info
(
`[fileIO]case open fd success,fdPath is :
${
fdPath
}
`
);
console
.
info
(
`[fileIO]case open fd success,fdRead is :
${
fdRead
}
`
);
},
(
err
)
=>
{
console
.
info
(
'
[fileIO]case open fd failed
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[fileIO]case catch open fd failed
'
);
console
.
info
(
`[fileIO]case open fd err :
${
err
}
`
);
}).
catch
((
err
or
)
=>
{
console
.
info
(
`[fileIO]case catch open fd failed :
${
error
}
`
);
});
}
async
function
playbackPromise
(
AudioRendererOptions
,
pathName
)
{
let
resultFlag
=
'
new
'
;
console
.
info
(
'
AudioFrameworkRenderLog: Promise : Audio Playback Function
'
);
console
.
info
(
`
${
TagRender
}
: Promise : Audio Playback Function`
);
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS
'
);
console
.
info
(
`
${
TagRender
}
: AudioRender Created : Success : Stream Type: SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRender
}
: AudioRender Created : ERROR :
${
err
.
message
}
`
);
return
resultFlag
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : Path :
'
+
pathName
);
console
.
info
(
`
${
TagRender
}
: AudioRenderer : Path :
${
pathName
}
`
);
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
`
${
TagRender
}
: 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
);
console
.
info
(
`
${
TagRender
}
: Renderer getStreamInfo:`
);
console
.
info
(
`
${
TagRender
}
: Renderer sampleFormat:
${
audioParamsGet
.
sampleFormat
}
`
);
console
.
info
(
`
${
TagRender
}
: Renderer samplingRate:
${
audioParamsGet
.
samplingRate
}
`
);
console
.
info
(
`
${
TagRender
}
: Renderer channels:
${
audioParamsGet
.
channels
}
`
);
console
.
info
(
`
${
TagRender
}
: Renderer encodingType:
${
audioParamsGet
.
encodingType
}
`
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: getStreamInfo :ERROR:
'
+
err
.
message
);
console
.
log
(
`
${
TagRender
}
: getStreamInfo :ERROR:
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
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
);
console
.
info
(
`
${
TagRender
}
: Renderer RendererInfo:`
);
console
.
info
(
`
${
TagRender
}
: Renderer content type:
${
audioParamsGet
.
content
}
`
);
console
.
info
(
`
${
TagRender
}
: Renderer usage:
${
audioParamsGet
.
usage
}
`
);
console
.
info
(
`
${
TagRender
}
: Renderer rendererFlags:
${
audioParamsGet
.
rendererFlags
}
`
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: RendererInfo :ERROR:
'
+
err
.
message
);
console
.
log
(
`
${
TagRender
}
: RendererInfo :ERROR:
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
console
.
info
(
`
${
TagRender
}
: renderInstant started :SUCCESS `
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRender
}
: renderInstant start :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
`
${
TagRender
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
let
bufferSize
;
await
audioRen
.
getBufferSize
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getBufferSize :SUCCESS
'
+
data
);
console
.
info
(
`
${
TagRender
}
: getBufferSize :SUCCESS
${
data
}
`
);
bufferSize
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getBufferSize :ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRender
}
: getBufferSize :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
let
ss
=
fileio
.
fdopenStreamSync
(
fdRead
,
'
r
'
);
console
.
info
(
'
AudioFrameworkRenderLog:case2: File Path:
'
+
ss
);
console
.
info
(
`
${
TagRender
}
: case2: File Path:
${
ss
}
`
);
let
discardHeader
=
new
ArrayBuffer
(
44
);
ss
.
readSync
(
discardHeader
);
let
totalSize
=
fileio
.
fstatSync
(
fdRead
).
size
;
console
.
info
(
'
AudioFrameworkRenderLog:case3: File totalSize size:
'
+
totalSize
);
console
.
info
(
`
${
TagRender
}
: case3: File totalSize size:
${
totalSize
}
`
);
totalSize
=
totalSize
-
44
;
console
.
info
(
'
AudioFrameworkRenderLog: File size : Removing header:
'
+
totalSize
);
console
.
info
(
`
${
TagRender
}
: File size : Removing header:
${
totalSize
}
`
);
let
rlen
=
0
;
while
(
rlen
<
totalSize
/
4
)
{
let
buf
=
new
ArrayBuffer
(
bufferSize
);
rlen
+=
ss
.
readSync
(
buf
);
console
.
info
(
'
AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file:
'
+
rlen
);
console
.
info
(
`
${
TagRender
}
: BufferAudioFramework: bytes read from file:
${
rlen
}
`
);
await
audioRen
.
write
(
buf
);
if
(
rlen
>
(
totalSize
/
2
))
{
await
AUDIOMANAGER
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value :
'
+
data
);
console
.
info
(
`
${
TagRender
}
:AudioFrameworkAudioScene: getAudioScene : Value :
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRender
}
:AudioFrameworkAudioScene: getAudioScene : ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
}
}
console
.
info
(
'
AudioFrameworkRenderLog: Renderer after read
'
);
console
.
info
(
`
${
TagRender
}
: Renderer after read`
);
await
audioRen
.
drain
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer drained : SUCCESS
'
);
console
.
info
(
`
${
TagRender
}
: Renderer drained : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkRenderLog: Renderer drain: ERROR :
'
+
err
.
message
);
console
.
error
(
`
${
TagRender
}
: Renderer drain: ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
`
${
TagRender
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
await
audioRen
.
stop
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stopped : SUCCESS
'
);
console
.
info
(
`
${
TagRender
}
: Renderer stopped : SUCCESS`
);
resultFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: resultFlagRen :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlagRen :
${
resultFlag
}
`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stop:ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRender
}
: Renderer stop:ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
`
${
TagRender
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
await
audioRen
.
release
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release : SUCCESS
'
);
console
.
info
(
`
${
TagRender
}
: Renderer release : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release :ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRender
}
: Renderer release :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
...
...
@@ -236,131 +243,131 @@ describe('audioVoip', function () {
async
function
recPromise
(
AudioCapturerOptions
,
fpath
)
{
let
resultFlag
=
'
new
'
;
console
.
info
(
'
AudioFrameworkRecLog: Promise : Audio Recording Function
'
);
console
.
info
(
`
${
TagRec
}
: Promise : Audio Recording Function`
);
let
audioCap
;
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
).
then
(
async
function
(
data
)
{
audioCap
=
data
;
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS
'
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer Created : Success : Stream Type: SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer Created : ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer Created : ERROR :
${
err
.
message
}
`
);
return
resultFlag
;
});
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : Path :
'
+
fpath
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer : Path :
${
fpath
}
`
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCap
.
state
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer : STATE :
${
audioCap
.
state
}
`
);
await
audioCap
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
if
(
audioParamsGet
!=
undefined
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer samplingRate:
'
+
audioParamsGet
.
samplingRate
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer channels:
'
+
audioParamsGet
.
channels
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer encodingType:
'
+
audioParamsGet
.
encodingType
);
console
.
info
(
`
${
TagRec
}
: Capturer getStreamInfo:`
);
console
.
info
(
`
${
TagRec
}
: Capturer sampleFormat:
${
audioParamsGet
.
sampleFormat
}
`
);
console
.
info
(
`
${
TagRec
}
: Capturer samplingRate:
${
audioParamsGet
.
samplingRate
}
`
);
console
.
info
(
`
${
TagRec
}
: Capturer channels:
${
audioParamsGet
.
channels
}
`
);
console
.
info
(
`
${
TagRec
}
: Capturer encodingType:
${
audioParamsGet
.
encodingType
}
`
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: audioParamsGet is :
'
+
audioParamsGet
);
console
.
info
(
'
AudioFrameworkRecLog: audioParams getStreamInfo are incorrect:
'
);
console
.
info
(
`
${
TagRec
}
: audioParamsGet is :
${
audioParamsGet
}
`
);
console
.
info
(
`
${
TagRec
}
: audioParams getStreamInfo are incorrect: `
);
resultFlag
=
false
;
}
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRecLog: getStreamInfo :ERROR:
'
+
err
.
message
);
console
.
log
(
`
${
TagRec
}
: getStreamInfo :ERROR:
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRecLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRec
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
await
audioCap
.
getCapturerInfo
().
then
(
async
function
(
audioParamsGet
)
{
if
(
audioParamsGet
!=
undefined
)
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer CapturerInfo:
'
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer SourceType:
'
+
audioParamsGet
.
source
);
console
.
info
(
'
AudioFrameworkRecLog: Capturer capturerFlags:
'
+
audioParamsGet
.
capturerFlags
);
console
.
info
(
`
${
TagRec
}
: Capturer CapturerInfo:`
);
console
.
info
(
`
${
TagRec
}
: Capturer SourceType:
${
audioParamsGet
.
source
}
`
);
console
.
info
(
`
${
TagRec
}
: Capturer capturerFlags:
${
audioParamsGet
.
capturerFlags
}
`
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: audioParamsGet is :
'
+
audioParamsGet
);
console
.
info
(
'
AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect:
'
);
console
.
info
(
`
${
TagRec
}
: audioParamsGet is :
${
audioParamsGet
}
`
);
console
.
info
(
`
${
TagRec
}
: audioParams getCapturerInfo are incorrect: `
);
resultFlag
=
false
;
}
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRecLog: CapturerInfo :ERROR:
'
+
err
.
message
);
console
.
log
(
`
${
TagRec
}
: CapturerInfo :ERROR:
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRecLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRec
}
: resultFlag :
${
esultFlag
}
`
);
return
resultFlag
;
}
await
audioCap
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer started :SUCCESS
'
);
console
.
info
(
`
${
TagRec
}
: Capturer started :SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRec
}
: Capturer start :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
if
(
resultFlag
==
false
)
{
console
.
info
(
'
AudioFrameworkRecLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRec
}
: resultFlag :
${
resultFlag
}
`
);
return
resultFlag
;
}
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCap
.
state
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer : STATE :
${
audioCap
.
state
}
`
);
let
bufferSize
=
await
audioCap
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRecLog: buffer size:
'
+
bufferSize
);
console
.
info
(
`
${
TagRec
}
: buffer size:
${
bufferSize
}
`
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd created
'
);
console
.
info
(
`
${
TagRec
}
: file fd created`
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer start :ERROR :
'
);
console
.
info
(
`
${
TagRec
}
: Capturer start :ERROR : `
);
resultFlag
=
false
;
return
resultFlag
;
}
fd
=
fileio
.
openSync
(
fpath
,
0o2002
,
0o666
);
if
(
fd
!==
null
)
{
console
.
info
(
'
AudioFrameworkRecLog: file fd opened : Append Mode :PASS
'
);
console
.
info
(
`
${
TagRec
}
: file fd opened : Append Mode :PASS`
);
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED
'
);
console
.
info
(
`
${
TagRec
}
: file fd Open: Append Mode : FAILED`
);
resultFlag
=
false
;
return
resultFlag
;
}
await
sleep
(
100
);
let
numBuffersToCapture
=
45
;
while
(
numBuffersToCapture
)
{
console
.
info
(
'
AudioFrameworkRecLog: ---------READ BUFFER---------
'
);
console
.
info
(
`
${
TagRec
}
: ---------READ BUFFER---------`
);
let
buffer
=
await
audioCap
.
read
(
bufferSize
,
true
);
await
sleep
(
50
);
console
.
info
(
'
AudioFrameworkRecLog: ---------WRITE BUFFER---------
'
);
console
.
info
(
`
${
TagRec
}
: ---------WRITE BUFFER---------`
);
let
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
'
AudioFrameworkRecLog:BufferRecLog: data written:
'
+
number
);
console
.
info
(
`
${
TagRec
}
:BufferRecLog: data written:
${
number
}
`
);
await
sleep
(
50
);
numBuffersToCapture
--
;
}
await
sleep
(
1000
);
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCap
.
state
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer : STATE :
${
audioCap
.
state
}
`
);
await
audioCap
.
stop
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer stopped : SUCCESS
'
);
console
.
info
(
`
${
TagRec
}
: Capturer stopped : SUCCESS`
);
resultFlag
=
true
;
console
.
info
(
'
AudioFrameworkRecLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRec
}
: resultFlag :
${
resultFlag
}
`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer stop:ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRec
}
: Capturer stop:ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCap
.
state
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer : STATE :
${
audioCap
.
state
}
`
);
await
audioCap
.
release
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release : SUCCESS
'
);
console
.
info
(
`
${
TagRec
}
: Capturer release : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRecLog: Capturer release :ERROR :
'
+
err
.
message
);
console
.
info
(
`
${
TagRec
}
: Capturer release :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRecLog: AudioCapturer : STATE :
'
+
audioCap
.
state
);
console
.
info
(
`
${
TagRec
}
: AudioCapturer : STATE :
${
audioCap
.
state
}
`
);
return
resultFlag
;
...
...
@@ -397,7 +404,7 @@ describe('audioVoip', function () {
await
getFdRead
(
"
StarWars10s-1C-44100-2SW.wav
"
);
let
resultFlag
=
await
playbackPromise
(
AudioRendererOptions
,
filePath
,
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
);
await
sleep
(
100
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
expect
(
resultFlag
).
assertTrue
();
await
closeFileDescriptor
(
filePath
);
done
();
...
...
@@ -433,7 +440,7 @@ describe('audioVoip', function () {
await
getAbilityInfo
(
"
capture_js-44100-2C-16B.pcm
"
);
let
resultFlag
=
await
recPromise
(
AudioCapturerOptions
,
mediaDir
);
await
sleep
(
100
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
expect
(
resultFlag
).
assertTrue
();
done
();
})
...
...
@@ -491,7 +498,7 @@ describe('audioVoip', function () {
await
getFdRead
(
readpath
);
let
resultFlag
=
await
playbackPromise
(
AudioRendererOptions
,
readpath
);
await
sleep
(
100
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
console
.
info
(
`
${
TagRender
}
: resultFlag :
${
resultFlag
}
`
);
expect
(
resultFlag
).
assertTrue
();
await
closeFileDescriptor
(
readpath
);
done
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录