未验证 提交 baa8f5cd 编写于 作者: O openharmony_ci 提交者: Gitee

!2176 播放测试用例播放地址修改为fd打开方式

Merge pull request !2176 from FULIZHONG/0303Player
......@@ -12,36 +12,35 @@
"pre-push": [
],
"push": [
"./resource/audio/01.mp3 ->/data/media/",
"./resource/audio/02.mp3 ->/data/media/",
"./resource/audio/03.mp3 ->/data/media/",
"./resource/audio/04.mp3 ->/data/media/",
"./resource/audio/47.mp4 ->/data/media/",
"./resource/audio/49.mp4 ->/data/media/",
"./resource/audio/50.mp4 ->/data/media/",
"./resource/audio/51.mp4 ->/data/media/",
"./resource/audio/54.mp4 ->/data/media/",
"./resource/audio/55.m4a ->/data/media/",
"./resource/audio/57.m4a ->/data/media/",
"./resource/audio/58.m4a ->/data/media/",
"./resource/audio/59.m4a ->/data/media/",
"./resource/audio/62.m4a ->/data/media/",
"./resource/audio/64.mp4 ->/data/media/",
"./resource/audio/65.mp4 ->/data/media/",
"./resource/audio/66.mp4 ->/data/media/",
"./resource/audio/67.mp4 ->/data/media/",
"./resource/audio/92.mp4 ->/data/media/",
"./resource/audio/93.mp4 ->/data/media/",
"./resource/audio/94.mp4 ->/data/media/",
"./resource/audio/96.mp4 ->/data/media/",
"./resource/audio/97.mp4 ->/data/media/",
"./resource/audio/98.mp4 ->/data/media/"
"./resource/audio/01.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/02.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/03.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/04.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/47.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/49.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/50.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/51.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/54.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/55.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/57.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/58.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/59.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/62.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/64.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/65.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/66.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/67.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/92.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/93.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/94.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/96.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/97.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/",
"./resource/audio/98.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod -R 777 /data/media/*",
"setenforce 0"
],
"teardown-command":[
......
......@@ -14,13 +14,14 @@
*/
import media from '@ohos.multimedia.media'
import fileIO from '@ohos.fileio'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('PlayerLocalTestAudioAPI', function () {
let audioPlayer = media.createAudioPlayer();
let loopValue = false;
let isTimeOut = false;
const AUDIO_SOURCE = 'file://data/media/01.mp3';
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/01.mp3';
const PLAY_TIME = 3000;
const END_STATE = 0;
const SRC_STATE = 1;
......@@ -40,8 +41,11 @@ describe('PlayerLocalTestAudioAPI', function () {
const SECOND_INDEX = 1;
const TIME_OUT = 20000;
const VOLUME_VALUE = 0.5;
let fdPath;
let fdValue;
beforeAll(function() {
beforeAll(async function() {
await getFd();
console.info('beforeAll case');
})
......@@ -54,13 +58,27 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info('afterEach case');
})
afterAll(function() {
afterAll(async function() {
await fileIO.close(fdValue);
console.info('afterAll case');
})
function sleep(time) {
for(let t = Date.now();Date.now() - t <= time;);
};
}
async function getFd() {
fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
}
function initAudioPlayer() {
if (typeof (audioPlayer) != 'undefined') {
......@@ -83,7 +101,7 @@ describe('PlayerLocalTestAudioAPI', function () {
switch (mySteps[0]) {
case SRC_STATE:
console.info(`case to prepare`);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
break;
case PLAY_STATE:
console.info(`case to play`);
......@@ -234,8 +252,7 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep(mySteps,done);
}
});
};
}
/* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100
......@@ -245,13 +262,12 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100', 0, async function (done) {
console.info(`case update`);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -262,12 +278,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PLAY_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -278,12 +293,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, PLAY_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -294,12 +308,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, RESET_STATE, PLAY_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -310,7 +323,6 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100', 0, async function (done) {
let mySteps = new Array(PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -326,12 +338,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -342,12 +353,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300', 0, async function (done) {
let mySteps = new Array(PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -358,12 +368,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, PAUSE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -374,12 +383,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -390,12 +398,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -406,12 +413,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, STOP_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -422,12 +428,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -438,12 +443,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -454,12 +458,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -470,12 +473,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -486,12 +488,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -502,7 +503,6 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100', 0, async function (done) {
var mySteps = new Array(VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer();
......@@ -518,12 +518,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200', 0, async function (done) {
var mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -534,12 +533,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300', 0, async function (done) {
var mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -550,12 +548,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -566,12 +563,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -582,12 +578,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -598,12 +593,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, RELEASE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -614,12 +608,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
})
/* *
......@@ -630,7 +623,6 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100', 0, async function (done) {
initAudioPlayer();
expect(audioPlayer.src).assertEqual(undefined);
......@@ -649,12 +641,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200', 0, async function (done) {
initAudioPlayer();
audioPlayer.src = AUDIO_SOURCE;
audioPlayer.src = fdPath;
sleep(PLAY_TIME);
expect(audioPlayer.src).assertEqual(AUDIO_SOURCE);
expect(audioPlayer.src).assertEqual(fdPath);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
......
......@@ -14,15 +14,19 @@
*/
import media from '@ohos.multimedia.media'
import fileIO from '@ohos.fileio'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('PlayerLocalTestAudioFormat', function () {
const BASIC_PATH = 'file:///data/media/';
const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/';
const MAX_VOLUME = 1;
const PLAY_TIME = 3000;
const SEEK_TIME = 10000; // 10s
let isToSeek = false;
let isToDuration = false;
let fdPath;
let fdValue;
beforeAll(function() {
console.info('beforeAll case');
})
......@@ -37,7 +41,8 @@ describe('PlayerLocalTestAudioFormat', function () {
console.info('afterEach case');
})
afterAll(function() {
afterAll(async function() {
await fileIO.close(fdValue);
console.info('afterAll case');
})
......@@ -45,9 +50,23 @@ describe('PlayerLocalTestAudioFormat', function () {
for(let t = Date.now(); Date.now() - t <= time;);
}
function playSource(audioSource, done) {
async function getFd(pathName) {
fdPath = 'fd://';
await fileIO.open(pathName).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
}
async function playSource(audioSource, done) {
let audioPlayer = media.createAudioPlayer();
audioPlayer.src = audioSource;
await getFd(audioSource);
audioPlayer.src = fdPath;
audioPlayer.on('dataLoad', () => {
console.info('case set source success');
expect(audioPlayer.state).assertEqual('paused');
......@@ -131,7 +150,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0100', 0, async function (done) {
playSource(BASIC_PATH + '01.mp3', done);
})
......@@ -148,7 +166,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0200', 0, async function (done) {
playSource(BASIC_PATH + '02.mp3', done);
})
......@@ -165,7 +182,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0300', 0, async function (done) {
playSource(BASIC_PATH + '03.mp3', done);
})
......@@ -182,7 +198,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0400', 0, async function (done) {
playSource(BASIC_PATH + '04.mp3', done);
})
......@@ -199,7 +214,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0100', 0, async function (done) {
playSource(BASIC_PATH + '47.mp4', done);
})
......@@ -217,7 +231,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0300', 0, async function (done) {
playSource(BASIC_PATH + '49.mp4', done);
})
......@@ -234,7 +247,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0400', 0, async function (done) {
playSource(BASIC_PATH + '50.mp4', done);
})
......@@ -251,7 +263,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0500', 0, async function (done) {
playSource(BASIC_PATH + '51.mp4', done);
})
......@@ -268,7 +279,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0600', 0, async function (done) {
playSource(BASIC_PATH + '54.mp4', done);
})
......@@ -285,7 +295,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0700', 0, async function (done) {
playSource(BASIC_PATH + '64.mp4', done);
})
......@@ -302,7 +311,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0800', 0, async function (done) {
playSource(BASIC_PATH + '65.mp4', done);
})
......@@ -319,7 +327,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0900', 0, async function (done) {
playSource(BASIC_PATH + '66.mp4', done);
})
......@@ -336,7 +343,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1000', 0, async function (done) {
playSource(BASIC_PATH + '67.mp4', done);
})
......@@ -353,7 +359,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1100', 0, async function (done) {
playSource(BASIC_PATH + '92.mp4', done);
})
......@@ -370,7 +375,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1200', 0, async function (done) {
playSource(BASIC_PATH + '93.mp4', done);
})
......@@ -387,7 +391,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1300', 0, async function (done) {
playSource(BASIC_PATH + '94.mp4', done);
})
......@@ -404,7 +407,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1400', 0, async function (done) {
playSource(BASIC_PATH + '96.mp4', done);
})
......@@ -421,7 +423,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1500', 0, async function (done) {
playSource(BASIC_PATH + '97.mp4', done);
})
......@@ -438,7 +439,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1600', 0, async function (done) {
playSource(BASIC_PATH + '98.mp4', done);
})
......@@ -455,7 +455,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0100', 0, async function (done) {
playSource(BASIC_PATH + '55.m4a', done);
})
......@@ -473,7 +472,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0300', 0, async function (done) {
playSource(BASIC_PATH + '57.m4a', done);
})
......@@ -490,7 +488,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0400', 0, async function (done) {
playSource(BASIC_PATH + '58.m4a', done);
})
......@@ -507,7 +504,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0500', 0, async function (done) {
playSource(BASIC_PATH + '59.m4a', done);
})
......@@ -524,7 +520,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0700', 0, async function (done) {
playSource(BASIC_PATH + '62.m4a', done);
})
......
......@@ -10,36 +10,6 @@
{
"type": "ShellKit",
"run-command": [
"mkdir -p /data/accounts/account_0/appdata/recorder",
"touch /data/accounts/account_0/appdata/recorder/test1.m4a",
"touch /data/accounts/account_0/appdata/recorder/test2.m4a",
"touch /data/accounts/account_0/appdata/recorder/test3.m4a",
"touch /data/accounts/account_0/appdata/recorder/test4.m4a",
"touch /data/accounts/account_0/appdata/recorder/test5.mp4",
"touch /data/accounts/account_0/appdata/recorder/test6.mp4",
"touch /data/accounts/account_0/appdata/recorder/test7.m4a",
"touch /data/accounts/account_0/appdata/recorder/test8.m4a",
"touch /data/accounts/account_0/appdata/recorder/test9.mp4",
"touch /data/accounts/account_0/appdata/recorder/test10.mp4",
"touch /data/accounts/account_0/appdata/recorder/test11.m4a",
"touch /data/accounts/account_0/appdata/recorder/test12.m4a",
"touch /data/accounts/account_0/appdata/recorder/test13.m4a",
"touch /data/accounts/account_0/appdata/recorder/test14.mp4",
"touch /data/accounts/account_0/appdata/recorder/test15.m4a",
"touch /data/accounts/account_0/appdata/recorder/test16.m4a",
"touch /data/accounts/account_0/appdata/recorder/test17.m4a",
"touch /data/accounts/account_0/appdata/recorder/test18.m4a",
"touch /data/accounts/account_0/appdata/recorder/test19.m4a",
"touch /data/accounts/account_0/appdata/recorder/test20.m4a",
"touch /data/accounts/account_0/appdata/recorder/test21.m4a",
"touch /data/accounts/account_0/appdata/recorder/test22.m4a",
"touch /data/accounts/account_0/appdata/recorder/test23.m4a",
"touch /data/accounts/account_0/appdata/recorder/test24.m4a",
"touch /data/accounts/account_0/appdata/recorder/test25.mp4",
"touch /data/accounts/account_0/appdata/recorder/test26.mp4",
"touch /data/accounts/account_0/appdata/recorder/test27.mp4",
"touch /data/accounts/account_0/appdata/recorder/testAPI.m4a",
"chmod -R 777 /data/accounts/account_0/appdata/recorder/*",
"setenforce 0"
],
"teardown-command":[
......
......@@ -8,22 +8,21 @@
},
"kits": [
{
"type": "PushKit",
"pre-push": [
],
"push": [
"./resource/audio/H264_AAC.mp4 ->/data/media/"
]
"type": "PushKit",
"pre-push": [
],
"push": [
"./resource/audio/H264_AAC.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod -R 666 /data/media/*",
"setenforce 0"
],
"teardown-command":[
"setenforce 1"
]
"type": "ShellKit",
"run-command": [
"setenforce 0"
],
"teardown-command":[
"setenforce 1"
]
},
{
"test-file-name": [
......
......@@ -28,6 +28,6 @@ export default {
onReady() {
},
LoadXcomponent2() {
globalThis.value = this.$element('XcomponentId2').getComponentSurfaceId()
globalThis.value = this.$element('XcomponentId2').getXComponentSurfaceId()
},
}
\ No newline at end of file
......@@ -15,10 +15,11 @@
import media from '@ohos.multimedia.media'
import router from '@system.router'
import fileIO from '@ohos.fileio'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerAPICallbackTest', function () {
const AUDIO_SOURCE = 'file://data/media/H264_AAC.mp4';
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4';
const PLAY_TIME = 1000;
const SEEK_TIME = 5000;
const SEEK_CLOSEST = 3;
......@@ -42,7 +43,11 @@ describe('VideoPlayerAPICallbackTest', function () {
const END_EVENT = 'end';
const VOLUME_VALUE = 1;
const SPEED_VALUE = 1;
const NEXT_FRAME_TIME = 8333;
const PREV_FRAME_TIME = 4166;
let surfaceID = '';
let fdPath;
let fdValue;
let events = require('events');
let eventEmitter = new events.EventEmitter();
......@@ -60,10 +65,24 @@ describe('VideoPlayerAPICallbackTest', function () {
console.info('afterEach case');
})
afterAll(function() {
afterAll(async function() {
await fileIO.close(fdValue);
console.info('afterAll case');
})
async function getFd() {
fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
}
async function toNewPage() {
let path = 'pages/surfaceTest/surfaceTest';
let options = {
......@@ -124,7 +143,7 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(SETSURFACE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.url = AUDIO_SOURCE;
videoPlayer.url = fdPath;
videoPlayer.setDisplaySurface(surfaceID, (err) => {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('idle');
......@@ -141,7 +160,7 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(PREPARE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.url = AUDIO_SOURCE;
videoPlayer.url = fdPath;
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('prepared');
......@@ -273,13 +292,38 @@ describe('VideoPlayerAPICallbackTest', function () {
});
});
function checkSeekTime(seekMode, seekTime, seekDoneTime) {
switch (seekMode) {
case media.SeekMode.SEEK_NEXT_SYNC:
if (seekTime == 0) {
expect(seekDoneTime).assertEqual(0);
} else if (seekTime == DURATION_TIME) {
expect(seekDoneTime).assertEqual(DURATION_TIME);
} else {
expect(seekDoneTime).assertEqual(NEXT_FRAME_TIME);
}
break;
case media.SeekMode.SEEK_PREV_SYNC:
if (seekTime == 0) {
expect(seekDoneTime).assertEqual(0);
} else if (seekTime == DURATION_TIME) {
expect(seekDoneTime).assertEqual(PREV_FRAME_TIME);
} else {
expect(seekDoneTime).assertEqual(PREV_FRAME_TIME);
}
break;
default:
break;
}
}
eventEmitter.on(SEEK_MODE_EVENT, (videoPlayer, steps, done) => {
let seekTime = steps[1];
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, SEEK_CLOSEST, (err, seekDoneTime) => {
videoPlayer.seek(seekTime, media.SeekMode.SEEK_NEXT_SYNC, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
expect(seekDoneTime).assertEqual(SEEK_TIME);
checkSeekTime(media.SeekMode.SEEK_NEXT_SYNC, seekTime, seekDoneTime);
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
......@@ -314,6 +358,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
videoPlayer.setSpeed(speedValue, (err, speedMode) => {
if (typeof (err) == 'undefined') {
expect(speedValue).assertEqual(speedMode);
console.info('case setSpeed success and speedMode is '+ speedMode);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
......@@ -334,6 +379,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0100', 0, async function (done) {
await getFd();
setTimeout(function() {
surfaceID = globalThis.value;
console.info('case new surfaceID is ' + surfaceID);
......
......@@ -15,13 +15,13 @@
import media from '@ohos.multimedia.media'
import router from '@system.router'
import fileIO from '@ohos.fileio'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerFuncCallbackTest', function () {
const AUDIO_SOURCE = 'file://data/media/H264_AAC.mp4';
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4';
const PLAY_TIME = 3000;
const SEEK_TIME = 5000;
const SEEK_CLOSEST = 3;
const WIDTH_VALUE = 720;
const HEIGHT_VALUE = 480;
const DURATION_TIME = 10034;
......@@ -42,7 +42,11 @@ describe('VideoPlayerFuncCallbackTest', function () {
const VOLUME_VALUE = 1;
const SPEED_VALUE = 1;
const DELTA_TIME = 1000;
const NEXT_FRAME_TIME = 8333;
const PREV_FRAME_TIME = 4166;
let surfaceID = '';
let fdPath;
let fdValue;
let events = require('events');
let eventEmitter = new events.EventEmitter();
......@@ -60,7 +64,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('afterEach case');
})
afterAll(function() {
afterAll(async function() {
await fileIO.close(fdValue);
console.info('afterAll case');
})
......@@ -80,6 +85,19 @@ describe('VideoPlayerFuncCallbackTest', function () {
}
}
async function getFd() {
fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
}
function printfError(error, done) {
expect().assertFail();
console.info(`case error called,errMessage is ${error.message}`);
......@@ -148,7 +166,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(SETSURFACE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.url = AUDIO_SOURCE;
videoPlayer.url = fdPath;
videoPlayer.setDisplaySurface(surfaceID, (err) => {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('idle');
......@@ -162,7 +180,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(PREPARE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.url = AUDIO_SOURCE;
videoPlayer.url = fdPath;
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('prepared');
......@@ -193,11 +211,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(PLAY_EVENT, (videoPlayer, steps, done) => {
steps.shift();
let startTime = videoPlayer.currentTime;
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
sleep(PLAY_TIME);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
......@@ -256,12 +277,41 @@ describe('VideoPlayerFuncCallbackTest', function () {
});
});
function checkSeekTime(seekMode, seekTime, seekDoneTime) {
switch (seekMode) {
case media.SeekMode.SEEK_NEXT_SYNC:
if (seekTime == 0) {
expect(seekDoneTime).assertEqual(0);
} else if (seekTime == DURATION_TIME) {
expect(seekDoneTime).assertEqual(DURATION_TIME);
} else {
expect(seekDoneTime).assertEqual(NEXT_FRAME_TIME);
}
break;
case media.SeekMode.SEEK_PREV_SYNC:
if (seekTime == 0) {
expect(seekDoneTime).assertEqual(0);
} else if (seekTime == DURATION_TIME) {
expect(seekDoneTime).assertEqual(NEXT_FRAME_TIME);
} else {
expect(seekDoneTime).assertEqual(PREV_FRAME_TIME);
}
break;
default:
break;
}
}
eventEmitter.on(SEEK_EVENT, (videoPlayer, steps, done) => {
let seekTime = steps[1];
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
if (seekTime > DURATION_TIME) {
seekTime = DURATION_TIME;
}
checkSeekTime(media.SeekMode.SEEK_PREV_SYNC, seekTime, seekDoneTime);
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else {
......@@ -272,15 +322,16 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(SEEK_MODE_EVENT, (videoPlayer, steps, done) => {
let seekTime = steps[1];
let seekMode = steps[2];
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, SEEK_CLOSEST, (err, seekDoneTime) => {
steps.shift();
videoPlayer.seek(seekTime, seekMode, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
if (seekTime > DURATION_TIME) {
seekTime = DURATION_TIME;
}
expect(seekDoneTime).assertEqual(seekTime);
expect(videoPlayer.currentTime + DELTA_TIME).assertClose(seekDoneTime + DELTA_TIME, DELTA_TIME);
checkSeekTime(seekMode, seekTime, seekDoneTime);
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else {
......@@ -303,13 +354,42 @@ describe('VideoPlayerFuncCallbackTest', function () {
});
});
function checkSpeedTime(videoPlayer, speedValue, startTime) {
let endTime = videoPlayer.currentTime;
if (videoPlayer.state == 'playing') {
switch (speedValue) {
case media.PlaybackSpeed.SPEED_FORWARD_0_75_X:
expect(endTime - startTime).assertClose(0.75 * 1000, DELTA_TIME);
break;
case media.PlaybackSpeed.SPEED_FORWARD_1_00_X:
expect(endTime - startTime).assertClose(1000, DELTA_TIME);
break;
case media.PlaybackSpeed.SPEED_FORWARD_1_25_X:
expect(endTime - startTime).assertClose(1.25 * 1000, DELTA_TIME);
break;
case media.PlaybackSpeed.SPEED_FORWARD_1_75_X:
expect(endTime - startTime).assertClose(1.75 * 1000, DELTA_TIME);
break;
case media.PlaybackSpeed.SPEED_FORWARD_2_00_X:
expect(endTime - startTime).assertClose(2 * 1000, DELTA_TIME);
break;
}
} else {
console.info('case speed not in play');
}
}
eventEmitter.on(SETSPEED_EVENT, (videoPlayer, steps, done) => {
let speedValue = steps[1];
steps.shift();
steps.shift();
let startTime = videoPlayer.currentTime;
videoPlayer.setSpeed(speedValue, (err, speedMode) => {
if (typeof (err) == 'undefined') {
sleep(1000);
expect(speedValue).assertEqual(speedMode);
console.info('case setSpeed success and speedMode is '+ speedMode);
checkSpeedTime(videoPlayer, speedValue, startTime);
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
......@@ -326,6 +406,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0100', 0, async function (done) {
await getFd();
setTimeout(function() {
surfaceID = globalThis.value;
console.info('case new surfaceID is ' + surfaceID);
......@@ -433,7 +514,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0700
* @tc.name : 007.seek CLOSEST(callback)
* @tc.name : 007.seek mode(callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
......@@ -445,7 +526,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case new surfaceID is ' + surfaceID);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SEEK_MODE_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
SEEK_MODE_EVENT, SEEK_TIME, media.SeekMode.SEEK_NEXT_SYNC,
SEEK_MODE_EVENT, SEEK_TIME, media.SeekMode.SEEK_PREV_SYNC,RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
}, 1000);
})
......@@ -578,7 +660,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case new surfaceID is ' + surfaceID);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
PAUSE_EVENT, SEEK_MODE_EVENT, SEEK_TIME, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
PAUSE_EVENT, SEEK_MODE_EVENT, SEEK_TIME, media.SeekMode.SEEK_NEXT_SYNC,
SEEK_MODE_EVENT, SEEK_TIME, media.SeekMode.SEEK_PREV_SYNC, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
}, 1000);
})
......@@ -693,7 +776,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case new surfaceID is ' + surfaceID);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SEEK_MODE_EVENT, 0, PAUSE_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
SEEK_MODE_EVENT, 0, media.SeekMode.SEEK_NEXT_SYNC,
SEEK_MODE_EVENT, 0, media.SeekMode.SEEK_PREV_SYNC, PAUSE_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
}, 1000);
})
......@@ -731,7 +815,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case new surfaceID is ' + surfaceID);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SEEK_MODE_EVENT, DURATION_TIME, RELEASE_EVENT, END_EVENT);
SEEK_MODE_EVENT, DURATION_TIME, media.SeekMode.SEEK_NEXT_SYNC,
SEEK_MODE_EVENT, DURATION_TIME, media.SeekMode.SEEK_PREV_SYNC, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
}, 1000);
})
......@@ -769,7 +854,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case new surfaceID is ' + surfaceID);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SEEK_MODE_EVENT, DURATION_TIME + 1, RELEASE_EVENT, END_EVENT);
SEEK_MODE_EVENT, DURATION_TIME + 1, media.SeekMode.SEEK_NEXT_SYNC,
SEEK_MODE_EVENT, DURATION_TIME + 1, media.SeekMode.SEEK_PREV_SYNC, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
}, 1000);
})
......@@ -808,8 +894,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case new surfaceID is ' + surfaceID);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SETSPEED_EVENT, 0, SETSPEED_EVENT, 1, SETSPEED_EVENT, 2,
SETSPEED_EVENT, 3, SETSPEED_EVENT, 4, RELEASE_EVENT, END_EVENT);
SETSPEED_EVENT, media.PlaybackSpeed.SPEED_FORWARD_0_75_X, SETSPEED_EVENT,
media.PlaybackSpeed.SPEED_FORWARD_1_00_X, SETSPEED_EVENT, media.PlaybackSpeed.SPEED_FORWARD_1_25_X,
SETSPEED_EVENT, media.PlaybackSpeed.SPEED_FORWARD_1_75_X,
SETSPEED_EVENT, media.PlaybackSpeed.SPEED_FORWARD_2_00_X, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
}, 1000);
})
......
......@@ -10,56 +10,6 @@
{
"type": "ShellKit",
"run-command": [
"touch /data/media/01.mp4",
"touch /data/media/02.mp4",
"touch /data/media/03.mp4",
"touch /data/media/04.mp4",
"touch /data/media/05.mp4",
"touch /data/media/06.mp4",
"touch /data/media/07.mp4",
"touch /data/media/08.mp4",
"touch /data/media/09.mp4",
"touch /data/media/10.mp4",
"touch /data/media/11.mp4",
"touch /data/media/12.mp4",
"touch /data/media/13.mp4",
"touch /data/media/14.mp4",
"touch /data/media/15.mp4",
"touch /data/media/16.mp4",
"touch /data/media/17.mp4",
"touch /data/media/18.mp4",
"touch /data/media/19.mp4",
"touch /data/media/20.mp4",
"touch /data/media/21.mp4",
"touch /data/media/22.mp4",
"touch /data/media/23.mp4",
"touch /data/media/24.mp4",
"touch /data/media/25.mp4",
"touch /data/media/26.mp4",
"touch /data/media/27.mp4",
"touch /data/media/28.mp4",
"touch /data/media/29.mp4",
"touch /data/media/30.mp4",
"touch /data/media/31.mp4",
"touch /data/media/32.mp4",
"touch /data/media/33.mp4",
"touch /data/media/34.mp4",
"touch /data/media/35.mp4",
"touch /data/media/36.mp4",
"touch /data/media/37.mp4",
"touch /data/media/38.mp4",
"touch /data/media/39.mp4",
"touch /data/media/40.mp4",
"touch /data/media/41.mp4",
"touch /data/media/42.mp4",
"touch /data/media/43.mp4",
"touch /data/media/44.mp4",
"touch /data/media/45.mp4",
"touch /data/media/46.mp4",
"touch /data/media/47.mp4",
"touch /data/media/48.mp4",
"touch /data/media/API.mp4",
"chmod -R 777 /data/media",
"setenforce 0"
],
"teardown-command":[
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./VideoRecorderFuncCallbackTest.test.js')
require('./VideoRecorderFuncPromiseTest.test.js')
require('./VideoRecorderAPICallbackTest.test.js')
require('./VideoRecorderFuncCallbackTest.test.js')
require('./VideoRecorderEnumTest.test.js')
......@@ -98,6 +98,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
})
beforeEach(function () {
sleep(5000);
console.info('beforeEach case');
})
......@@ -735,7 +736,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1900', 0, async function (done) {
await getFd('37.mp4');
onlyVideoConfig.url = fdPath;
videoConfig.url = fdPath;
videoConfig.orientationHint = 90;
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT,
......
......@@ -80,6 +80,7 @@ describe('VideoRecorderFuncPromiseTest', function () {
})
beforeEach(function () {
sleep(5000);
console.info('beforeEach case');
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册