Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2332ce3f
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,发现更多精彩内容 >>
未验证
提交
2332ce3f
编写于
4月 07, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2957 音视频播放:增加fd输入测试,公共函数提取
Merge pull request !2957 from NOBUGGERS/r0051460_0402
上级
388b54ff
6713009c
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
260 addition
and
49 deletion
+260
-49
multimedia/media/media_js_standard/audioPlayer/Test.json
multimedia/media/media_js_standard/audioPlayer/Test.json
+9
-8
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+150
-0
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestBase.js
...ndard/audioPlayer/src/main/js/test/PlayerLocalTestBase.js
+39
-0
multimedia/media/media_js_standard/videoPlayer/Test.json
multimedia/media/media_js_standard/videoPlayer/Test.json
+9
-8
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+13
-28
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+2
-5
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js
...ndard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js
+38
-0
未找到文件。
multimedia/media/media_js_standard/audioPlayer/Test.json
浏览文件 @
2332ce3f
...
...
@@ -13,13 +13,21 @@
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile"
],
"teardown-command"
:[
]
},
{
"type"
:
"PushKit"
,
"pre-push"
:
[
],
"push"
:
[
"./resource/audio/01.mp3 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/01.mp3 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/02.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/"
,
"./resource/audio/03.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/"
,
"./resource/audio/04.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/"
,
...
...
@@ -44,13 +52,6 @@
"./resource/audio/97.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/"
,
"./resource/audio/98.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
],
"teardown-command"
:[
]
}
]
}
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
2332ce3f
...
...
@@ -15,12 +15,14 @@
import
media
from
'
@ohos.multimedia.media
'
import
fileIO
from
'
@ohos.fileio
'
import
{
getFileDescriptor
,
closeFileDescriptor
}
from
'
./PlayerLocalTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioFUNC
'
,
function
()
{
let
audioPlayer
=
media
.
createAudioPlayer
();
let
isTimeOut
=
false
;
const
AUDIO_SOURCE
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/01.mp3
'
;
const
AUDIO_FILE
=
'
01.mp3
'
;
const
PLAY_TIME
=
3000
;
const
DURATION_TIME
=
219600
;
const
SEEK_TIME
=
5000
;
...
...
@@ -37,15 +39,20 @@ describe('PlayerLocalTestAudioFUNC', function () {
const
ERROR_STATE
=
9
;
const
FINISH_STATE
=
10
;
const
LOOP_STATE
=
11
;
const
FDSRC_STATE
=
12
;
const
SECOND_INDEX
=
1
;
const
RAND_NUM
=
5
;
const
TIME_OUT
=
40000
;
const
MAX_VOLUME
=
1
;
let
fdPath
;
let
fdValue
;
let
fileDescriptor
;
beforeAll
(
async
function
()
{
await
getFd
();
await
getFileDescriptor
(
AUDIO_FILE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -60,6 +67,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
afterAll
(
async
function
()
{
await
fileIO
.
close
(
fdValue
);
await
closeFileDescriptor
(
AUDIO_FILE
);
console
.
info
(
'
afterAll case
'
);
})
...
...
@@ -103,6 +111,10 @@ describe('PlayerLocalTestAudioFUNC', function () {
console
.
info
(
`case to prepare`
);
audioPlayer
.
src
=
fdPath
;
break
;
case
FDSRC_STATE
:
console
.
info
(
`case to prepare`
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
break
;
case
PLAY_STATE
:
console
.
info
(
`case to play`
);
audioPlayer
.
play
();
...
...
@@ -819,4 +831,142 @@ describe('PlayerLocalTestAudioFUNC', function () {
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fdPath
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0100
* @tc.name : 001.play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`case update`
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0200
* @tc.name : 002.play->pause
* @tc.desc : Audio playback control test
* @tc.size : MediumTestTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0200
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0300
* @tc.name : 003.play->pause->play->reset
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0300
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0500
* @tc.name : 005.play->reset
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0500
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0600
* @tc.name : 006.play->pause->play->pause
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0600
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0700
* @tc.name : 007.play->pause->stop
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0700
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0800
* @tc.name : 008.play->pause->play->stop
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0800
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0900
* @tc.name : 009.play->stop->reset->play->pause->play->reset
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0900
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_1000
* @tc.name : 010.play->pause->stop->reset->play->pause->reset
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_1000
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
fdSrc
=
fileDescriptor
;
})
})
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestBase.js
0 → 100644
浏览文件 @
2332ce3f
/*
* 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
resourceManager
from
'
@ohos.resourceManager
'
;
export
async
function
getFileDescriptor
(
fileName
)
{
let
fileDescriptor
;
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
'
case getRawFileDescriptor fd:
'
+
value
.
fd
);
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
});
});
return
fileDescriptor
;
}
export
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
'
case closeRawFileDescriptor
'
+
value
);
}).
catch
(
error
=>
{
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
});
});
}
multimedia/media/media_js_standard/videoPlayer/Test.json
浏览文件 @
2332ce3f
...
...
@@ -15,18 +15,19 @@
"cleanup-apps"
:
true
},
{
"type"
:
"PushKit"
,
"pre-push"
:
[
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile"
],
"push"
:
[
"./resource/audio/H264_AAC.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/"
"teardown-command"
:[
]
},
{
"type"
:
"
Shell
Kit"
,
"
run-command
"
:
[
"type"
:
"
Push
Kit"
,
"
pre-push
"
:
[
],
"teardown-command"
:[
"push"
:
[
"./resource/audio/H264_AAC.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/"
]
}
]
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
2332ce3f
...
...
@@ -15,11 +15,11 @@
import
media
from
'
@ohos.multimedia.media
'
import
router
from
'
@system.router
'
import
fileIO
from
'
@ohos.fileio
'
import
{
getFileDescriptor
,
closeFileDescriptor
}
from
'
./VideoPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncCallbackTest
'
,
function
()
{
const
AUDIO_SOURCE
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/
H264_AAC.mp4
'
;
const
VIDEO_SOURCE
=
'
H264_AAC.mp4
'
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
5000
;
const
WIDTH_VALUE
=
720
;
...
...
@@ -29,7 +29,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
const
SETSURFACE_EVENT
=
'
setDisplaySurface
'
;
const
GETDESCRIPTION
=
'
getTrackDescription
'
;
const
PREPARE_EVENT
=
'
prepare
'
;
const
PREPARE2_EVENT
=
'
prepare2
'
;
const
SRC_PREPARE_EVENT
=
'
src2prepare
'
;
const
PLAY_EVENT
=
'
play
'
;
const
PAUSE_EVENT
=
'
pause
'
;
const
STOP_EVENT
=
'
stop
'
;
...
...
@@ -46,20 +46,20 @@ describe('VideoPlayerFuncCallbackTest', function () {
const
NEXT_FRAME_TIME
=
8333
;
const
PREV_FRAME_TIME
=
4166
;
let
surfaceID
=
''
;
let
fdPath
;
let
fdValue
;
let
fileDescriptor
;
let
temp
=
0
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
beforeAll
(
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
await
getFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
})
beforeEach
(
async
function
()
{
console
.
info
(
'
case flush surfaceID start
'
);
await
toNewPage
();
console
.
info
(
'
case flush surfaceID end
'
);
await
msleep
(
1000
).
then
(()
=>
{
},
failureCallback
).
catch
(
catchCallback
);
console
.
info
(
'
beforeEach case
'
);
...
...
@@ -71,7 +71,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
})
afterAll
(
async
function
()
{
await
fileIO
.
close
(
fdValue
);
await
closeFileDescriptor
(
VIDEO_SOURCE
);
console
.
info
(
'
afterAll case
'
);
})
...
...
@@ -112,19 +112,6 @@ describe('VideoPlayerFuncCallbackTest', function () {
}
}
async
function
getFd
()
{
fdPath
=
'
fd://
'
;
await
fileIO
.
open
(
AUDIO_SOURCE
).
then
((
fdNumber
)
=>
{
fdPath
=
fdPath
+
''
+
fdNumber
;
fdValue
=
fdNumber
;
console
.
info
(
'
[fileIO]case open fd success,fdPath is
'
+
fdPath
);
},
(
err
)
=>
{
console
.
info
(
'
[fileIO]case open fd failed
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[fileIO]case catch open fd failed
'
);
});
}
function
printfError
(
error
,
done
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
...
...
@@ -149,7 +136,6 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
emit
(
steps
[
0
],
videoPlayer
,
steps
,
done
);
}
}
function
setOnCallback
(
videoPlayer
)
{
videoPlayer
.
on
(
'
playbackCompleted
'
,
()
=>
{
console
.
info
(
'
case playbackCompleted success
'
);
...
...
@@ -190,7 +176,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
on
(
SETSURFACE_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
steps
.
shift
();
videoPlayer
.
url
=
fdPath
;
videoPlayer
.
fdSrc
=
fileDescriptor
;
videoPlayer
.
setDisplaySurface
(
surfaceID
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
...
...
@@ -218,9 +204,9 @@ describe('VideoPlayerFuncCallbackTest', function () {
});
});
eventEmitter
.
on
(
PREPARE2
_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
SRC_PREPARE
_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
steps
.
shift
();
videoPlayer
.
url
=
fdPath
;
videoPlayer
.
fdSrc
=
fileDescriptor
;
videoPlayer
.
prepare
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
...
...
@@ -446,7 +432,6 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
await
getFd
();
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
let
videoPlayer
=
null
;
...
...
@@ -742,7 +727,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
RESET_EVENT
,
PREPARE2
_EVENT
,
STOP_EVENT
,
RESET_EVENT
,
SRC_PREPARE
_EVENT
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
2332ce3f
...
...
@@ -19,10 +19,9 @@ import fileIO from '@ohos.fileio'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncPromiseTest
'
,
function
()
{
const
AUDI
O_SOURCE
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4
'
;
const
VIDE
O_SOURCE
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4
'
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
5000
;
const
SEEK_CLOSEST
=
3
;
const
WIDTH_VALUE
=
720
;
const
HEIGHT_VALUE
=
480
;
const
DURATION_TIME
=
10034
;
...
...
@@ -38,9 +37,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
})
beforeEach
(
async
function
()
{
console
.
info
(
'
case flush surfaceID start
'
);
await
toNewPage
();
console
.
info
(
'
case flush surfaceID end
'
);
await
msleep
(
1000
).
then
(()
=>
{
},
failureCallback
).
catch
(
catchCallback
);
console
.
info
(
'
beforeEach case
'
);
...
...
@@ -95,7 +92,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
async
function
getFd
()
{
fdPath
=
'
fd://
'
;
await
fileIO
.
open
(
AUDI
O_SOURCE
).
then
((
fdNumber
)
=>
{
await
fileIO
.
open
(
VIDE
O_SOURCE
).
then
((
fdNumber
)
=>
{
fdPath
=
fdPath
+
''
+
fdNumber
;
fdValue
=
fdNumber
;
console
.
info
(
'
[fileIO]case open fd success,fdPath is
'
+
fdPath
);
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js
0 → 100644
浏览文件 @
2332ce3f
/*
* 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
resourceManager
from
'
@ohos.resourceManager
'
;
export
async
function
getFileDescriptor
(
fileName
)
{
let
fileDescriptor
;
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
});
});
return
fileDescriptor
;
}
export
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
'
case closeRawFileDescriptor
'
+
value
);
}).
catch
(
error
=>
{
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
});
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录