Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
593c78ec
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看板
提交
593c78ec
编写于
3月 09, 2022
作者:
G
Gagan P
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updating Audio Standard JS Test scripts - Issue fix
Signed-off-by:
N
Gagan P
<
gagan.gowda@huawei.com
>
上级
9b1be37e
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
3544 addition
and
2115 deletion
+3544
-2115
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
...dard/audioManager/src/main/js/test/AudioFramework.test.js
+2049
-1792
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js
...ndard/audioManager/src/main/js/test/AudioRenderer.test.js
+346
-0
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js
...io_js_standard/audioManager/src/main/js/test/List.test.js
+1
-1
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js
...dard/audioManager/src/main/js/test/RingtonePlayer.test.js
+186
-184
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js
...standard/audioManager/src/main/js/test/SR000GHLLV.test.js
+920
-128
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js
...standard/audioManager/src/main/js/test/SR000GHQBN.test.js
+42
-10
未找到文件。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
浏览文件 @
593c78ec
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js
浏览文件 @
593c78ec
...
@@ -7855,4 +7855,350 @@ describe('audioRenderer', function () {
...
@@ -7855,4 +7855,350 @@ describe('audioRenderer', function () {
})
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_108
* @tc.name : AudioState - STATE_INVALID
* @tc.desc : AudioState - STATE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_108
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioState
.
STATE_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_109
* @tc.name : AudioState - STATE_NEW
* @tc.desc : AudioState - STATE_NEW
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_109
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioState
.
STATE_NEW
).
assertEqual
(
0
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_110
* @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID
* @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_110
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_111
* @tc.name : SourceType - SOURCE_TYPE_INVALID
* @tc.desc : SourceType - SOURCE_TYPE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_111
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
SourceType
.
SOURCE_TYPE_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_112
* @tc.name : AudioRenderer - Pause - Callback
* @tc.desc : AudioRenderer - Pause - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_112
'
,
0
,
async
function
(
done
)
{
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_RINGTONE
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_NOTIFICATION_RINGTONE
,
rendererFlags
:
1
}
var
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
var
resultFlag
=
false
;
var
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
audioRen
.
on
(
'
stateChange
'
,(
AudioState
)
=>
{
console
.
log
(
'
AudioFrameworkTest: Volume Change Event is called
'
);
switch
(
AudioState
)
{
case
audio
.
AudioState
.
STATE_PAUSED
:
console
.
info
(
'
AudioFrameworkTest: state : STATE_PAUSED
'
);
resultFlag
=
true
;
break
;
default
:
console
.
info
(
'
AudioFrameworkTest: state :
'
+
AudioState
);
break
;
}
});
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
await
sleep
(
2000
);
audioRen
.
pause
((
err
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant Pause :ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant Pause :SUCCESS
'
);
}
});
await
sleep
(
500
);
await
audioRen
.
stop
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stopped : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stop:ERROR :
'
+
err
.
message
);
});
await
sleep
(
500
);
await
audioRen
.
release
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release :ERROR :
'
+
err
.
message
);
});
await
sleep
(
500
)
expect
(
resultFlag
).
assertTrue
();
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_113
* @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback
* @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_113
'
,
0
,
async
function
(
done
)
{
var
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
var
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_RINGTONE
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_NOTIFICATION_RINGTONE
,
rendererFlags
:
1
}
var
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
var
fpath
=
mediaDir
+
'
/StarWars10s-2C-48000-4SW.wav
'
;
var
AudioScene
=
audio
.
AudioScene
.
AUDIO_SCENE_DEFAULT
;
var
resultFlag
=
true
;
console
.
info
(
'
AudioFrameworkRenderLog: Promise : Audio Playback Function
'
);
var
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : Path :
'
+
fpath
);
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioManager
.
setAudioScene
(
AudioScene
).
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : SUCCESS
'
);
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: setAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
getStreamInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer getStreamInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer sampleFormat:
'
+
audioParamsGet
.
sampleFormat
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer samplingRate:
'
+
audioParamsGet
.
samplingRate
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer channels:
'
+
audioParamsGet
.
channels
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer encodingType:
'
+
audioParamsGet
.
encodingType
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: getStreamInfo :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
});
await
audioRen
.
getRendererInfo
().
then
(
async
function
(
audioParamsGet
)
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer RendererInfo:
'
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer content type:
'
+
audioParamsGet
.
content
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer usage:
'
+
audioParamsGet
.
usage
);
console
.
info
(
'
AudioFrameworkRenderLog: Renderer rendererFlags:
'
+
audioParamsGet
.
rendererFlags
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
AudioFrameworkRenderLog: RendererInfo :ERROR:
'
+
err
.
message
);
resultFlag
=
false
;
});
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
var
bufferSize
=
await
audioRen
.
getBufferSize
();
console
.
info
(
'
AudioFrameworkRenderLog: buffer size:
'
+
bufferSize
);
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r
'
);
console
.
info
(
'
AudioFrameworkRenderLog: File Path:
'
+
fpath
);
let
discardHeader
=
new
ArrayBuffer
(
44
);
ss
.
readSync
(
discardHeader
);
let
totalSize
=
fileio
.
statSync
(
fpath
).
size
;
console
.
info
(
'
AudioFrameworkRenderLog: File totalSize size:
'
+
totalSize
);
totalSize
=
totalSize
-
44
;
console
.
info
(
'
AudioFrameworkRenderLog: File size : Removing header:
'
+
totalSize
);
let
rlen
=
0
;
while
(
rlen
<
totalSize
)
{
let
buf
=
new
ArrayBuffer
(
bufferSize
);
rlen
+=
ss
.
readSync
(
buf
);
console
.
info
(
'
BufferAudioFramework: bytes read from file:
'
+
rlen
);
await
audioRen
.
write
(
buf
);
if
(
rlen
>
(
totalSize
/
2
)){
await
audioManager
.
getAudioScene
().
then
(
async
function
(
data
)
{
console
.
info
(
'
AudioFrameworkAudioScene: getAudioScene : Value :
'
+
data
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkAudioScene: getAudioScene : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
});
}
if
(
rlen
>
(
totalSize
/
2
)){
audioRen
.
setRenderRate
(
audio
.
AudioRendererRate
.
RENDER_RATE_DOUBLE
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS
'
);
}
});
}
}
console
.
info
(
'
AudioFrameworkRenderLog: Renderer after read
'
);
audioRen
.
getRenderRate
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR :
'
+
err
.
message
);
resultFlag
=
false
;
}
else
if
(
data
==
audio
.
AudioRendererRate
.
RENDER_RATE_DOUBLE
){
console
.
info
(
'
AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS :
'
+
data
);
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL :
'
+
data
);
resultFlag
=
false
;
}
});
await
audioRen
.
drain
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer drained : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
AudioFrameworkRenderLog: Renderer drain: ERROR :
'
+
err
.
message
);
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
stop
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stopped : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer stop:ERROR :
'
+
err
.
message
);
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
await
audioRen
.
release
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release : SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: Renderer release :ERROR :
'
+
err
.
message
);
});
console
.
info
(
'
AudioFrameworkRenderLog: AudioRenderer : STATE :
'
+
audioRen
.
state
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
await
sleep
(
500
)
expect
(
resultFlag
).
assertTrue
();
done
();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_114
* @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID
* @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_RENDERER_Play_audio_114
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
AudioEncodingType
.
ENCODING_TYPE_INVALID
).
assertEqual
(
-
1
);
await
sleep
(
50
);
done
();
})
})
})
\ No newline at end of file
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js
浏览文件 @
593c78ec
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
require
(
'
./AudioFramework.test.js
'
)
require
(
'
./AudioFramework.test.js
'
)
require
(
'
./AudioPerf.test.js
'
)
//
require('./AudioPerf.test.js')
require
(
'
./AudioRenderer.test.js
'
)
require
(
'
./AudioRenderer.test.js
'
)
require
(
'
./SR000GHLLV.test.js
'
)
require
(
'
./SR000GHLLV.test.js
'
)
require
(
'
./AudioCall.test.js
'
)
require
(
'
./AudioCall.test.js
'
)
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js
浏览文件 @
593c78ec
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js
浏览文件 @
593c78ec
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js
浏览文件 @
593c78ec
...
@@ -1303,7 +1303,7 @@ describe('audioManger', function () {
...
@@ -1303,7 +1303,7 @@ describe('audioManger', function () {
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037
'
,
0
,
async
function
(
done
)
{
await
audioManager
.
setDeviceActive
(
audio
.
DeviceType
.
SPEAKER
,
false
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
DeviceType
.
SPEAKER
,
false
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
});
var
setflag
;
var
setflag
;
...
@@ -1330,7 +1330,7 @@ describe('audioManger', function () {
...
@@ -1330,7 +1330,7 @@ describe('audioManger', function () {
});
});
await
audioManager
.
setDeviceActive
(
audio
.
DeviceType
.
SPEAKER
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
DeviceType
.
SPEAKER
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
});
done
();
done
();
...
@@ -1367,7 +1367,7 @@ describe('audioManger', function () {
...
@@ -1367,7 +1367,7 @@ describe('audioManger', function () {
});
});
await
audioManager
.
setDeviceActive
(
2
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
2
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
});
})
})
...
@@ -1400,7 +1400,7 @@ describe('audioManger', function () {
...
@@ -1400,7 +1400,7 @@ describe('audioManger', function () {
});
});
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
BLUETOOTH_SCO
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
BLUETOOTH_SCO
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error:
${
err
.
message
}
`
);
});
});
done
();
done
();
...
@@ -1437,7 +1437,7 @@ describe('audioManger', function () {
...
@@ -1437,7 +1437,7 @@ describe('audioManger', function () {
});
});
await
audioManager
.
setDeviceActive
(
7
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
7
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error:
${
err
.
message
}
`
);
});
});
done
();
done
();
...
@@ -1472,7 +1472,7 @@ describe('audioManger', function () {
...
@@ -1472,7 +1472,7 @@ describe('audioManger', function () {
});
});
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
});
});
done
();
done
();
...
@@ -1515,7 +1515,7 @@ describe('audioManger', function () {
...
@@ -1515,7 +1515,7 @@ describe('audioManger', function () {
});
});
await
audioManager
.
setDeviceActive
(
3
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
3
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
});
});
done
();
done
();
...
@@ -1543,19 +1543,19 @@ describe('audioManger', function () {
...
@@ -1543,19 +1543,19 @@ describe('audioManger', function () {
await
sleep
(
1000
);
await
sleep
(
1000
);
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error:
${
err
.
message
}
`
);
});
});
await
sleep
(
5000
);
await
sleep
(
5000
);
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
SPEAKER
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error:
${
err
.
message
}
`
);
});
});
await
sleep
(
5000
);
await
sleep
(
5000
);
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
await
audioManager
.
setDeviceActive
(
audio
.
ActiveDeviceType
.
WIRED_HEADSET
,
true
).
then
(
function
(){
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active Again
'
);
console
.
info
(
'
AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active Again
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate Again: Error:
${
err
.
message
}
`
);
console
.
error
(
`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate Again: Error:
${
err
.
message
}
`
);
});
});
await
sleep
(
5000
);
await
sleep
(
5000
);
...
@@ -1577,4 +1577,36 @@ describe('audioManger', function () {
...
@@ -1577,4 +1577,36 @@ describe('audioManger', function () {
done
();
done
();
})
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_DeviceType_001
* @tc.name : DeviceType - INVALID
* @tc.desc : DeviceType - INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_DeviceType_001
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
DeviceType
.
INVALID
).
assertEqual
(
0
);
await
sleep
(
50
);
done
();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_DeviceType_002
* @tc.name : DeviceType - WIRED_HEADSET
* @tc.desc : DeviceType - WIRED_HEADSET
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_AUDIO_MANAGER_DeviceType_001
'
,
0
,
async
function
(
done
)
{
expect
(
audio
.
DeviceType
.
WIRED_HEADSET
).
assertEqual
(
3
);
await
sleep
(
50
);
done
();
})
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录