Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
105a04d4
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看板
未验证
提交
105a04d4
编写于
2月 20, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 20, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7615 媒体兼容性新增压稳测试用例
Merge pull request !7615 from Nicklaus/master
上级
c4fc77be
fc947786
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
260 addition
and
2 deletion
+260
-2
multimedia/media/media_js_standard/AVPlayerTestBase.js
multimedia/media/media_js_standard/AVPlayerTestBase.js
+144
-0
multimedia/media/media_js_standard/avPlayer/Test.json
multimedia/media/media_js_standard/avPlayer/Test.json
+2
-2
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
...yer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
+112
-0
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/List.test.ets
...s_standard/avPlayer/entry/src/main/ets/test/List.test.ets
+2
-0
未找到文件。
multimedia/media/media_js_standard/AVPlayerTestBase.js
浏览文件 @
105a04d4
...
...
@@ -386,6 +386,150 @@ export function setAVPlayerFunCb(src, avPlayer, playTest, playTime, done) {
});
}
export
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
function
setAVPlayerPlayAndPauseWithCallBack
(
src
,
avPlayer
,
playTest
,
playTime
,
done
)
{
let
playPauseCount
=
0
;
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case setAVPlayerPlayAndPauseWithCallBack in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
playPauseLoopWithCallBack play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
toPreparePromise
(
avPlayer
,
playTest
);
await
sleep
(
2000
);
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
avPlayer
.
loop
=
true
;
console
.
info
(
'
playPauseLoopWithCallBack play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
playPauseCount
++
;
await
mediaTestBase
.
msleepAsync
(
playTime
);
if
(
playPauseCount
==
1001
){
// step 4: playing -> stop -> release
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from stop to release
'
)
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
// step 2: playing -> pause loop
avPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from play to pause,time is :
'
+
playPauseCount
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
playPauseLoopWithCallBack play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
// step 3: pause -> playing loop
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from pause to play,time is :
'
+
playPauseCount
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
case
AV_PLAYER_STATE
.
ERROR
:
expect
().
assertFail
();
avPlayer
.
release
().
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
error
'
,
async
(
err
)
=>
{
console
.
error
(
`case error called, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
await
avPlayer
.
release
().
then
(()
=>
{
avPlayer
=
null
;
done
();
});
});
}
export
async
function
avPlayerWithCallBack
(
src
,
avPlayer
,
playTest
,
playTime
,
done
)
{
console
.
info
(
`case media source:
${
src
}
`
)
await
media
.
createAVPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
console
.
info
(
'
case createAVPlayer success
'
);
avPlayer
=
video
;
}
else
{
console
.
error
(
'
case createAVPlayer failed
'
);
expect
().
assertFail
();
done
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
setAVPlayerPlayAndPauseWithCallBack
(
src
,
avPlayer
,
playTest
,
playTime
,
done
);
setSource
(
avPlayer
,
src
);
}
async
function
playToPauseLoop
(
avPlayer
){
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
playToPauseLoop play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
playToPauseLoop play filed,error message is :
'
+
err
.
message
)
})
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PLAYING
){
avPlayer
.
loop
=
true
;
await
mediaTestBase
.
msleepAsync
(
2
);
console
.
info
(
'
playToPauseLoop avPlayer from play to pause
'
)
}
await
avPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
playToPauseLoop pause success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
},
(
err
)
=>
{
console
.
error
(
'
playToPauseLoop pause filed,error message is :
'
+
err
.
message
)
})
}
export
async
function
avPlayerWithoutCallBack
(
src
,
avPlayer
,
playTest
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case avPlayerWithoutCallBack in, surfaceID is
${
surfaceID
}
`
);
console
.
info
(
`case media source:
${
src
}
`
)
await
media
.
createAVPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
console
.
info
(
'
case createAVPlayer success
'
);
avPlayer
=
video
;
}
else
{
console
.
error
(
'
case createAVPlayer failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
setSource
(
avPlayer
,
src
);
console
.
info
(
'
avPlayerWithoutCallBack setSource
'
);
avPlayer
.
surfaceId
=
surfaceID
;
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
toPreparePromise
(
avPlayer
,
playTest
);
await
sleep
(
2000
);
}
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PREPARED
){
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from PREPARED to play
'
)
// play to pause loop 1000 times
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
await
playToPauseLoop
(
avPlayer
)
console
.
info
(
`case avPlayerWithoutCallBack playToPauseLoop is
${
i
}
`
);
}
}
await
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
async
function
testAVPlayerFun
(
src
,
avPlayer
,
playTest
,
playTime
,
done
)
{
console
.
info
(
`case media source:
${
src
}
`
)
await
media
.
createAVPlayer
().
then
((
video
)
=>
{
...
...
multimedia/media/media_js_standard/avPlayer/Test.json
浏览文件 @
105a04d4
...
...
@@ -5,8 +5,8 @@
"test-timeout"
:
"180000"
,
"bundle-name"
:
"ohos.acts.multimedia.avplayer"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"
6
00000"
,
"testcase-timeout"
:
7
0000
"shell-timeout"
:
"
10
00000"
,
"testcase-timeout"
:
30
0000
},
"kits"
:
[
{
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
0 → 100644
浏览文件 @
105a04d4
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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
media
from
'
@ohos.multimedia.media
'
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase
'
;
import
*
as
AVPlayerTestBase
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
{
testAVPlayerFun
,
AV_PLAYER_STATE
,
setSource
,
avPlayerWithCallBack
,
avPlayerWithoutCallBack
,
sleep
}
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
export
default
function
AVPlayerStabilityTest
()
{
describe
(
'
AVPlayerStabilityTest
'
,
function
()
{
const
VIDEO_SOURCE
=
'
H264_AAC.mp4
'
;
const
AUDIO_SOURCE
=
'
01.mp3
'
;
const
VIDEO_NOAUDIO
=
'
H264_NONE.mp4
'
let
TAG
=
"
[AVPlayerStabilityTest]
"
;
let
callBackSet
=
0
;
const
PLAY_TIME
=
2
;
let
avPlayer
=
null
;
let
fileDescriptor
=
null
;
let
fileDescriptor2
=
null
;
let
fileDescriptor3
=
null
;
let
avPlayTest1
=
{
width
:
0
,
height
:
0
,
duration
:
-
1
,
};
let
avPlayTest2
=
{
width
:
0
,
height
:
0
,
duration
:
-
1
,
};
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
await
mediaTestBase
.
getStageFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
mediaTestBase
.
getStageFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor2
=
res
;
});
await
mediaTestBase
.
getStageFileDescriptor
(
VIDEO_NOAUDIO
).
then
((
res
)
=>
{
fileDescriptor3
=
res
;
});
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
sleep
(
3000
);
})
afterEach
(
async
function
()
{
if
(
avPlayer
!=
null
)
{
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
TAG
+
'
this testCase execution completed
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
console
.
info
(
'
afterEach case
'
);
await
sleep
(
3000
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_SOURCE
);
await
mediaTestBase
.
closeFileDescriptor
(
AUDIO_SOURCE
);
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_NOAUDIO
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100
* @tc.name : 001.test play pause loop 1000 (waiting for callback)
* @tc.desc : Local Video play to pause 1000 times (waiting for callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100 start
'
)
avPlayTest1
=
{
width
:
720
,
height
:
480
,
duration
:
10034
};
avPlayerWithCallBack
(
fileDescriptor
,
avPlayer
,
avPlayTest1
,
PLAY_TIME
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200
* @tc.name : 001.test play pause loop 1000 (do not wait for callback)
* @tc.desc : Local Video play to pause 1000 times (do not wait for callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200 start
'
)
avPlayTest2
=
{
width
:
720
,
height
:
480
,
duration
:
10034
};
avPlayerWithoutCallBack
(
fileDescriptor
,
avPlayer
,
avPlayTest2
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200 end
'
)
})
})
}
\ No newline at end of file
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/List.test.ets
浏览文件 @
105a04d4
...
...
@@ -16,10 +16,12 @@ import AVPlayerHlsFuncTest from './AVPlayerHlsFuncTest.test.js'
import AVPlayerHttpCompatibilityTest from './AVPlayerHttpCompatibilityTest.test.ets'
import AVPlayerHttpSeekTest from './AVPlayerHttpSeekTest.test.ets'
import AVPlayerLocalTest from './AVPlayerLocalTest.test.js'
import AVPlayerStabilityTest from './AVPlayerStabilityTest.test.js'
export default function testsuite() {
// AVPlayerHlsFuncTest()
// AVPlayerHttpCompatibilityTest();
// AVPlayerHttpSeekTest();
AVPlayerLocalTest();
AVPlayerStabilityTest();
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录