Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6feebf67
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看板
未验证
提交
6feebf67
编写于
3月 29, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 29, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8282 ActsAVPlayerTest优化 偶现fail问题修复
Merge pull request !8282 from Nicklaus/master
上级
f8cde247
1405d5cd
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
1336 addition
and
37 deletion
+1336
-37
multimedia/media/media_js_standard/AVPlayerTestBase.js
multimedia/media/media_js_standard/AVPlayerTestBase.js
+17
-18
multimedia/media/media_js_standard/AVRecorderTestBase.js
multimedia/media/media_js_standard/AVRecorderTestBase.js
+2
-4
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/AVPlayerDataSrcNoSeekAPITest.test.js
...ry/src/main/ets/test/AVPlayerDataSrcNoSeekAPITest.test.js
+823
-0
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerDataSrcNoSeekCompatibilityTest.test.js
...n/ets/test/AVPlayerDataSrcNoSeekCompatibilityTest.test.js
+205
-0
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerDataSrcNoSeekReliabilityTest.test.js
...ain/ets/test/AVPlayerDataSrcNoSeekReliabilityTest.test.js
+274
-0
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
...yer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
+13
-13
未找到文件。
multimedia/media/media_js_standard/AVPlayerTestBase.js
浏览文件 @
6feebf67
...
...
@@ -409,7 +409,7 @@ function setAVPlayerPlayAndPauseWithCallBack(src, avPlayer, playTime, done) {
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
playPauseLoopWithCallBack play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
preparePromise
(
avPlayer
);
await
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
avPlayer
.
play
()
break
;
...
...
@@ -509,19 +509,18 @@ export async function createToRelease(src, avPlayer, done) {
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
CreateToRelease setSource
'
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
release
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
console
.
info
(
'
CreateToRelease avPlayer from stop to release
'
)
console
.
info
(
`case CreateToRelease loop is
${
i
}
`
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
if
(
i
==
999
){
done
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
}
}
export
async
function
playToCompleted
(
src
,
avPlayer
,
done
)
{
...
...
@@ -542,7 +541,7 @@ async function playToCompletedLoop(src, avPlayer, done) {
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
playToCompletedLoop play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
preparePromise
(
avPlayer
);
await
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
avPlayer
.
play
()
break
;
...
...
@@ -601,7 +600,7 @@ export async function seekLoop(src, avPlayer, done) {
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
seekLoop case prepare success
'
);
preparePromise
(
avPlayer
);
await
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
}
await
avPlayer
.
play
().
then
(()
=>
{
...
...
@@ -642,7 +641,7 @@ export async function seekLoopWithoutCallback(src, avPlayer, done) {
await
setSource
(
avPlayer
,
src
);
if
(
avPlayer
.
state
==
'
initialized
'
)
{
avPlayer
.
surfaceId
=
surfaceID
;
preparePromise
(
avPlayer
);
await
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
}
await
avPlayer
.
play
().
then
(()
=>
{
...
...
@@ -2078,7 +2077,7 @@ export async function avPlayerWithoutCallBack(src, avPlayer, done) {
console
.
info
(
'
avPlayerWithoutCallBack setSource
'
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
avPlayer
.
surfaceId
=
surfaceID
;
preparePromise
(
avPlayer
);
await
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
}
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PREPARED
){
...
...
@@ -2110,7 +2109,7 @@ function setAVPlayerPlay(src, avPlayer, done) {
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
setAVPlayerPlay play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
preparePromise
(
avPlayer
)
await
preparePromise
(
avPlayer
)
await
sleep
(
3000
);
avPlayer
.
play
()
break
;
...
...
multimedia/media/media_js_standard/AVRecorderTestBase.js
浏览文件 @
6feebf67
...
...
@@ -18,15 +18,13 @@ import * as mediaTestBase from './MediaTestBase.js';
async
function
idleCallBack
(
avRecorder
)
{
console
.
info
(
'
case createAVRecorder called
'
);
await
media
.
createAVRecorder
(
).
then
((
recorder
)
=>
{
await
media
.
createAVRecorder
(
(
error
,
recorder
)
=>
{
if
(
recorder
!=
null
)
{
avRecorder
=
recorder
;
console
.
info
(
'
createAVRecorder success
'
);
}
else
{
console
.
info
(
'
createAVRecorder fail
'
);
console
.
info
(
`createAVRecorder fail, error:
${
error
}
`
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`createAVRecorder catchCallback, error:
${
error
}
`
);
});
return
avRecorder
;
}
...
...
multimedia/media/media_js_standard/avPlayer/Test.json
浏览文件 @
6feebf67
...
...
@@ -5,8 +5,8 @@
"test-timeout"
:
"180000"
,
"bundle-name"
:
"ohos.acts.multimedia.avplayer"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"
5
000000"
,
"testcase-timeout"
:
8
0
0000
"shell-timeout"
:
"
9
000000"
,
"testcase-timeout"
:
8
5
0000
},
"kits"
:
[
{
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerDataSrcNoSeekAPITest.test.js
0 → 100644
浏览文件 @
6feebf67
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerDataSrcNoSeekCompatibilityTest.test.js
0 → 100644
浏览文件 @
6feebf67
/*
* Copyright (C) 2023 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
media
from
'
@ohos.multimedia.media
'
import
fileio
from
'
@ohos.fileio
'
import
{
testAVPlayerDataSrcNoSeek
,
testAVPlayerFun
}
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
export
default
function
AVPlayerDataSrcNoSeekCompatibilityTest
()
{
describe
(
'
AVPlayerDataSrcNoSeekCompatibilityTest
'
,
function
()
{
const
PLAY_TIME
=
3000
;
let
avPlayer
=
null
;
let
avPlayTest
=
{
width
:
0
,
height
:
0
,
duration
:
-
1
,
}
let
pathDir
=
globalThis
.
abilityContext
.
filesDir
;
let
filePath
=
pathDir
+
"
/01.mp3
"
;
let
stream
=
null
;
let
fd
=
null
;
let
srcNoSeek
=
{
fileSize
:
-
1
,
callback
:
readAtNoSeek
}
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
async
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
if
(
avPlayer
!=
null
)
{
avPlayer
.
release
().
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
})
function
readAtNoSeek
(
buf
,
length
)
{
console
.
info
(
'
readAt length:
'
+
length
);
let
num
=
0
;
if
(
buf
==
undefined
||
length
==
undefined
)
{
expect
().
assertFail
();
return
-
1
;
}
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
length
});
console
.
info
(
'
case readAt num:
'
+
num
);
if
(
num
==
0
)
{
fileio
.
closeSync
(
fd
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
}
if
(
num
>
0
)
{
return
num
;
}
return
-
1
;
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_MP3_0100
* @tc.name : 0100.mp3
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_MP3_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
0
,
height
:
0
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_AAC_0100
* @tc.name : 0100.aac_48ksr_16kbr_1ch
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_AAC_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/aac_48ksr_16kbr_1ch.aac
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
0
,
height
:
0
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_OGG_0100
* @tc.name : 0100.vorbis_48ksr_32kbr_1ch
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_OGG_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/vorbis_48ksr_32kbr_1ch.ogg
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
0
,
height
:
0
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_WAV_0100
* @tc.name : 0100.pcm_96ksr_64kbr_2ch
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_WAV_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/pcm_96ksr_64kbr_2ch.wav
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
0
,
height
:
0
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_FLAC_0100
* @tc.name : 0100.flac_48ksr_32kbr_2ch
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_FLAC_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/flac_48ksr_32kbr_2ch.flac
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
0
,
height
:
0
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_MKV_0100
* @tc.name : 0100.mpeg4_aac_1080p_60r.mkv
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_MKV_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/mpeg4_aac_1080p_60r.mkv
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
1920
,
height
:
1080
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_WEBM_0100
* @tc.name : 0100.vp8_vorbis_270p_10r.webm
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_WEBM_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/vp8_vorbis_270p_10r.webm
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
360
,
height
:
270
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_TS_0100
* @tc.name : 0100.h264_aac_640x480_30r.ts
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_TS_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/h264_aac_640x480_30r.ts
"
;
console
.
info
(
`case filePath is
${
filePath
}
`
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
avPlayTest
=
{
width
:
640
,
height
:
480
,
duration
:
0
};
await
testAVPlayerDataSrcNoSeek
(
srcNoSeek
,
avPlayer
,
avPlayTest
,
PLAY_TIME
,
done
);
})
});
}
\ No newline at end of file
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerDataSrcNoSeekReliabilityTest.test.js
0 → 100644
浏览文件 @
6feebf67
/*
* Copyright (C) 2023 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
media
from
'
@ohos.multimedia.media
'
import
fileio
from
'
@ohos.fileio
'
import
{
testAVPlayerDataSrcNoSeek
,
testAVPlayerFun
,
AV_PLAYER_STATE
}
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
export
default
function
AVPlayerDataSrcNoSeekReliabilityTest
()
{
describe
(
'
AVPlayerDataSrcNoSeekReliabilityTest
'
,
function
()
{
let
avPlayer
=
null
;
let
pathDir
=
globalThis
.
abilityContext
.
filesDir
;
let
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
let
src
=
null
;
let
stream
=
null
;
let
fd
=
null
;
let
readAtCnt
=
0
;
let
expectErr
=
0
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
stream
=
null
;
fd
=
null
;
readAtCnt
=
0
;
expectErr
=
0
;
})
afterEach
(
async
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
if
(
avPlayer
!=
null
)
{
avPlayer
.
release
().
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
})
async
function
testDataSrcNoSeek
(
done
)
{
await
media
.
createAVPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
console
.
info
(
'
case createAVPlayer success
'
);
avPlayer
=
video
;
setCallback
(
done
);
avPlayer
.
dataSrc
=
src
;
}
else
{
console
.
error
(
'
case createAVPlayer failed
'
);
expect
().
assertFail
();
done
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
function
setCallback
(
done
)
{
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
console
.
info
(
`case AVPlayerTestBase.AV_PLAYER_STATE.INITIALIZED`
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
INITIALIZED
);
avPlayer
.
surfaceId
=
globalThis
.
value
;
console
.
info
(
`case toPreparePromise`
);
await
avPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare success
'
);
avPlayer
.
play
();
},
mediaTestBase
.
expectFailureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
case
AV_PLAYER_STATE
.
COMPLETED
:
avPlayer
.
release
().
then
(()
=>
{
avPlayer
=
null
;
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
case
AV_PLAYER_STATE
.
ERROR
:
avPlayer
.
release
().
then
(()
=>
{
avPlayer
=
null
;
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
})
avPlayer
.
on
(
'
seekDone
'
,
async
(
seekDoneTime
)
=>
{
console
.
info
(
`case seekDone called, seekDoneCnt is
${
seekDoneCnt
}
, seekDoneTime is
${
seekDoneTime
}
`
);
})
avPlayer
.
on
(
'
error
'
,
async
(
err
)
=>
{
console
.
error
(
`case error called, errCode is
${
err
.
code
}
, errMessage is
${
err
.
message
}
`
);
expect
(
err
.
code
).
assertEqual
(
expectErr
);
});
}
function
readErr
(
buf
,
length
)
{
let
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
1000
});
return
num
;
}
function
readAt
(
buf
,
length
,
pos
)
{
console
.
info
(
'
readAtCnt:
'
+
readAtCnt
+
'
readAt:
'
+
length
+
'
pos:
'
+
pos
);
readAtCnt
++
;
let
num
=
0
;
if
(
buf
==
undefined
||
length
==
undefined
)
{
console
.
info
(
'
buf == undefined || length == undefined
'
);
expect
().
assertFail
();
return
-
1
;
}
num
=
readErr
(
buf
,
length
);
if
(
num
!=
-
1
)
{
console
.
info
(
'
case readAt num:
'
+
num
);
return
num
;
}
else
if
(
pos
==
undefined
)
{
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
length
});
if
(
num
==
0
)
{
fileio
.
closeSync
(
fd
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
readAtCnt
=
0
;
return
-
1
;
}
}
else
{
num
=
stream
.
readSync
(
buf
,
{
offset
:
0
,
length
:
length
,
position
:
pos
});
}
console
.
info
(
'
case readAt num:
'
+
num
);
if
(
num
>=
0
)
{
return
num
;
}
return
-
1
;
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0100
* @tc.name : 0100.readAt buffer data is not enough
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0100
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
console
.
info
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0100 filePath is
'
+
JSON
.
stringify
(
filePath
));
let
size
=
fileio
.
statSync
(
filePath
).
size
;
console
.
info
(
'
case file size:
'
+
size
);
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
readErr
=
(
buf
,
length
)
=>
{
if
(
readAtCnt
>=
2
&&
readAtCnt
<=
10
)
{
let
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
(
readAtCnt
)
*
1000
});
return
num
;
}
else
{
return
-
1
;
}
}
src
=
{
fileSize
:
-
1
,
callback
:
readAt
}
testDataSrcNoSeek
(
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0200
* @tc.name : 0200.readAt buffer offset is wrong
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0200
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
readErr
=
(
buf
,
length
)
=>
{
if
(
readAtCnt
>=
2
&&
readAtCnt
<=
10
)
{
console
.
info
(
'
case buf length:
'
+
length
+
'
readAtCnt:
'
+
readAtCnt
);
let
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
1000
,
length
:
readAtCnt
*
1000
});
return
num
;
}
else
{
return
-
1
;
}
}
src
=
{
fileSize
:
-
1
,
callback
:
readAt
}
testDataSrcNoSeek
(
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0300
* @tc.name : 0200.readAt media file position is wrong
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0300
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
readErr
=
(
buf
,
length
)
=>
{
if
(
readAtCnt
>=
2
&&
readAtCnt
<=
10
)
{
let
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
1000
,
position
:
readAtCnt
});
return
num
;
}
else
{
return
-
1
;
}
}
src
=
{
fileSize
:
-
1
,
callback
:
readAt
}
testDataSrcNoSeek
(
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0400
* @tc.name : 0200.readAt num is wrong
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0400
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
readErr
=
(
buf
,
length
)
=>
{
if
(
readAtCnt
>=
2
&&
readAtCnt
<=
10
)
{
let
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
(
readAtCnt
)
*
1000
});
return
num
+
readAtCnt
;
}
else
{
return
-
1
;
}
}
src
=
{
fileSize
:
-
1
,
callback
:
readAt
}
testDataSrcNoSeek
(
done
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0500
* @tc.name : 0200.readAt num is wrong
* @tc.desc : data source compatibility test
* @tc.size : MediumTest
* @tc.type : compatibility test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_DATASRC_NOSEEK_RELI_MP3_0500
'
,
0
,
async
function
(
done
)
{
filePath
=
pathDir
+
"
/01_15s.mp3
"
;
fd
=
fileio
.
openSync
(
filePath
,
0o0
);
readErr
=
(
buf
,
length
)
=>
{
if
(
readAtCnt
>=
2
&&
readAtCnt
<=
10
)
{
let
num
=
fileio
.
readSync
(
fd
,
buf
,
{
offset
:
0
,
length
:
(
readAtCnt
)
*
1000
});
return
num
-
readAtCnt
;
}
else
{
return
-
1
;
}
}
src
=
{
fileSize
:
-
1
,
callback
:
readAt
}
testDataSrcNoSeek
(
done
);
})
});
}
\ No newline at end of file
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
浏览文件 @
6feebf67
...
...
@@ -803,19 +803,19 @@ export default function AVPlayerStabilityTest() {
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300
* @tc.name : 001.test complete->play->seek duration (1000 times)
* @tc.desc : Local Video complete->play->seek duration (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300 start
'
)
AVPlayerTestBase
.
playToCompleted
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300 end
'
)
})
//
/* *
//
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300
//
* @tc.name : 001.test complete->play->seek duration (1000 times)
//
* @tc.desc : Local Video complete->play->seek duration (1000 times)
//
* @tc.size : MediumTest
//
* @tc.type : Function test
//
* @tc.level : Level3
//
*/
//
it('SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300', 0, async function (done) {
//
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300 start')
//
AVPlayerTestBase.playToCompleted(videos[0], avPlayer, done);
//
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300 end')
//
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0400
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录