Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
850b1f85
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
850b1f85
编写于
5月 24, 2023
作者:
D
dongwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code check
Signed-off-by:
N
dongwei
<
dongwei@kaihong.com
>
上级
856b1a60
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
83 addition
and
1 deletion
+83
-1
multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js
...rd/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js
+83
-1
未找到文件。
multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js
浏览文件 @
850b1f85
...
...
@@ -34,12 +34,16 @@ export default function avRecorderTest() {
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
'
;
...
...
@@ -59,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
'
;
...
...
@@ -107,6 +113,21 @@ export default function avRecorderTest() {
}
}
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
)
=>
{
...
...
@@ -231,6 +252,45 @@ export default function avRecorderTest() {
})
});
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
...
...
@@ -1974,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录