Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f037d5a7
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看板
未验证
提交
f037d5a7
编写于
4月 28, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3056 公共函数提取
Merge pull request !3056 from NOBUGGERS/r00514670_0425
上级
20f1f08f
b1a84062
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
421 addition
and
485 deletion
+421
-485
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+42
-2
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
...ioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
+37
-41
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+60
-64
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
...layer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
+6
-10
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+135
-168
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+36
-69
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+105
-131
未找到文件。
multimedia/media/media_js_standard/MediaTestBase.js
浏览文件 @
f037d5a7
...
@@ -16,11 +16,13 @@
...
@@ -16,11 +16,13 @@
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
{
expect
}
from
'
deccjsunit/index
'
import
{
expect
}
from
'
deccjsunit/index
'
// File operation
export
async
function
getFileDescriptor
(
fileName
)
{
export
async
function
getFileDescriptor
(
fileName
)
{
let
fileDescriptor
=
undefined
;
let
fileDescriptor
=
undefined
;
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
console
.
log
(
'
case getRawFileDescriptor success fileName:
'
+
fileName
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
});
});
...
@@ -30,8 +32,8 @@ export async function getFileDescriptor(fileName) {
...
@@ -30,8 +32,8 @@ export async function getFileDescriptor(fileName) {
export
async
function
closeFileDescriptor
(
fileName
)
{
export
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
value
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
()
=>
{
console
.
log
(
'
case closeRawFileDescriptor
'
+
valu
e
);
console
.
log
(
'
case closeRawFileDescriptor
'
+
fileNam
e
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
});
});
...
@@ -45,3 +47,41 @@ export function isFileOpen(fileDescriptor, done) {
...
@@ -45,3 +47,41 @@ export function isFileOpen(fileDescriptor, done) {
done
();
done
();
}
}
}
}
// wait synchronously
export
function
msleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
// wait asynchronously
export
async
function
msleepAsync
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
export
function
printError
(
error
,
done
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
done
();
}
// callback function for promise call back error
export
function
failureCallback
(
error
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
}
// callback function for promise catch error
export
function
catchCallback
(
error
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
}
export
function
printDescription
(
obj
)
{
let
description
=
""
;
for
(
let
i
in
obj
)
{
let
property
=
obj
[
i
];
console
.
info
(
'
case key is
'
+
i
);
console
.
info
(
'
case value is
'
+
property
);
description
+=
i
+
"
=
"
+
property
+
"
\n
"
;
}
}
\ No newline at end of file
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
浏览文件 @
f037d5a7
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
import
media
from
'
@ohos.multimedia.media
'
import
media
from
'
@ohos.multimedia.media
'
import
{
getFileDescriptor
,
closeFileDescriptor
,
isFileOpen
}
from
'
../../../../../MediaTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioAPI
'
,
function
()
{
describe
(
'
PlayerLocalTestAudioAPI
'
,
function
()
{
...
@@ -49,14 +49,14 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -49,14 +49,14 @@ describe('PlayerLocalTestAudioAPI', function () {
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
isTimeOut
=
false
;
isTimeOut
=
false
;
await
getFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
await
mediaTestBase
.
getFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
fileDescriptor
=
res
;
});
});
console
.
info
(
'
beforeEach case
'
);
console
.
info
(
'
beforeEach case
'
);
})
})
afterEach
(
async
function
()
{
afterEach
(
async
function
()
{
await
closeFileDescriptor
(
AUDIO_SOURCE
);
await
mediaTestBase
.
closeFileDescriptor
(
AUDIO_SOURCE
);
console
.
info
(
'
afterEach case
'
);
console
.
info
(
'
afterEach case
'
);
})
})
...
@@ -64,10 +64,6 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -64,10 +64,6 @@ describe('PlayerLocalTestAudioAPI', function () {
console
.
info
(
'
afterAll case
'
);
console
.
info
(
'
afterAll case
'
);
})
})
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
function
initAudioPlayer
()
{
function
initAudioPlayer
()
{
if
(
typeof
(
audioPlayer
)
!=
'
undefined
'
)
{
if
(
typeof
(
audioPlayer
)
!=
'
undefined
'
)
{
audioPlayer
.
release
();
audioPlayer
.
release
();
...
@@ -147,7 +143,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -147,7 +143,7 @@ describe('PlayerLocalTestAudioAPI', function () {
audioPlayer
.
on
(
'
play
'
,
()
=>
{
audioPlayer
.
on
(
'
play
'
,
()
=>
{
mySteps
.
shift
();
mySteps
.
shift
();
console
.
info
(
`case play called`
);
console
.
info
(
`case play called`
);
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
console
.
info
(
`case play currentTime is
${
audioPlayer
.
currentTime
}
`
);
console
.
info
(
`case play currentTime is
${
audioPlayer
.
currentTime
}
`
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
if
(
mySteps
[
0
]
==
FINISH_STATE
)
{
if
(
mySteps
[
0
]
==
FINISH_STATE
)
{
...
@@ -199,7 +195,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -199,7 +195,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console
.
info
(
`case loop is
${
audioPlayer
.
loop
}
`
);
console
.
info
(
`case loop is
${
audioPlayer
.
loop
}
`
);
if
((
audioPlayer
.
loop
==
true
)
&&
(
seekDoneTime
==
DURATION_TIME
))
{
if
((
audioPlayer
.
loop
==
true
)
&&
(
seekDoneTime
==
DURATION_TIME
))
{
console
.
info
(
'
case loop is true
'
);
console
.
info
(
'
case loop is true
'
);
sleep
(
PLAY_STATE
);
mediaTestBase
.
m
sleep
(
PLAY_STATE
);
}
}
if
((
seekDoneTime
<
audioPlayer
.
duration
)
||
(
audioPlayer
.
state
==
'
paused
'
))
{
if
((
seekDoneTime
<
audioPlayer
.
duration
)
||
(
audioPlayer
.
state
==
'
paused
'
))
{
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
,
done
);
...
@@ -210,7 +206,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -210,7 +206,7 @@ describe('PlayerLocalTestAudioAPI', function () {
mySteps
.
shift
();
mySteps
.
shift
();
mySteps
.
shift
();
mySteps
.
shift
();
if
(
audioPlayer
.
state
==
'
playing
'
)
{
if
(
audioPlayer
.
state
==
'
playing
'
)
{
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
}
}
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
,
done
);
});
});
...
@@ -252,7 +248,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -252,7 +248,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
fileDescriptor
.
fd
=
-
1
;
fileDescriptor
.
fd
=
-
1
;
let
mySteps
=
new
Array
(
ERROR_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
...
@@ -269,7 +265,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -269,7 +265,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
fileDescriptor
.
offset
=
1
;
fileDescriptor
.
offset
=
1
;
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
...
@@ -286,7 +282,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -286,7 +282,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
fileDescriptor
.
length
=
-
1
;
fileDescriptor
.
length
=
-
1
;
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
...
@@ -303,7 +299,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -303,7 +299,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
ERROR_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -319,7 +315,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -319,7 +315,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
console
.
info
(
`case update`
);
console
.
info
(
`case update`
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
...
@@ -336,7 +332,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -336,7 +332,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -352,7 +348,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -352,7 +348,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PLAY_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -368,7 +364,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -368,7 +364,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
RESET_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
RESET_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -384,7 +380,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -384,7 +380,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -400,7 +396,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -400,7 +396,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -416,7 +412,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -416,7 +412,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
PLAY_STATE
,
STOP_STATE
,
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
PLAY_STATE
,
STOP_STATE
,
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -432,7 +428,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -432,7 +428,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PAUSE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -448,7 +444,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -448,7 +444,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -464,7 +460,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -464,7 +460,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -480,7 +476,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -480,7 +476,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
STOP_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -496,7 +492,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -496,7 +492,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -512,7 +508,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -512,7 +508,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -528,7 +524,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -528,7 +524,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -544,7 +540,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -544,7 +540,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -560,7 +556,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -560,7 +556,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -576,7 +572,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -576,7 +572,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
var
mySteps
=
new
Array
(
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
var
mySteps
=
new
Array
(
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -592,7 +588,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -592,7 +588,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -608,7 +604,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -608,7 +604,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -624,7 +620,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -624,7 +620,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RELEASE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -640,7 +636,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -640,7 +636,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RELEASE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -656,7 +652,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -656,7 +652,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RELEASE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -672,7 +668,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -672,7 +668,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
RELEASE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -688,7 +684,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -688,7 +684,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
RELEASE_STATE
,
END_STATE
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
setCallback
(
mySteps
,
done
);
...
@@ -704,7 +700,7 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -704,7 +700,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
initAudioPlayer
();
initAudioPlayer
();
expect
(
audioPlayer
.
src
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
src
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
undefined
);
...
@@ -723,10 +719,10 @@ describe('PlayerLocalTestAudioAPI', function () {
...
@@ -723,10 +719,10 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
* @tc.level : Level2
*/
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
initAudioPlayer
();
initAudioPlayer
();
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
expect
(
audioPlayer
.
src
).
assertEqual
(
fdHead
+
fileDescriptor
.
fd
);
expect
(
audioPlayer
.
src
).
assertEqual
(
fdHead
+
fileDescriptor
.
fd
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
f037d5a7
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
浏览文件 @
f037d5a7
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
import
media
from
'
@ohos.multimedia.media
'
import
media
from
'
@ohos.multimedia.media
'
import
{
getFileDescriptor
,
closeFileDescriptor
,
isFileOpen
}
from
'
../../../../../MediaTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioFormat
'
,
function
()
{
describe
(
'
PlayerLocalTestAudioFormat
'
,
function
()
{
...
@@ -41,21 +41,17 @@ describe('PlayerLocalTestAudioFormat', function () {
...
@@ -41,21 +41,17 @@ describe('PlayerLocalTestAudioFormat', function () {
})
})
afterAll
(
async
function
()
{
afterAll
(
async
function
()
{
await
closeFileDescriptor
(
audioSource
);
await
mediaTestBase
.
closeFileDescriptor
(
audioSource
);
console
.
info
(
'
afterAll case
'
);
console
.
info
(
'
afterAll case
'
);
})
})
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
async
function
playSource
(
audioFile
,
done
)
{
async
function
playSource
(
audioFile
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
let
audioPlayer
=
media
.
createAudioPlayer
();
audioSource
=
audioFile
;
audioSource
=
audioFile
;
await
getFileDescriptor
(
audioSource
).
then
((
res
)
=>
{
await
mediaTestBase
.
getFileDescriptor
(
audioSource
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
fileDescriptor
=
res
;
});
});
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
audioPlayer
.
src
=
'
fd://
'
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
'
fd://
'
+
fileDescriptor
.
fd
;
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
console
.
info
(
'
case set source success
'
);
...
@@ -66,7 +62,7 @@ describe('PlayerLocalTestAudioFormat', function () {
...
@@ -66,7 +62,7 @@ describe('PlayerLocalTestAudioFormat', function () {
audioPlayer
.
on
(
'
play
'
,
()
=>
{
audioPlayer
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
case start to play
'
);
console
.
info
(
'
case start to play
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
if
(
!
isToSeek
)
{
if
(
!
isToSeek
)
{
audioPlayer
.
pause
();
audioPlayer
.
pause
();
}
else
{
}
else
{
...
@@ -102,7 +98,7 @@ describe('PlayerLocalTestAudioFormat', function () {
...
@@ -102,7 +98,7 @@ describe('PlayerLocalTestAudioFormat', function () {
if
(
!
isToDuration
)
{
if
(
!
isToDuration
)
{
expect
(
SEEK_TIME
).
assertEqual
(
seekDoneTime
);
expect
(
SEEK_TIME
).
assertEqual
(
seekDoneTime
);
isToDuration
=
true
;
isToDuration
=
true
;
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
audioPlayer
.
seek
(
audioPlayer
.
duration
);
audioPlayer
.
seek
(
audioPlayer
.
duration
);
}
else
{
}
else
{
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
f037d5a7
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
f037d5a7
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import
media
from
'
@ohos.multimedia.media
'
import
media
from
'
@ohos.multimedia.media
'
import
{
toNewPage
,
clearRouter
}
from
'
./VideoPlayerTestBase.js
'
;
import
{
toNewPage
,
clearRouter
}
from
'
./VideoPlayerTestBase.js
'
;
import
{
getFileDescriptor
,
closeFileDescriptor
,
isFileOpen
}
from
'
../../../../../MediaTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncCallbackTest
'
,
function
()
{
describe
(
'
VideoPlayerFuncCallbackTest
'
,
function
()
{
...
@@ -58,7 +58,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -58,7 +58,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
beforeAll
(
async
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
await
getFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
await
mediaTestBase
.
getFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
fileDescriptor
=
res
;
});
});
})
})
...
@@ -66,7 +66,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -66,7 +66,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
await
toNewPage
(
page
);
await
toNewPage
(
page
);
page
=
(
page
+
1
)
%
2
;
page
=
(
page
+
1
)
%
2
;
await
msleep
(
1000
).
then
(()
=>
{},
failureCallback
).
catch
(
catchCallback
);
await
mediaTestBase
.
msleepAsync
(
1000
).
then
(
()
=>
{},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
surfaceID
=
globalThis
.
value
;
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
console
.
info
(
'
beforeEach case
'
);
console
.
info
(
'
beforeEach case
'
);
...
@@ -78,44 +79,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -78,44 +79,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
})
})
afterAll
(
async
function
()
{
afterAll
(
async
function
()
{
await
closeFileDescriptor
(
VIDEO_SOURCE
);
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_SOURCE
);
console
.
info
(
'
afterAll case
'
);
console
.
info
(
'
afterAll case
'
);
})
})
function
failureCallback
(
error
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
}
function
catchCallback
(
error
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
}
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
function
msleep
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
function
printfError
(
error
,
done
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
done
();
}
function
printfDescription
(
obj
)
{
let
description
=
""
;
for
(
let
i
in
obj
)
{
let
property
=
obj
[
i
];
console
.
info
(
'
case key is
'
+
i
);
console
.
info
(
'
case value is
'
+
property
);
description
+=
i
+
"
=
"
+
property
+
"
\n
"
;
}
}
function
toNextStep
(
videoPlayer
,
steps
,
done
)
{
function
toNextStep
(
videoPlayer
,
steps
,
done
)
{
if
(
steps
[
0
]
==
END_EVENT
)
{
if
(
steps
[
0
]
==
END_EVENT
)
{
console
.
info
(
'
case success!!
'
);
console
.
info
(
'
case success!!
'
);
...
@@ -164,7 +131,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -164,7 +131,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -192,7 +159,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -192,7 +159,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
on
(
WAIT_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
WAIT_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
steps
.
shift
();
steps
.
shift
();
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
});
});
...
@@ -207,7 +174,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -207,7 +174,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
})
})
});
});
...
@@ -226,7 +193,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -226,7 +193,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -245,7 +212,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -245,7 +212,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -255,14 +222,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -255,14 +222,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
videoPlayer
.
getTrackDescription
((
err
,
arrlist
)
=>
{
videoPlayer
.
getTrackDescription
((
err
,
arrlist
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
printf
Description
(
arrlist
[
i
]);
mediaTestBase
.
print
Description
(
arrlist
[
i
]);
}
}
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
}
else
if
((
typeof
(
err
)
!=
'
undefined
'
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -274,7 +241,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -274,7 +241,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
console
.
info
(
'
case play success!!
'
);
console
.
info
(
'
case play success!!
'
);
sleep
(
PLAY_TIME
);
mediaTestBase
.
m
sleep
(
PLAY_TIME
);
let
endTime
=
videoPlayer
.
currentTime
;
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
...
@@ -282,7 +249,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -282,7 +249,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -298,7 +265,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -298,7 +265,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -314,7 +281,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -314,7 +281,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -330,7 +297,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -330,7 +297,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -345,7 +312,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -345,7 +312,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -391,7 +358,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -391,7 +358,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -414,7 +381,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -414,7 +381,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -431,7 +398,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -431,7 +398,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -468,7 +435,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -468,7 +435,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
let
startTime
=
videoPlayer
.
currentTime
;
let
startTime
=
videoPlayer
.
currentTime
;
videoPlayer
.
setSpeed
(
speedValue
,
(
err
,
speedMode
)
=>
{
videoPlayer
.
setSpeed
(
speedValue
,
(
err
,
speedMode
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
sleep
(
1000
);
mediaTestBase
.
m
sleep
(
1000
);
expect
(
speedValue
).
assertEqual
(
speedMode
);
expect
(
speedValue
).
assertEqual
(
speedMode
);
console
.
info
(
'
case setSpeed success and speedMode is
'
+
speedMode
);
console
.
info
(
'
case setSpeed success and speedMode is
'
+
speedMode
);
checkSpeedTime
(
videoPlayer
,
speedValue
,
startTime
);
checkSpeedTime
(
videoPlayer
,
speedValue
,
startTime
);
...
@@ -477,7 +444,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -477,7 +444,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps
.
shift
();
steps
.
shift
();
toNextStep
(
videoPlayer
,
steps
,
done
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -491,7 +458,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -491,7 +458,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SETSOURCE
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SETSOURCE
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
fdPath
=
''
;
let
fdPath
=
''
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSOURCE_EVENT
,
fdPath
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSOURCE_EVENT
,
fdPath
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
@@ -507,7 +474,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -507,7 +474,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETVOLUME
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETVOLUME
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETVOLUME_EVENT
,
0
,
SETVOLUME_EVENT
,
0.5
,
SETVOLUME_EVENT
,
1
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETVOLUME_EVENT
,
0
,
SETVOLUME_EVENT
,
0.5
,
SETVOLUME_EVENT
,
1
,
...
@@ -524,7 +491,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -524,7 +491,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETSPEED
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETSPEED
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETSPEED_EVENT
,
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETSPEED_EVENT
,
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
,
...
@@ -544,7 +511,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -544,7 +511,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
...
@@ -561,7 +528,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -561,7 +528,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_CALLBACK
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_CALLBACK
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
frameCount
=
-
1
;
let
frameCount
=
-
1
;
let
completedCount
=
0
;
let
completedCount
=
0
;
...
@@ -576,7 +543,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -576,7 +543,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console
.
info
(
'
case createVideoPlayer success!!
'
);
console
.
info
(
'
case createVideoPlayer success!!
'
);
eventEmitter
.
emit
(
'
test_callback
'
);
eventEmitter
.
emit
(
'
test_callback
'
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -593,7 +560,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -593,7 +560,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console
.
info
(
'
case release success!!
'
);
console
.
info
(
'
case release success!!
'
);
done
();
done
();
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -623,7 +590,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -623,7 +590,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console
.
info
(
'
case setDisplaySurface success!!
'
);
console
.
info
(
'
case setDisplaySurface success!!
'
);
eventEmitter
.
emit
(
'
test_prepare
'
);
eventEmitter
.
emit
(
'
test_prepare
'
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
})
})
});
});
...
@@ -638,7 +605,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -638,7 +605,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console
.
info
(
'
case prepare success!!
'
);
console
.
info
(
'
case prepare success!!
'
);
eventEmitter
.
emit
(
'
test_play
'
);
eventEmitter
.
emit
(
'
test_play
'
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -649,7 +616,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -649,7 +616,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
console
.
info
(
'
case play success!!
'
);
console
.
info
(
'
case play success!!
'
);
}
else
{
}
else
{
printf
Error
(
err
,
done
);
mediaTestBase
.
print
Error
(
err
,
done
);
}
}
});
});
});
});
...
@@ -665,7 +632,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -665,7 +632,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
GETDESCRIPTION
,
RELEASE_EVENT
,
END_EVENT
);
PREPARE_EVENT
,
GETDESCRIPTION
,
RELEASE_EVENT
,
END_EVENT
);
...
@@ -681,7 +648,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -681,7 +648,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_LOOP
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_LOOP
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
SETLOOP_EVENT
,
true
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
WAIT_EVENT
,
PREPARE_EVENT
,
SETLOOP_EVENT
,
true
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
WAIT_EVENT
,
...
@@ -699,7 +666,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
...
@@ -699,7 +666,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
* @tc.level : Level0
*/
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
videoPlayer
=
null
;
let
fdPath
=
fdHead
+
fileDescriptor
.
fd
;
let
fdPath
=
fdHead
+
fileDescriptor
.
fd
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
f037d5a7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录