Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5ec8af91
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看板
未验证
提交
5ec8af91
编写于
5月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3172 videoRecorder 测试用例添加自动校验功能
Merge pull request !3172 from FULIZHONG/flz0512
上级
de0a9ac7
ec5f1939
变更
18
展开全部
显示空白变更内容
内联
并排
Showing
18 changed file
with
1307 addition
and
732 deletion
+1307
-732
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+81
-0
multimedia/media/media_js_standard/VideoPlayerTestBase.js
multimedia/media/media_js_standard/VideoPlayerTestBase.js
+10
-20
multimedia/media/media_js_standard/VideoRecorderTestBase.js
multimedia/media/media_js_standard/VideoRecorderTestBase.js
+143
-0
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+2
-3
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+12
-4
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+12
-4
multimedia/media/media_js_standard/videoRecorder/Test.json
multimedia/media/media_js_standard/videoRecorder/Test.json
+1
-0
multimedia/media/media_js_standard/videoRecorder/src/main/config.json
...edia/media_js_standard/videoRecorder/src/main/config.json
+3
-1
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/index/index.js
...rd/videoRecorder/src/main/js/default/pages/index/index.js
+11
-2
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest/surfaceTest.css
...der/src/main/js/default/pages/surfaceTest/surfaceTest.css
+61
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest/surfaceTest.hml
...der/src/main/js/default/pages/surfaceTest/surfaceTest.hml
+26
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest/surfaceTest.js
...rder/src/main/js/default/pages/surfaceTest/surfaceTest.js
+33
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest2/surfaceTest2.css
...r/src/main/js/default/pages/surfaceTest2/surfaceTest2.css
+61
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest2/surfaceTest2.hml
...r/src/main/js/default/pages/surfaceTest2/surfaceTest2.hml
+26
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest2/surfaceTest2.js
...er/src/main/js/default/pages/surfaceTest2/surfaceTest2.js
+33
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderAPICallbackTest.test.js
...der/src/main/js/test/VideoRecorderAPICallbackTest.test.js
+47
-154
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js
...er/src/main/js/test/VideoRecorderFuncCallbackTest.test.js
+163
-184
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
...der/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
+582
-360
未找到文件。
multimedia/media/media_js_standard/MediaTestBase.js
浏览文件 @
5ec8af91
...
...
@@ -15,6 +15,10 @@
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
{
expect
}
from
'
deccjsunit/index
'
import
router
from
'
@system.router
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
mediaLibrary
from
'
@ohos.multimedia.mediaLibrary
'
// File operation
export
async
function
getFileDescriptor
(
fileName
)
{
...
...
@@ -85,3 +89,80 @@ export function printDescription(obj) {
description
+=
i
+
"
=
"
+
property
+
"
\n
"
;
}
}
export
async
function
toNewPage
(
pagePath1
,
pagePath2
,
page
)
{
let
path
=
''
;
if
(
page
==
0
)
{
path
=
pagePath1
;
}
else
{
path
=
pagePath2
;
}
let
options
=
{
uri
:
path
,
}
try
{
await
router
.
push
(
options
);
}
catch
{
console
.
info
(
'
case route failed
'
);
}
}
export
async
function
clearRouter
()
{
await
router
.
clear
();
}
export
async
function
getFd
(
pathName
)
{
let
fdObject
=
{
fileAsset
:
null
,
fdNumber
:
null
}
let
displayName
=
pathName
;
const
mediaTest
=
mediaLibrary
.
getMediaLibrary
();
let
fileKeyObj
=
mediaLibrary
.
FileKey
;
let
mediaType
=
mediaLibrary
.
MediaType
.
VIDEO
;
let
publicPath
=
await
mediaTest
.
getPublicDirectory
(
mediaLibrary
.
DirectoryType
.
DIR_VIDEO
);
let
dataUri
=
await
mediaTest
.
createAsset
(
mediaType
,
displayName
,
publicPath
);
if
(
dataUri
!=
undefined
)
{
let
args
=
dataUri
.
id
.
toString
();
let
fetchOp
=
{
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
fdObject
.
fileAsset
=
await
fetchFileResult
.
getAllObject
();
fdObject
.
fdNumber
=
await
fdObject
.
fileAsset
[
0
].
open
(
'
Rw
'
);
console
.
info
(
'
case getFd number is:
'
+
fdObject
.
fdNumber
);
}
return
fdObject
;
}
export
async
function
closeFd
(
fileAsset
,
fdNumber
)
{
if
(
fileAsset
!=
null
)
{
await
fileAsset
[
0
].
close
(
fdNumber
).
then
(()
=>
{
console
.
info
(
'
[mediaLibrary] case close fd success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[mediaLibrary] case close fd failed
'
);
});
}
else
{
console
.
info
(
'
[mediaLibrary] case fileAsset is null
'
);
}
}
// apply permission for test hap
export
async
function
applyPermission
(
applictionName
,
permissionNames
)
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
applictionName
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
[permission] case accessTokenID is
'
+
tokenID
);
for
(
let
i
=
0
;
i
<
permissionNames
.
length
;
i
++
)
{
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionNames
[
i
],
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
}
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
\ No newline at end of file
multimedia/media/media_js_standard/VideoPlayerTestBase.js
浏览文件 @
5ec8af91
...
...
@@ -13,31 +13,20 @@
* limitations under the License.
*/
import
router
from
'
@system.router
'
import
media
from
'
@ohos.multimedia.media
'
import
*
as
mediaTestBase
from
'
./MediaTestBase.js
'
;
export
async
function
toNewPage
(
pagePath1
,
pagePath2
,
page
)
{
let
path
=
''
;
if
(
page
==
0
)
{
path
=
pagePath1
;
}
else
{
path
=
pagePath2
;
}
let
options
=
{
uri
:
path
,
}
try
{
await
router
.
push
(
options
);
}
catch
{
console
.
info
(
'
case route failed
'
);
export
function
checkDescription
(
actualDescription
,
descriptionKey
,
descriptionValue
)
{
for
(
let
i
=
0
;
i
<
descriptionKey
.
length
;
i
++
)
{
let
property
=
actualDescription
[
descriptionKey
[
i
]];
console
.
info
(
'
case key is
'
+
descriptionKey
[
i
]);
console
.
info
(
'
case actual value is
'
+
property
);
console
.
info
(
'
case hope value is
'
+
descriptionValue
[
i
]);
expect
(
property
).
assertEqual
(
descriptionValue
[
i
]);
}
}
export
async
function
clearRouter
()
{
await
router
.
clear
();
}
export
async
function
playVideoSource
(
url
,
width
,
height
,
duration
,
playTime
,
done
)
{
console
.
info
(
`case media source url:
${
url
}
`
)
let
videoPlayer
=
null
;
...
...
@@ -186,3 +175,4 @@ export async function playVideoSource(url, width, height, duration, playTime, do
console
.
info
(
'
case release called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
multimedia/media/media_js_standard/VideoRecorderTestBase.js
0 → 100644
浏览文件 @
5ec8af91
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
expect
}
from
'
deccjsunit/index
'
import
camera
from
'
@ohos.multimedia.camera
'
import
media
from
'
@ohos.multimedia.media
'
import
*
as
mediaTestBase
from
'
./MediaTestBase.js
'
;
const
VIDEO_TRACK
=
'
video_track
'
;
const
AUDIO_TRACK
=
'
audio_track
'
;
const
AUDIO_VIDEO_TYPE
=
'
audio_video
'
;
const
DELTA_TIME
=
1000
;
const
PLAY_TIME
=
1000
;
let
tarckType
=
new
Array
(
VIDEO_TRACK
,
AUDIO_TRACK
);
export
async
function
initCaptureSession
(
videoOutPut
,
cameraManager
,
cameras
,
cameraID
)
{
let
cameraInput
=
await
cameraManager
.
createCameraInput
(
cameras
[
cameraID
].
cameraId
);
if
(
cameraInput
!=
null
)
{
console
.
info
(
'
[camera] case createCameraInput success
'
);
}
else
{
console
.
info
(
'
[camera] case createCameraInput failed
'
);
return
;
}
let
captureSession
=
await
camera
.
createCaptureSession
(
null
);
await
captureSession
.
beginConfig
();
await
captureSession
.
addInput
(
cameraInput
);
await
captureSession
.
addOutput
(
videoOutPut
);
await
captureSession
.
commitConfig
();
return
captureSession
;
}
export
async
function
stopCaptureSession
(
captureSession
)
{
await
captureSession
.
release
();
}
export
function
getTrackArray
(
videoType
,
recorderConfigFile
)
{
if
(
videoType
==
AUDIO_VIDEO_TYPE
)
{
let
audioTrack
=
new
Array
(
recorderConfigFile
.
audioBitrate
,
recorderConfigFile
.
audioChannels
,
'
audio/mpeg
'
,
recorderConfigFile
.
audioSampleRate
);
let
videoTrack
=
new
Array
(
'
video/mpeg
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
let
trackArray
=
new
Array
(
videoTrack
,
audioTrack
);
return
trackArray
;
}
else
{
let
videoTrack
=
new
Array
(
'
video/mpeg
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
let
trackArray
=
new
Array
(
videoTrack
);
return
trackArray
;
}
}
export
function
checkDescription
(
obj
,
trackTpye
,
descriptionValue
)
{
let
index
=
0
;
if
(
trackTpye
==
VIDEO_TRACK
)
{
console
.
info
(
'
case video codec_mime is
'
+
obj
[
'
codec_mime
'
]);
expect
(
obj
[
'
codec_mime
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
console
.
info
(
'
case video height is
'
+
obj
[
'
height
'
]);
expect
(
obj
[
'
height
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
console
.
info
(
'
case video width is
'
+
obj
[
'
width
'
]);
expect
(
obj
[
'
width
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
}
else
{
console
.
info
(
'
case audio bitrate is
'
+
obj
[
'
bitrate
'
]);
expect
(
obj
[
'
bitrate
'
]).
assertClose
(
descriptionValue
[
index
++
],
2
*
DELTA_TIME
);
console
.
info
(
'
case audio channel_count is
'
+
obj
[
'
channel_count
'
]);
expect
(
obj
[
'
channel_count
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
console
.
info
(
'
case audio codec_mime is
'
+
obj
[
'
codec_mime
'
]);
expect
(
obj
[
'
codec_mime
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
console
.
info
(
'
case audio sample_rate is
'
+
obj
[
'
sample_rate
'
]);
expect
(
obj
[
'
sample_rate
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
}
}
export
async
function
checkVideos
(
playFdPath
,
duration
,
trackArray
,
playerSurfaceId
)
{
let
videoPlayer
=
null
;
let
arrayDescription
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
'
[checkVideos] case checkVideos fdPath is :
'
+
playFdPath
);
videoPlayer
.
url
=
playFdPath
;
await
videoPlayer
.
setDisplaySurface
(
playerSurfaceId
).
then
(()
=>
{
console
.
info
(
'
case setDisplaySurface success
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertClose
(
duration
,
DELTA_TIME
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
getTrackDescription
().
then
((
arrayList
)
=>
{
console
.
info
(
'
case getTrackDescription called!!
'
);
if
(
typeof
(
arrayList
)
!=
'
undefined
'
)
{
arrayDescription
=
arrayList
;
}
else
{
console
.
info
(
'
case getTrackDescription is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
await
videoPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
case stop called!!
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
stopped
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
arrayDescription
.
length
).
assertEqual
(
trackArray
.
length
);
for
(
let
i
=
0
;
i
<
arrayDescription
.
length
;
i
++
)
{
checkDescription
(
arrayDescription
[
i
],
tarckType
[
i
],
trackArray
[
i
]);
}
}
\ No newline at end of file
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
5ec8af91
...
...
@@ -14,7 +14,6 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
{
toNewPage
,
clearRouter
}
from
'
../../../../../VideoPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
...
...
@@ -64,7 +63,7 @@ describe('VideoPlayerAPICallbackTest', function () {
await
mediaTestBase
.
getFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
await
mediaTestBase
.
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
pageId
=
(
pageId
+
1
)
%
2
;
await
mediaTestBase
.
msleepAsync
(
1000
).
then
(
()
=>
{},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
...
@@ -74,7 +73,7 @@ describe('VideoPlayerAPICallbackTest', function () {
})
afterEach
(
async
function
()
{
await
clearRouter
();
await
mediaTestBase
.
clearRouter
();
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_SOURCE
);
console
.
info
(
'
afterEach case
'
);
})
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
5ec8af91
...
...
@@ -14,8 +14,8 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
{
toNewPage
,
clearRouter
}
from
'
../../../../../VideoPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
*
as
videoPlayerBase
from
'
../../../../../VideoPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncCallbackTest
'
,
function
()
{
...
...
@@ -66,7 +66,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
})
beforeEach
(
async
function
()
{
await
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
await
mediaTestBase
.
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
pageId
=
(
pageId
+
1
)
%
2
;
await
mediaTestBase
.
msleepAsync
(
1000
).
then
(
()
=>
{},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
...
@@ -76,7 +76,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
})
afterEach
(
async
function
()
{
await
clearRouter
();
await
mediaTestBase
.
clearRouter
();
console
.
info
(
'
afterEach case
'
);
})
...
...
@@ -221,10 +221,18 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
on
(
GETDESCRIPTION
,
(
videoPlayer
,
steps
,
done
)
=>
{
steps
.
shift
();
let
videoTrackKey
=
new
Array
(
'
bitrate
'
,
'
codec_mime
'
,
'
frame_rate
'
,
'
height
'
,
'
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
,
'
video/x-h264
'
,
6000
,
480
,
0
,
1
,
720
);
let
audioTrackValue
=
new
Array
(
129207
,
2
,
'
audio/mpeg
'
,
44100
,
1
,
0
);
let
descriptionKey
=
new
Array
(
videoTrackKey
,
audioTrackKey
);
let
descriptionValue
=
new
Array
(
videoTrackValue
,
audioTrackValue
);
videoPlayer
.
getTrackDescription
((
err
,
arrlist
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
mediaTestBase
.
printDescription
(
arrlist
[
i
]);
videoPlayerBase
.
checkDescription
(
arrlist
[
i
],
descriptionKey
[
i
],
descriptionValue
[
i
]);
}
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
5ec8af91
...
...
@@ -14,8 +14,8 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
{
toNewPage
,
clearRouter
}
from
'
../../../../../VideoPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
*
as
videoPlayerBase
from
'
../../../../../VideoPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncPromiseTest
'
,
function
()
{
...
...
@@ -44,7 +44,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
})
beforeEach
(
async
function
()
{
await
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
await
mediaTestBase
.
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
pageId
=
(
pageId
+
1
)
%
2
;
await
mediaTestBase
.
msleepAsync
(
1000
).
then
(
()
=>
{},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
...
@@ -54,7 +54,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
})
afterEach
(
async
function
()
{
await
clearRouter
();
await
mediaTestBase
.
clearRouter
();
console
.
info
(
'
afterEach case
'
);
})
...
...
@@ -445,6 +445,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
arrayDescription
=
null
;
let
videoTrackKey
=
new
Array
(
'
bitrate
'
,
'
codec_mime
'
,
'
frame_rate
'
,
'
height
'
,
'
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
,
'
video/x-h264
'
,
6000
,
480
,
0
,
1
,
720
);
let
audioTrackValue
=
new
Array
(
129207
,
2
,
'
audio/mpeg
'
,
44100
,
1
,
0
);
let
descriptionKey
=
new
Array
(
videoTrackKey
,
audioTrackKey
);
let
descriptionValue
=
new
Array
(
videoTrackValue
,
audioTrackValue
);
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
...
...
@@ -477,7 +485,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
for
(
let
i
=
0
;
i
<
arrayDescription
.
length
;
i
++
)
{
mediaTestBase
.
printDescription
(
arrayDescription
[
i
]);
videoPlayerBase
.
checkDescription
(
arrayDescription
[
i
],
descriptionKey
[
i
],
descriptionValue
[
i
]);
}
await
videoPlayer
.
release
().
then
(()
=>
{
...
...
multimedia/media/media_js_standard/videoRecorder/Test.json
浏览文件 @
5ec8af91
...
...
@@ -10,6 +10,7 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"rm -rf /storage/media/100/local/files/Videos/*"
],
"teardown-command"
:[
]
...
...
multimedia/media/media_js_standard/videoRecorder/src/main/config.json
浏览文件 @
5ec8af91
...
...
@@ -91,7 +91,9 @@
"js"
:
[
{
"pages"
:
[
"pages/index/index"
"pages/index/index"
,
"pages/surfaceTest/surfaceTest"
,
"pages/surfaceTest2/surfaceTest2"
],
"name"
:
"default"
,
"window"
:
{
...
...
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/index/index.js
浏览文件 @
5ec8af91
...
...
@@ -14,7 +14,7 @@
*/
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
import
*
as
mediaTestBase
from
'
../../../../../../../MediaTestBase.js
'
;
export
default
{
data
:
{
title
:
""
...
...
@@ -22,8 +22,17 @@ export default {
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
async
onShow
()
{
console
.
info
(
'
onShow finish
'
)
let
applictionName
=
'
ohos.acts.multimedia.video.videorecorder
'
;
let
permissionName1
=
'
ohos.permission.CAMERA
'
;
let
permissionName2
=
'
ohos.permission.MICROPHONE
'
;
let
permissionName3
=
'
ohos.permission.MEDIA_LOCATION
'
;
let
permissionName4
=
'
ohos.permission.READ_MEDIA
'
;
let
permissionName5
=
'
ohos.permission.WRITE_MEDIA
'
;
let
permissionNames
=
new
Array
(
permissionName1
,
permissionName2
,
permissionName3
,
permissionName4
,
permissionName5
);
await
mediaTestBase
.
applyPermission
(
applictionName
,
permissionNames
);
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
...
...
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest/surfaceTest.css
0 → 100644
浏览文件 @
5ec8af91
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
40px
;
color
:
#000000
;
opacity
:
0.9
;
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
@media
screen
and
(
device-type
:
wearable
)
{
.title
{
font-size
:
28px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
tv
)
{
.container
{
background-image
:
url("/common/images/Wallpaper.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
}
.title
{
font-size
:
100px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest/surfaceTest.hml
0 → 100644
浏览文件 @
5ec8af91
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
VideoRecorder Test
</text>
<Xcomponent id = 'XcomponentId2'
type = 'surface'
onload = 'LoadXcomponent2'
style = "width:720px;height:480px;border-color:red;border-width:5px">
</Xcomponent>
</div>
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest/surfaceTest.js
0 → 100644
浏览文件 @
5ec8af91
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
import
Fileio
from
'
@ohos.fileio
'
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
},
onReady
()
{
},
LoadXcomponent2
()
{
globalThis
.
value
=
this
.
$element
(
'
XcomponentId2
'
).
getXComponentSurfaceId
()
},
}
\ No newline at end of file
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest2/surfaceTest2.css
0 → 100644
浏览文件 @
5ec8af91
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
40px
;
color
:
#000000
;
opacity
:
0.9
;
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
@media
screen
and
(
device-type
:
wearable
)
{
.title
{
font-size
:
28px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
tv
)
{
.container
{
background-image
:
url("/common/images/Wallpaper.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
}
.title
{
font-size
:
100px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest2/surfaceTest2.hml
0 → 100644
浏览文件 @
5ec8af91
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
VideoRecorder Test
</text>
<Xcomponent id = 'XcomponentId3'
type = 'surface'
onload = 'LoadXcomponent3'
style = "width:720px;height:480px;border-color:red;border-width:5px">
</Xcomponent>
</div>
multimedia/media/media_js_standard/videoRecorder/src/main/js/default/pages/surfaceTest2/surfaceTest2.js
0 → 100644
浏览文件 @
5ec8af91
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
import
Fileio
from
'
@ohos.fileio
'
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
},
onReady
()
{
},
LoadXcomponent3
()
{
globalThis
.
value
=
this
.
$element
(
'
XcomponentId3
'
).
getXComponentSurfaceId
()
},
}
\ No newline at end of file
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderAPICallbackTest.test.js
浏览文件 @
5ec8af91
...
...
@@ -15,7 +15,8 @@
import
media
from
'
@ohos.multimedia.media
'
import
camera
from
'
@ohos.multimedia.camera
'
import
mediaLibrary
from
'
@ohos.multimedia.mediaLibrary
'
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
*
as
videoRecorderBase
from
'
../../../../../VideoRecorderTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoRecorderAPICallbackTest
'
,
function
()
{
...
...
@@ -24,7 +25,6 @@ describe('VideoRecorderAPICallbackTest', function () {
const
END_EVENT
=
'
end
'
;
const
CREATE_EVENT
=
'
create
'
;
const
PREPARE_EVENT
=
'
prepare
'
;
const
PREPARE_OLNYVIDEO_EVENT
=
'
prepare_only
'
;
const
GETSURFACE_EVENT
=
'
getInputSurface
'
;
const
START_EVENT
=
'
start
'
;
const
PAUSE_EVENT
=
'
pause
'
;
...
...
@@ -33,9 +33,6 @@ describe('VideoRecorderAPICallbackTest', function () {
const
RESET_EVENT
=
'
reset
'
;
const
RELEASE_EVENT
=
'
release
'
;
const
START_STREEAM
=
'
start_stream
'
;
const
SETEXIT
=
'
setExit
'
;
const
SETSTART
=
'
setStart
'
;
const
SETPAUSE
=
'
setPause
'
;
const
CLOSE_STREAM
=
'
close_stream
'
;
const
ERROR_EVENT
=
'
error
'
;
let
cameraManager
;
...
...
@@ -44,63 +41,53 @@ describe('VideoRecorderAPICallbackTest', function () {
let
videoOutput
;
let
surfaceID
;
let
fdPath
;
let
f
ileAsse
t
;
let
fdNumber
;
let
f
dObjec
t
;
let
cameraID
=
0
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
configFile
=
{
audioBitrate
:
48000
,
audioChannels
:
2
,
audioCodec
:
'
audio/mp4a-latm
'
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
audioSampleRate
:
48000
,
durationTime
:
1000
,
fileFormat
:
'
mp4
'
,
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4
,
videoBitrate
:
48000
,
videoCodec
:
'
video/mp4v-es
'
,
videoCodec
:
media
.
CodecMimeType
.
VIDEO_MPEG4
,
videoFrameWidth
:
640
,
videoFrameHeight
:
480
,
videoFrameRate
:
10
}
// rotation 0, 90, 180, 270
let
videoConfig
=
{
audioSourceType
:
1
,
videoSourceType
:
0
,
audioSourceType
:
media
.
AudioSourceType
.
AUDIO_SOURCE_TYPE_MIC
,
videoSourceType
:
media
.
VideoSourceType
.
VIDEO_SOURCE_TYPE_SURFACE_YUV
,
profile
:
configFile
,
url
:
'
f
ile:///data/media/API.mp4
'
,
url
:
'
f
d://
'
,
rotation
:
0
,
location
:
{
latitude
:
30
,
longitude
:
130
},
maxSize
:
100
,
maxDuration
:
500
}
let
onlyVideoProfile
=
{
durationTime
:
1000
,
fileFormat
:
'
mp4
'
,
videoBitrate
:
48000
,
videoCodec
:
'
video/mp4v-es
'
,
videoFrameWidth
:
640
,
videoFrameHeight
:
480
,
videoFrameRate
:
10
}
let
onlyVideoConfig
=
{
videoSourceType
:
0
,
profile
:
onlyVideoProfile
,
url
:
'
file:///data/media/API.mp4
'
,
rotation
:
0
,
location
:
{
latitude
:
30
,
longitude
:
130
},
maxSize
:
100
,
maxDuration
:
500
beforeAll
(
async
function
()
{
cameraManager
=
await
camera
.
getCameraManager
(
null
);
if
(
cameraManager
!=
null
)
{
console
.
info
(
'
[camera] case getCameraManager success
'
);
}
else
{
console
.
info
(
'
[camera] case getCameraManager failed
'
);
return
;
}
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
cameras
=
await
cameraManager
.
getCameras
();
if
(
cameras
!=
null
)
{
console
.
info
(
'
[camera] case getCameras success
'
);
}
else
{
console
.
info
(
'
[camera] case getCameras failed
'
);
}
beforeAll
(
async
function
()
{
await
initCamera
();
await
getFd
(
'
API.mp4
'
);
fdObject
=
await
mediaTestBase
.
getFd
(
'
recorder_callback_api.mp4
'
);
fdPath
=
"
fd://
"
+
fdObject
.
fdNumber
.
toString
();
videoConfig
.
url
=
fdPath
;
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -114,76 +101,10 @@ describe('VideoRecorderAPICallbackTest', function () {
})
afterAll
(
async
function
()
{
await
closeFd
();
await
mediaTestBase
.
closeFd
();
console
.
info
(
'
afterAll case
'
);
})
async
function
getFd
(
pathName
)
{
let
displayName
=
pathName
;
const
mediaTest
=
mediaLibrary
.
getMediaLibrary
();
let
fileKeyObj
=
mediaLibrary
.
FileKey
;
let
mediaType
=
mediaLibrary
.
MediaType
.
VIDEO
;
let
publicPath
=
await
mediaTest
.
getPublicDirectory
(
mediaLibrary
.
DirectoryType
.
DIR_VIDEO
);
let
dataUri
=
await
mediaTest
.
createAsset
(
mediaType
,
displayName
,
publicPath
);
if
(
dataUri
!=
undefined
)
{
let
args
=
dataUri
.
id
.
toString
();
let
fetchOp
=
{
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
fileAsset
=
await
fetchFileResult
.
getAllObject
();
fdNumber
=
await
fileAsset
[
0
].
open
(
'
Rw
'
);
fdPath
=
"
fd://
"
+
fdNumber
.
toString
();
}
}
async
function
closeFd
()
{
if
(
fileAsset
!=
null
)
{
await
fileAsset
[
0
].
close
(
fdNumber
).
then
(()
=>
{
console
.
info
(
'
[mediaLibrary] case close fd success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[mediaLibrary] case close fd failed
'
);
});
}
else
{
console
.
info
(
'
[mediaLibrary] case fileAsset is null
'
);
}
}
async
function
initCamera
()
{
cameraManager
=
await
camera
.
getCameraManager
(
null
);
if
(
cameraManager
!=
null
)
{
console
.
info
(
'
[camera] case getCameraManager success
'
);
}
else
{
console
.
info
(
'
[camera] case getCameraManager failed
'
);
return
;
}
cameras
=
await
cameraManager
.
getCameras
();
if
(
cameras
!=
null
)
{
console
.
info
(
'
[camera] case getCameras success
'
);
}
else
{
console
.
info
(
'
[camera] case getCameras failed
'
);
}
}
async
function
initCaptureSession
(
videoOutPut
)
{
let
cameraInput
=
await
cameraManager
.
createCameraInput
(
cameras
[
0
].
cameraId
);
if
(
cameraInput
!=
null
)
{
console
.
info
(
'
[camera] case createCameraInput success
'
);
}
else
{
console
.
info
(
'
[camera] case createCameraInput failed
'
);
return
;
}
captureSession
=
await
camera
.
createCaptureSession
(
null
);
await
captureSession
.
beginConfig
();
await
captureSession
.
addInput
(
cameraInput
);
await
captureSession
.
addOutput
(
videoOutPut
);
await
captureSession
.
commitConfig
();
}
async
function
stopCaptureSession
()
{
await
captureSession
.
release
();
}
function
printfError
(
error
,
done
)
{
expect
().
assertFail
();
...
...
@@ -208,23 +129,13 @@ describe('VideoRecorderAPICallbackTest', function () {
}
else
{
console
.
info
(
'
[camera] case createVideoOutput success
'
);
}
await
initCaptureSession
(
videoOutput
);
captureSession
=
await
videoRecorderBase
.
initCaptureSession
(
videoOutput
,
cameraManager
,
cameras
,
cameraID
);
await
videoOutput
.
start
().
then
(()
=>
{
console
.
info
(
'
[camera] case videoOutput start success
'
);
});
toNextStep
(
videoRecorder
,
steps
,
done
);
});
eventEmitter
.
on
(
SETSTART
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
toNextStep
(
videoRecorder
,
steps
,
done
);
});
eventEmitter
.
on
(
SETPAUSE
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
toNextStep
(
videoRecorder
,
steps
,
done
);
});
eventEmitter
.
on
(
CLOSE_STREAM
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
await
videoOutput
.
stop
().
then
(()
=>
{
...
...
@@ -234,7 +145,7 @@ describe('VideoRecorderAPICallbackTest', function () {
console
.
info
(
'
[camera] case videoOutput release success
'
);
});
videoOutput
=
undefined
;
await
stopCaptureSession
(
);
await
videoRecorderBase
.
stopCaptureSession
(
captureSession
);
toNextStep
(
videoRecorder
,
steps
,
done
);
});
...
...
@@ -273,23 +184,6 @@ describe('VideoRecorderAPICallbackTest', function () {
});
});
eventEmitter
.
on
(
PREPARE_OLNYVIDEO_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
prepare
(
onlyVideoConfig
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case prepare success
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
steps
.
shift
();
console
.
info
(
'
case prepare error hanpped
'
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
{
printfError
(
err
,
done
);
}
});
});
eventEmitter
.
on
(
GETSURFACE_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
getInputSurface
((
err
,
outPutSurface
)
=>
{
...
...
@@ -313,7 +207,7 @@ describe('VideoRecorderAPICallbackTest', function () {
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case start success
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
playing
'
);
sleep
(
RECORDER_TIME
);
mediaTestBase
.
m
sleep
(
RECORDER_TIME
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
steps
.
shift
();
...
...
@@ -330,7 +224,7 @@ describe('VideoRecorderAPICallbackTest', function () {
videoRecorder
.
pause
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case pause success
'
);
sleep
(
PAUSE_TIME
);
mediaTestBase
.
m
sleep
(
PAUSE_TIME
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
paused
'
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
...
...
@@ -348,7 +242,7 @@ describe('VideoRecorderAPICallbackTest', function () {
videoRecorder
.
resume
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case resume success
'
);
sleep
(
RECORDER_TIME
);
mediaTestBase
.
m
sleep
(
RECORDER_TIME
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
playing
'
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
...
...
@@ -421,7 +315,6 @@ describe('VideoRecorderAPICallbackTest', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
videoConfig
.
url
=
fdPath
;
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
...
...
@@ -453,7 +346,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
CLOSE_STREAM
,
PREPARE_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
START_EVENT
,
PAUSE_EVENT
,
CLOSE_STREAM
,
PREPARE_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -468,7 +361,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
RESUME_EVENT
,
START_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
PREPARE_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -573,7 +466,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
START_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
START_EVENT
,
PAUSE_EVENT
,
START_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -588,7 +481,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
RESUME_EVENT
,
START_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
START_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -692,7 +585,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
START_EVENT
,
PAUSE_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -707,7 +600,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTART
,
RESUME_EVENT
,
SETPAUSE
,
START_EVENT
,
PAUSE_EVENT
,
RESUME_EVENT
,
PAUSE_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -768,7 +661,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
PAUSE_EVENT
,
PAUSE_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
START_EVENT
,
PAUSE_EVENT
,
PAUSE_EVENT
,
PAUSE_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -826,7 +719,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
START_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -887,7 +780,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
START_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
RESUME_EVENT
,
RESUME_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -946,7 +839,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
STOP_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
START_EVENT
,
PAUSE_EVENT
,
STOP_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -961,7 +854,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
RESUME_EVENT
,
START_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
STOP_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -1066,7 +959,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
RESET_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
START_EVENT
,
PAUSE_EVENT
,
RESET_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -1081,7 +974,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
RESUME_EVENT
,
START_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
RESET_EVENT
,
CLOSE_STREAM
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -1184,7 +1077,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
GETSURFACE_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
PAUSE_EVENT
,
GETSURFACE_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
@@ -1199,7 +1092,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_STREEAM
,
START_EVENT
,
SETPAUSE
,
PAUSE_EVENT
,
SETPAUSE
,
SETSTAR
T
,
RESUME_EVENT
,
GETSURFACE_EVENT
,
PAUSE_EVEN
T
,
RESUME_EVENT
,
GETSURFACE_EVENT
,
RELEASE_EVENT
,
CLOSE_STREAM
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoRecorder
,
mySteps
,
done
);
})
...
...
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js
浏览文件 @
5ec8af91
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
浏览文件 @
5ec8af91
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录