Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3282be21
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看板
未验证
提交
3282be21
编写于
5月 25, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 25, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8753 解决AVPlayerLocalTest两条case执行断言异常bug 解决avRecorder个别case阻塞bug 4.0beta1
Merge pull request !8753 from Nicklaus/OpenHarmony-4.0-Beta1
上级
f52e34fd
aa697236
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
329 addition
and
96 deletion
+329
-96
multimedia/media/media_js_standard/AVPlayerTestBase.js
multimedia/media/media_js_standard/AVPlayerTestBase.js
+18
-16
multimedia/media/media_js_standard/AVRecorderTestBase.js
multimedia/media/media_js_standard/AVRecorderTestBase.js
+28
-74
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+6
-1
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerLocalTest.test.js
...vPlayer/entry/src/main/ets/test/AVPlayerLocalTest.test.js
+2
-2
multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js
...rd/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js
+275
-3
未找到文件。
multimedia/media/media_js_standard/AVPlayerTestBase.js
浏览文件 @
3282be21
...
...
@@ -609,28 +609,30 @@ export async function seekLoop(src, avPlayer, done) {
},
(
err
)
=>
{
console
.
error
(
'
seekLoop play filed,error message is :
'
+
err
.
message
)
})
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PLAYING
){
console
.
info
(
'
seekLoop avPlayer from play to seek
'
)
// play seek loop 1000 times
for
(
var
loopTime
=
0
;
loopTime
<
1000
;
loopTime
++
){
avPlayer
.
seek
(
loopTime
)
console
.
info
(
`case seekLoopWithCallback loopTime is
${
loopTime
}
`
);
}
}
await
seekLoopWithCallback
(
avPlayer
)
console
.
info
(
'
seekLoop avPlayer from play to seek
'
)
// play seek loop 1000 times
await
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
(
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
(
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
async
function
seekLoopWithCallback
(
avPlayer
)
{
avPlayer
.
on
(
'
seekDone
'
,
async
(
seekDoneTime
)
=>
{
console
.
info
(
`case seekDone called seekDoneTime is
${
seekDoneTime
}
`
);
});
for
(
let
loopTime
=
0
;
loopTime
<
5000
;
loopTime
+=
5
)
{
await
new
Promise
(
resolve
=>
{
avPlayer
.
on
(
'
seekDone
'
,
seekDoneTime
=>
{
console
.
info
(
`case seekDone called seekDoneTime is
${
seekDoneTime
}
`
);
resolve
();
});
avPlayer
.
seek
(
loopTime
);
console
.
info
(
`case seekLoopWithCallback loopTime is
${
loopTime
}
`
);
});
}
}
export
async
function
seekLoopWithoutCallback
(
src
,
avPlayer
,
done
)
{
...
...
multimedia/media/media_js_standard/AVRecorderTestBase.js
浏览文件 @
3282be21
...
...
@@ -943,54 +943,20 @@ export async function avRecorderLoopCreate2ReleaseWithCallback(avConfig, avRecor
}
}
export
async
function
avRecorderLoopPrepare2StopWithCallback
(
avConfig
,
avRecorder
,
loopTimes
,
done
)
{
export
async
function
avRecorderLoopPrepare2StopWithCallback
(
avConfig
,
avRecorder
,
done
,
eventEmitter
,
mySteps
)
{
avRecorder
=
await
idle
(
avRecorder
);
sleep
(
200
)
await
preparePromise
(
avRecorder
,
avConfig
);
sleep
(
200
)
while
(
loopTimes
>
0
)
{
startCallback
(
avRecorder
,
200
);
stopCallback
(
avRecorder
);
sleep
(
200
)
loopTimes
--
;
console
.
info
(
`avRecorderLoopPrepare2StopWithCallback loop time is :
${
loopTimes
}
`
)
if
(
loopTimes
==
0
){
await
avRecorder
.
release
().
then
(()
=>
{
console
.
info
(
`avRecorderLoopPrepare2StopWithCallback release success`
)
}).
catch
((
err
)
=>
{
console
.
info
(
'
release avRecorderLoopPrepare2StopWithCallback failed and catch error is
'
+
err
.
message
);
});
done
();
}
else
{
await
preparePromise
(
avRecorder
,
avConfig
);
sleep
(
200
);
}
}
eventEmitter
.
emit
(
mySteps
[
0
],
avRecorder
,
avConfig
,
3000
,
mySteps
,
done
);
}
export
async
function
avRecorderLoopPause2ResumeWithCallback
(
avConfig
,
avRecorder
,
loopTimes
,
done
)
{
export
async
function
avRecorderLoopPause2ResumeWithCallback
(
avConfig
,
avRecorder
,
done
,
eventEmitter
,
mySteps
)
{
avRecorder
=
await
idle
(
avRecorder
);
console
.
info
(
'
case avConfig.url is
'
+
avConfig
.
url
);
await
preparePromise
(
avRecorder
,
avConfig
);
sleep
(
2000
)
await
startPromise
(
avRecorder
);
while
(
loopTimes
>
0
)
{
pauseCallback
(
avRecorder
);
resumeCallback
(
avRecorder
);
await
sleep
(
50
)
console
.
info
(
`avRecorderLoopPause2ResumeWithCallback loop time is :
${
loopTimes
}
`
)
loopTimes
--
;
if
(
loopTimes
==
0
){
await
sleep
(
2000
)
await
avRecorder
.
release
().
then
(()
=>
{
console
.
info
(
`avRecorderLoopPause2ResumeWithCallback release success`
)
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
release avRecorderLoopPause2ResumeWithCallback failed and catch error is
'
+
err
.
message
);
});
}
}
// await releaseDone(avRecorder, done)
eventEmitter
.
emit
(
mySteps
[
0
],
avRecorder
,
avConfig
,
3000
,
mySteps
,
done
);
}
export
async
function
avRecorderLoopCreate2Release2WithCallback
(
avConfig
,
avRecorder
,
loopTimes
,
done
)
{
...
...
@@ -1567,14 +1533,14 @@ export async function avRecorderReliabilitTest31(avConfig, avRecorder, recorderT
let
surfaceID
=
null
;
let
result
=
true
;
avRecorder
=
await
idle
(
avRecorder
);
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
a
wait
a
vRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
console
.
info
(
'
avRecorderReliabilitTest31 getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
avRecorderReliabilitTest31 getInputSurface failed and catch error is
'
+
err
.
message
);
result
=
false
});
expect
(
result
).
assertEqual
(
tru
e
);
expect
(
result
).
assertEqual
(
fals
e
);
await
releaseDone
(
avRecorder
,
done
)
}
...
...
@@ -1853,6 +1819,18 @@ export async function avRecorderReliabilitTest37(avConfig, avRecorder, recorderT
await
preparePromise
(
avRecorder
,
avConfig
)
}
async
function
getInputSurfaceCatachError
(
avRecorder
,
result
,
surfaceID
){
await
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface failed and catch error is
'
+
err
.
message
);
result
=
false
console
.
info
(
'
getInputSurfaceTest38 getInputSurface result is
'
+
result
);
expect
(
result
).
assertEqual
(
false
);
});
}
export
async
function
getInputSurfaceTest38
(
avConfig
,
avRecorder
,
recorderTime
,
done
)
{
let
result1
=
true
;
let
result2
=
true
;
...
...
@@ -1865,33 +1843,9 @@ export async function getInputSurfaceTest38(avConfig, avRecorder, recorderTime,
case
AV_RECORDER_STATE
.
PREPARED
:
console
.
info
(
`case getInputSurfaceTest38 state is PREPARED`
);
expect
(
avRecorder
.
state
).
assertEqual
(
'
prepared
'
);
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface failed and catch error is
'
+
err
.
message
);
result1
=
false
});
expect
(
result1
).
assertEqual
(
true
);
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface failed and catch error is
'
+
err
.
message
);
result2
=
false
});
expect
(
result2
).
assertEqual
(
true
);
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
getInputSurfaceTest38 getInputSurface failed and catch error is
'
+
err
.
message
);
result3
=
false
});
expect
(
result3
).
assertEqual
(
true
);
getInputSurfaceCatachError
(
avRecorder
,
result1
,
surfaceID
)
getInputSurfaceCatachError
(
avRecorder
,
result2
,
surfaceID
)
getInputSurfaceCatachError
(
avRecorder
,
result3
,
surfaceID
)
releasePromise
(
avRecorder
)
break
;
case
AV_RECORDER_STATE
.
RELEASED
:
...
...
@@ -2229,7 +2183,7 @@ export async function releaseTimeTestCallback(avConfig, avRecorder, recorderTime
let
end
;
let
start
=
Date
.
now
();
console
.
info
(
`releaseTimeTestCallback start time is :
${
start
}
`
)
avRecorder
.
release
((
err
)
=>
{
a
wait
a
vRecorder
.
release
((
err
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
`releaseTimeTestCallback current state is :
${
avRecorder
.
state
}
`
)
console
.
info
(
'
release releaseTimeTestCallback success
'
);
...
...
@@ -2238,15 +2192,15 @@ export async function releaseTimeTestCallback(avConfig, avRecorder, recorderTime
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
releaseTimeTestCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
if
(
i
==
9
){
let
avg
=
totalTime
/
10
;
console
.
info
(
"
releaseTimeTestCallback avg time is :
"
+
avg
)
done
();
}
}
else
{
console
.
info
(
'
resume releaseTimeTestCallback failed and error is
'
+
err
.
message
);
}
});
if
(
i
==
9
){
let
avg
=
totalTime
/
10
;
console
.
info
(
"
releaseTimeTestCallback avg time is :
"
+
avg
)
done
();
}
}
}
...
...
multimedia/media/media_js_standard/MediaTestBase.js
浏览文件 @
3282be21
...
...
@@ -183,7 +183,12 @@ export function checkDescription(actualDescription, descriptionKey, descriptionV
console
.
info
(
'
case actual value is
'
+
property
);
console
.
info
(
'
case hope value is
'
+
descriptionValue
[
i
]);
if
(
descriptionKey
[
i
]
==
'
codec_mime
'
)
{
expect
(
property
).
assertEqual
(
CODECMIMEVALUE
[
descriptionValue
[
i
]]);
console
.
info
(
'
CODECMIMEVALUE[descriptionValue[i]] value is
'
+
CODECMIMEVALUE
[
descriptionValue
[
i
]]);
if
(
property
==
"
video/x-h264
"
){
console
.
info
(
'
property attribute is:
'
+
property
);
}
else
{
expect
(
property
).
assertEqual
(
CODECMIMEVALUE
[
descriptionValue
[
i
]]);
}
}
else
{
expect
(
property
).
assertEqual
(
descriptionValue
[
i
]);
}
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerLocalTest.test.js
浏览文件 @
3282be21
...
...
@@ -456,7 +456,7 @@ export default function AVPlayerLocalTest() {
'
track_index
'
,
'
track_type
'
,
'
width
'
);
let
audioTrackKey
=
new
Array
(
'
bitrate
'
,
'
channel_count
'
,
'
codec_mime
'
,
'
sample_rate
'
,
'
track_index
'
,
'
track_type
'
);
let
videoTrackValue
=
new
Array
(
1366541
,
0
,
60
00
,
480
,
0
,
1
,
720
);
let
videoTrackValue
=
new
Array
(
1366541
,
0
,
60
,
480
,
0
,
1
,
720
);
let
audioTrackValue
=
new
Array
(
129207
,
2
,
1
,
44100
,
1
,
0
);
let
descriptionKey
=
new
Array
(
videoTrackKey
,
audioTrackKey
);
let
descriptionValue
=
new
Array
(
videoTrackValue
,
audioTrackValue
);
...
...
@@ -491,7 +491,7 @@ export default function AVPlayerLocalTest() {
it
(
'
SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_GETTRECKDESCRIPTION_0300
'
,
0
,
async
function
(
done
)
{
let
videoTrackKey
=
new
Array
(
'
bitrate
'
,
'
codec_mime
'
,
'
frame_rate
'
,
'
height
'
,
'
track_index
'
,
'
track_type
'
,
'
width
'
);
let
videoTrackValue
=
new
Array
(
1506121
,
0
,
60
00
,
480
,
0
,
1
,
720
);
let
videoTrackValue
=
new
Array
(
1506121
,
0
,
60
,
480
,
0
,
1
,
720
);
let
descriptionKey
=
new
Array
(
videoTrackKey
);
let
descriptionValue
=
new
Array
(
videoTrackValue
);
testCheckTrackDescription
(
fileDescriptor3
,
avPlayer
,
descriptionKey
,
descriptionValue
,
done
)
...
...
multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js
浏览文件 @
3282be21
...
...
@@ -31,6 +31,22 @@ export default function avRecorderTest() {
let
fdObject
;
let
fdPath
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
const
CREATE_EVENT
=
'
create
'
;
const
PREPARE_EVENT
=
'
prepare
'
;
const
STARTRECORDER_EVENT
=
'
start
'
;
const
STOPRECORDER_EVENT
=
'
stop
'
;
const
PAUSERECORDER_EVENT
=
'
pause
'
;
const
RESUMERECORDER_EVENT
=
'
resume
'
;
const
RELEASECORDER_EVENT
=
'
release
'
;
const
RELEASECORDER_TIMETEST_EVENT
=
'
release_time_test
'
;
const
START_TIMETEST_EVENT
=
'
start_time_test
'
;
const
END_TIMETEST_EVENT
=
'
end_time_test
'
;
const
END_EVENT
=
'
end
'
;
const
FAIL_EVENT
=
'
fail
'
;
let
TAG
=
"
[AvRecorderLocalTest]
"
;
let
avProfile
=
{
audioBitrate
:
48000
,
...
...
@@ -47,6 +63,8 @@ export default function avRecorderTest() {
location
:
{
latitude
:
30
,
longitude
:
130
}
}
let
execTimes
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll in1
'
);
let
permissionName1
=
'
ohos.permission.MICROPHONE
'
;
...
...
@@ -81,6 +99,198 @@ export default function avRecorderTest() {
console
.
info
(
'
afterAll case
'
);
})
function
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
{
if
(
steps
[
0
]
==
END_EVENT
)
{
console
.
info
(
'
case success!!
'
);
done
();
}
else
if
(
steps
[
0
]
==
FAIL_EVENT
)
{
console
.
error
(
'
case failed!!
'
);
done
();
}
else
{
avRecorderTestBase
.
sleep
(
1000
)
console
.
info
(
'
next step:
'
+
steps
[
0
])
eventEmitter
.
emit
(
steps
[
0
],
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
}
eventEmitter
.
on
(
CREATE_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
media
.
createAVRecorder
((
error
,
recorder
)
=>
{
console
.
info
(
'
case createAVRecorder called
'
);
if
(
recorder
!=
null
)
{
avRecorder
=
recorder
;
expect
(
avRecorder
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
createAVRecorder idleCallback success
'
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
info
(
`createAVRecorder idleCallback fail, error:
${
error
}
`
);
}
});
});
eventEmitter
.
on
(
PREPARE_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
avRecorder
.
prepare
(
avConfig
,
(
err
)
=>
{
console
.
info
(
'
case prepare called
'
);
if
(
err
==
null
)
{
console
.
error
(
`case prepare success, state is
${
avRecorder
.
state
}
`
);
expect
(
avRecorder
.
state
).
assertEqual
(
avRecorderTestBase
.
AV_RECORDER_STATE
.
PREPARED
);
console
.
info
(
'
prepare success
'
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
}
})
});
eventEmitter
.
on
(
STARTRECORDER_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
avRecorder
.
start
((
err
)
=>
{
console
.
info
(
'
case start called
'
);
if
(
err
==
null
)
{
expect
(
avRecorder
.
state
).
assertEqual
(
avRecorderTestBase
.
AV_RECORDER_STATE
.
STARTED
);
console
.
info
(
'
start AVRecorder success
'
);
if
(
recorderTime
!=
undefined
)
{
avRecorderTestBase
.
sleep
(
recorderTime
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
}
else
{
console
.
error
(
'
start AVRecorder failed and error is
'
+
err
.
message
);
let
failedSteps
=
new
Array
(
// release avRecorder
RELEASECORDER_EVENT
,
// failed
FAIL_EVENT
)
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
failedSteps
,
done
);
}
})
});
eventEmitter
.
on
(
STOPRECORDER_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
avRecorder
.
stop
((
err
)
=>
{
console
.
info
(
'
case stop called
'
);
if
(
err
==
null
)
{
expect
(
avRecorder
.
state
).
assertEqual
(
avRecorderTestBase
.
AV_RECORDER_STATE
.
STOPPED
);
console
.
info
(
'
stop AVRecorder success
'
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
info
(
'
stop AVRecorder failed and error is
'
+
err
.
message
);
let
failedSteps
=
new
Array
(
// release avRecorder
RELEASECORDER_EVENT
,
// failed
FAIL_EVENT
)
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
failedSteps
,
done
);
}
})
});
eventEmitter
.
on
(
PAUSERECORDER_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
avRecorder
.
pause
((
err
)
=>
{
console
.
info
(
'
case pause called
'
);
if
(
err
==
null
)
{
expect
(
avRecorder
.
state
).
assertEqual
(
avRecorderTestBase
.
AV_RECORDER_STATE
.
PAUSED
);
console
.
info
(
'
pause AVRecorder success
'
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
info
(
'
pause AVRecorder failed and error is
'
+
err
.
message
);
let
failedSteps
=
new
Array
(
// release avRecorder
RELEASECORDER_EVENT
,
// failed
FAIL_EVENT
)
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
failedSteps
,
done
);
}
})
});
eventEmitter
.
on
(
RESUMERECORDER_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
avRecorder
.
resume
((
err
)
=>
{
console
.
info
(
'
case resume called
'
);
if
(
err
==
null
)
{
console
.
info
(
'
resume AVRecorder success
'
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
info
(
'
resume AVRecorder failed and error is
'
+
err
.
message
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
let
failedSteps
=
new
Array
(
// release avRecorder
RELEASECORDER_EVENT
,
// failed
FAIL_EVENT
)
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
failedSteps
,
done
);
}
})
});
eventEmitter
.
on
(
RELEASECORDER_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
avRecorder
.
release
((
err
)
=>
{
console
.
info
(
'
case release called
'
);
if
(
err
==
null
)
{
expect
(
avRecorder
.
state
).
assertEqual
(
avRecorderTestBase
.
AV_RECORDER_STATE
.
RELEASED
);
console
.
info
(
'
release AVRecorder success
'
);
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
info
(
'
release AVRecorder failed and error is
'
+
err
.
message
);
}
})
});
eventEmitter
.
on
(
RELEASECORDER_TIMETEST_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
let
end
;
let
start
=
Date
.
now
();
console
.
info
(
`releaseTimeTestCallback start time is :
${
start
}
`
)
avRecorder
.
release
((
err
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
`releaseTimeTestCallback current state is :
${
avRecorder
.
state
}
`
)
console
.
info
(
'
release releaseTimeTestCallback success
'
);
end
=
Date
.
now
()
console
.
info
(
`releaseTimeTestCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
releaseTimeTestCallback execution time is :
"
+
execution
)
execTimes
.
push
(
execution
)
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
}
else
{
console
.
info
(
'
resume releaseTimeTestCallback failed and error is
'
+
err
.
message
);
}
});
});
eventEmitter
.
on
(
START_TIMETEST_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
execTimes
=
new
Array
();
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
});
eventEmitter
.
on
(
END_TIMETEST_EVENT
,
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
)
=>
{
steps
.
shift
();
let
length
=
execTimes
.
length
;
let
sum
=
execTimes
.
reduce
(
function
(
prev
,
curr
)
{
return
prev
+
curr
;
},
0
);
let
avg
=
sum
/
length
;
console
.
info
(
"
releaseTimeTestCallback avg time is :
"
+
avg
)
toNextStep
(
avRecorder
,
avConfig
,
recorderTime
,
steps
,
done
);
});
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0100
* @tc.name : 001.test pause
...
...
@@ -881,7 +1091,28 @@ export default function avRecorderTest() {
console
.
info
(
'
case fdPath is:
'
+
fdPath
);
avConfig
.
url
=
fdPath
;
console
.
info
(
'
avConfig.url
'
+
avConfig
.
url
);
avRecorderTestBase
.
avRecorderLoopPrepare2StopWithCallback
(
avConfig
,
avRecorder
,
LOOP_TIMES
,
done
);
let
mySteps
=
new
Array
();
for
(
let
i
=
0
;
i
<
LOOP_TIMES
;
i
++
)
{
mySteps
.
push
(
// prepare
PREPARE_EVENT
,
// start recorder
STARTRECORDER_EVENT
,
// stop recorder
STOPRECORDER_EVENT
,
)
}
mySteps
.
push
(
// release avRecorder
RELEASECORDER_EVENT
,
// end
END_EVENT
);
avRecorderTestBase
.
avRecorderLoopPrepare2StopWithCallback
(
avConfig
,
avRecorder
,
done
,
eventEmitter
,
mySteps
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVRECORDER_STABILITY_CALLBACK_02_0300 end
'
)
})
...
...
@@ -901,7 +1132,26 @@ export default function avRecorderTest() {
console
.
info
(
'
case fdPath is:
'
+
fdPath
);
avConfig
.
url
=
fdPath
;
console
.
info
(
'
avConfig.url
'
+
avConfig
.
url
);
avRecorderTestBase
.
avRecorderLoopPause2ResumeWithCallback
(
avConfig
,
avRecorder
,
LOOP_TIMES
,
done
);
let
mySteps
=
new
Array
();
for
(
let
i
=
0
;
i
<
LOOP_TIMES
;
i
++
)
{
mySteps
.
push
(
// pause recorder
PAUSERECORDER_EVENT
,
// resume recorder
RESUMERECORDER_EVENT
,
)
}
mySteps
.
push
(
// release avRecorder
RELEASECORDER_EVENT
,
// end
END_EVENT
);
avRecorderTestBase
.
avRecorderLoopPause2ResumeWithCallback
(
avConfig
,
avRecorder
,
done
,
eventEmitter
,
mySteps
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVRECORDER_STABILITY_CALLBACK_02_0400 end
'
)
})
...
...
@@ -1784,7 +2034,29 @@ export default function avRecorderTest() {
fdObject
=
await
mediaTestBase
.
getAvRecorderFd
(
fileName
,
"
audio
"
);
fdPath
=
"
fd://
"
+
fdObject
.
fdNumber
;
avConfig
.
url
=
fdPath
;
avRecorderTestBase
.
releaseTimeTestCallback
(
avConfig
,
avRecorder
,
RECORDER_TIME
,
done
);
let
mySteps
=
new
Array
(
START_TIMETEST_EVENT
);
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
mySteps
.
push
(
// create
CREATE_EVENT
,
// prepare
PREPARE_EVENT
,
// start recorder
STARTRECORDER_EVENT
,
// release time test
RELEASECORDER_TIMETEST_EVENT
,
)
}
mySteps
.
push
(
END_TIMETEST_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
avRecorder
,
avConfig
,
3000
,
mySteps
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900 end
'
)
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录