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

!3056 公共函数提取

Merge pull request !3056 from NOBUGGERS/r00514670_0425
......@@ -16,11 +16,13 @@
import resourceManager from '@ohos.resourceManager';
import {expect} from 'deccjsunit/index'
// File operation
export async function getFileDescriptor(fileName) {
let fileDescriptor = undefined;
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.getRawFileDescriptor(fileName).then(value => {
fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length};
console.log('case getRawFileDescriptor success fileName: ' + fileName);
}).catch(error => {
console.log('case getRawFileDescriptor err: ' + error);
});
......@@ -30,8 +32,8 @@ export async function getFileDescriptor(fileName) {
export async function closeFileDescriptor(fileName) {
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.closeRawFileDescriptor(fileName).then(value => {
console.log('case closeRawFileDescriptor ' + value);
await mgr.closeRawFileDescriptor(fileName).then(()=> {
console.log('case closeRawFileDescriptor ' + fileName);
}).catch(error => {
console.log('case closeRawFileDescriptor err: ' + error);
});
......@@ -44,4 +46,42 @@ export function isFileOpen(fileDescriptor, done) {
console.info('case error fileDescriptor undefined, open file fail');
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
......@@ -14,7 +14,7 @@
*/
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'
describe('PlayerLocalTestAudioAPI', function () {
......@@ -49,14 +49,14 @@ describe('PlayerLocalTestAudioAPI', function () {
beforeEach(async function() {
isTimeOut = false;
await getFileDescriptor(AUDIO_SOURCE).then((res) => {
await mediaTestBase.getFileDescriptor(AUDIO_SOURCE).then((res) => {
fileDescriptor = res;
});
console.info('beforeEach case');
})
afterEach(async function() {
await closeFileDescriptor(AUDIO_SOURCE);
await mediaTestBase.closeFileDescriptor(AUDIO_SOURCE);
console.info('afterEach case');
})
......@@ -64,10 +64,6 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info('afterAll case');
})
function sleep(time) {
for(let t = Date.now();Date.now() - t <= time;);
}
function initAudioPlayer() {
if (typeof (audioPlayer) != 'undefined') {
audioPlayer.release();
......@@ -147,7 +143,7 @@ describe('PlayerLocalTestAudioAPI', function () {
audioPlayer.on('play', () => {
mySteps.shift();
console.info(`case play called`);
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
console.info(`case play currentTime is ${audioPlayer.currentTime}`);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
if (mySteps[0] == FINISH_STATE) {
......@@ -199,7 +195,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info(`case loop is ${audioPlayer.loop}`);
if ((audioPlayer.loop == true) && (seekDoneTime == DURATION_TIME)) {
console.info('case loop is true');
sleep(PLAY_STATE);
mediaTestBase.msleep(PLAY_STATE);
}
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps,done);
......@@ -210,7 +206,7 @@ describe('PlayerLocalTestAudioAPI', function () {
mySteps.shift();
mySteps.shift();
if (audioPlayer.state == 'playing') {
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
}
nextStep(mySteps,done);
});
......@@ -252,7 +248,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor.fd = -1;
let mySteps = new Array(ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -269,7 +265,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor.offset = 1;
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -286,7 +282,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SRC_API_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor.length = -1;
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -303,7 +299,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -319,7 +315,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
console.info(`case update`);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -336,7 +332,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -352,7 +348,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -368,7 +364,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -384,7 +380,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -400,7 +396,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -416,7 +412,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -432,7 +428,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -448,7 +444,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -464,7 +460,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -480,7 +476,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -496,7 +492,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -512,7 +508,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -528,7 +524,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -544,7 +540,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -560,7 +556,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -576,7 +572,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -592,7 +588,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -608,7 +604,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -624,7 +620,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -640,7 +636,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -656,7 +652,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -672,7 +668,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -688,7 +684,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -704,7 +700,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
initAudioPlayer();
expect(audioPlayer.src).assertEqual(undefined);
expect(audioPlayer.duration).assertEqual(undefined);
......@@ -723,10 +719,10 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
initAudioPlayer();
audioPlayer.src = fdHead + fileDescriptor.fd;
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(audioPlayer.src).assertEqual(fdHead + fileDescriptor.fd);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
......
......@@ -14,7 +14,7 @@
*/
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'
describe('PlayerLocalTestAudioFUNC', function () {
......@@ -46,7 +46,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
let fileDescriptor = undefined;
beforeAll(async function() {
await getFileDescriptor(AUDIO_SOURCE).then((res) => {
await mediaTestBase.getFileDescriptor(AUDIO_SOURCE).then((res) => {
fileDescriptor = res;
});
console.info('beforeAll case');
......@@ -62,14 +62,10 @@ describe('PlayerLocalTestAudioFUNC', function () {
})
afterAll(async function() {
await closeFileDescriptor(AUDIO_SOURCE);
await mediaTestBase.closeFileDescriptor(AUDIO_SOURCE);
console.info('afterAll case');
})
function sleep(time) {
for(let t = Date.now(); Date.now() - t <= time;);
}
function initAudioPlayer() {
if (typeof (audioPlayer) != 'undefined') {
audioPlayer.release();
......@@ -131,7 +127,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
audioPlayer.loop = mySteps[SECOND_INDEX];
mySteps.shift();
mySteps.shift();
nextStep(mySteps,done);
nextStep(mySteps, done);
break;
default:
break;
......@@ -150,12 +146,12 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('play', () => {
mySteps.shift();
console.info(`case play called`);
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
console.info(`case play currentTime is ${audioPlayer.currentTime}`);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
if (mySteps[0] == FINISH_STATE) {
......@@ -163,7 +159,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
return;
}
expect(audioPlayer.state).assertEqual('playing');
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('pause', () => {
mySteps.shift();
......@@ -171,13 +167,13 @@ describe('PlayerLocalTestAudioFUNC', function () {
console.info(`case pause currentTime is ${audioPlayer.currentTime}`);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('reset', () => {
mySteps.shift();
console.info(`case reset called`);
expect(audioPlayer.state).assertEqual('idle');
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('stop', () => {
if (mySteps[0] == RESET_STATE) {
......@@ -189,7 +185,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('stopped');
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == 'undefined') {
......@@ -207,10 +203,10 @@ describe('PlayerLocalTestAudioFUNC', function () {
console.info(`case loop is ${audioPlayer.loop}`);
if ((audioPlayer.loop == true) && (seekDoneTime == DURATION_TIME)) {
console.info('case loop is true');
sleep(PLAY_STATE);
mediaTestBase.msleep(PLAY_STATE);
}
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps,done);
nextStep(mySteps, done);
}
});
audioPlayer.on('volumeChange', () => {
......@@ -218,16 +214,16 @@ describe('PlayerLocalTestAudioFUNC', function () {
mySteps.shift();
mySteps.shift();
if (audioPlayer.state == 'playing') {
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
}
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('finish', () => {
mySteps.shift();
expect(audioPlayer.state).assertEqual('stopped');
expect(audioPlayer.currentTime).assertClose(audioPlayer.duration, DELTA_TIME);
console.info(`case finish called`);
nextStep(mySteps,done);
nextStep(mySteps, done);
});
audioPlayer.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
......@@ -241,7 +237,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
mySteps.shift();
mySteps.shift();
}
nextStep(mySteps,done);
nextStep(mySteps, done);
});
}
......@@ -254,7 +250,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -270,7 +266,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -286,7 +282,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -302,7 +298,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -318,7 +314,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, PAUSE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -334,7 +330,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0700', 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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -350,7 +346,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -366,7 +362,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RESET_STATE, SRC_STATE, PLAY_STATE,
PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -383,7 +379,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, RESET_STATE, SRC_STATE, PLAY_STATE,
PAUSE_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -400,7 +396,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RESET_STATE,
SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -417,7 +413,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -433,7 +429,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, PAUSE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -449,7 +445,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME,
PLAY_STATE, FINISH_STATE, END_STATE);
initAudioPlayer();
......@@ -466,7 +462,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, SEEK_STATE, 0, PAUSE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -482,7 +478,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -498,7 +494,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, STOP_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -514,7 +510,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, 0, ERROR_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -530,7 +526,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, 0, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -546,7 +542,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME / RAND_NUM,
STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -563,7 +559,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -579,7 +575,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, SEEK_STATE, 0, STOP_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -595,7 +591,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, 0, ERROR_STATE,
RESET_STATE, SRC_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -612,7 +608,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -628,7 +624,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, SEEK_TIME, ERROR_STATE,
PAUSE_STATE, ERROR_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -645,7 +641,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, SEEK_TIME, ERROR_STATE,
RESET_STATE, SRC_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -662,7 +658,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME, FINISH_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -678,7 +674,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_2900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME + DELTA_TIME,
FINISH_STATE, END_STATE);
initAudioPlayer();
......@@ -695,7 +691,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME / RAND_NUM, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -711,7 +707,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, 0, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -727,7 +723,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME, PLAY_STATE,
FINISH_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -744,7 +740,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME + DELTA_TIME, PLAY_STATE,
FINISH_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -761,7 +757,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME + DELTA_TIME,
FINISH_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -778,7 +774,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let playCount = 0;
let seekCount = 0;
let isTimeDone = false;
......@@ -794,7 +790,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
console.info(`case play currentTime is ${testAudioPlayer.currentTime}`);
expect(testAudioPlayer.duration).assertEqual(DURATION_TIME);
expect(testAudioPlayer.state).assertEqual('playing');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
if (playCount > 0) {
return;
}
......@@ -839,7 +835,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_3700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, 0,
VOLUME_STATE, MAX_VOLUME, RESET_STATE, END_STATE);
......@@ -857,7 +853,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
console.info(`case update`);
let mySteps = new Array(SRC_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -874,7 +870,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -890,7 +886,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -906,7 +902,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -922,7 +918,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, PAUSE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -938,7 +934,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0700', 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);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -954,7 +950,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -970,7 +966,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RESET_STATE, SRC_STATE, PLAY_STATE,
PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -987,7 +983,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_05_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, RESET_STATE, SRC_STATE, PLAY_STATE,
PAUSE_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......
......@@ -14,7 +14,7 @@
*/
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'
describe('PlayerLocalTestAudioFormat', function () {
......@@ -41,21 +41,17 @@ describe('PlayerLocalTestAudioFormat', function () {
})
afterAll(async function() {
await closeFileDescriptor(audioSource);
await mediaTestBase.closeFileDescriptor(audioSource);
console.info('afterAll case');
})
function sleep(time) {
for(let t = Date.now(); Date.now() - t <= time;);
}
async function playSource(audioFile, done) {
let audioPlayer = media.createAudioPlayer();
audioSource = audioFile;
await getFileDescriptor(audioSource).then((res) => {
await mediaTestBase.getFileDescriptor(audioSource).then((res) => {
fileDescriptor = res;
});
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
audioPlayer.src = 'fd://' + fileDescriptor.fd;
audioPlayer.on('dataLoad', () => {
console.info('case set source success');
......@@ -66,7 +62,7 @@ describe('PlayerLocalTestAudioFormat', function () {
audioPlayer.on('play', () => {
console.info('case start to play');
expect(audioPlayer.state).assertEqual('playing');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
if (!isToSeek) {
audioPlayer.pause();
} else {
......@@ -102,7 +98,7 @@ describe('PlayerLocalTestAudioFormat', function () {
if (!isToDuration) {
expect(SEEK_TIME).assertEqual(seekDoneTime);
isToDuration = true;
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
audioPlayer.seek(audioPlayer.duration);
} else {
expect(audioPlayer.duration).assertEqual(seekDoneTime);
......
......@@ -15,7 +15,7 @@
import media from '@ohos.multimedia.media'
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'
describe('VideoPlayerAPICallbackTest', function () {
......@@ -59,12 +59,13 @@ describe('VideoPlayerAPICallbackTest', function () {
})
beforeEach(async function() {
await getFileDescriptor(VIDEO_SOURCE).then((res) => {
await mediaTestBase.getFileDescriptor(VIDEO_SOURCE).then((res) => {
fileDescriptor = res;
});
await toNewPage(page);
page = (page + 1) % 2;
await msleep(1000).then(() => {}, failureCallback).catch(catchCallback);
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
surfaceID = globalThis.value;
console.info('case new surfaceID is ' + surfaceID);
console.info('beforeEach case');
......@@ -72,7 +73,7 @@ describe('VideoPlayerAPICallbackTest', function () {
afterEach(async function() {
await clearRouter();
await closeFileDescriptor(VIDEO_SOURCE);
await mediaTestBase.closeFileDescriptor(VIDEO_SOURCE);
console.info('afterEach case');
})
......@@ -80,40 +81,6 @@ describe('VideoPlayerAPICallbackTest', function () {
console.info('afterAll case');
})
function msleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
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 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) {
if (steps[0] == END_EVENT) {
console.info('case success!!');
......@@ -159,7 +126,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -184,7 +151,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
})
});
......@@ -204,7 +171,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -214,14 +181,14 @@ describe('VideoPlayerAPICallbackTest', function () {
videoPlayer.getTrackDescription((err, arrlist) => {
if (typeof (err) == 'undefined') {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
mediaTestBase.printDescription(arrlist[i]);
}
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -232,13 +199,13 @@ describe('VideoPlayerAPICallbackTest', function () {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -254,7 +221,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -270,7 +237,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -286,7 +253,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -301,7 +268,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -318,7 +285,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -361,7 +328,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -378,7 +345,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -396,7 +363,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -410,7 +377,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor.fd = -1;
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSRC_EVENT, SETSURFACE_EVENT, ERROR_EVENT,
......@@ -427,7 +394,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it(' SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor.offset = -1;
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSRC_EVENT, SETSURFACE_EVENT,
......@@ -444,7 +411,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it(' SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor.length = -1;
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSRC_EVENT, SETSURFACE_EVENT,
......@@ -461,7 +428,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it(' SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor = undefined;
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSRC_EVENT, SETSURFACE_EVENT, ERROR_EVENT,
......@@ -478,7 +445,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -494,7 +461,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -510,7 +477,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
PAUSE_EVENT, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -526,7 +493,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
STOP_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -542,7 +509,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
RESET_EVENT, SETURL_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -558,7 +525,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SEEK_EVENT, SEEK_TIME, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -574,7 +541,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SEEK_MODE_EVENT, SEEK_TIME, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -590,7 +557,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SETVOLUME_EVENT, VOLUME_VALUE, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -606,7 +573,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PLAY_EVENT,
SETSPEED_EVENT, SPEED_VALUE, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -622,7 +589,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -638,7 +605,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, GETDESCRIPTION,
PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -654,7 +621,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_1200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, PREPARE_EVENT, PREPARE_EVENT,
PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -670,7 +637,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, PLAY_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -685,7 +652,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -701,7 +668,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -717,7 +684,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, PLAY_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -733,7 +700,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, PLAY_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -749,7 +716,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -765,7 +732,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_MODE_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -781,7 +748,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -797,7 +764,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -813,7 +780,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PLAY_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -829,7 +796,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, GETDESCRIPTION, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -845,7 +812,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_1200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PLAY_EVENT, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -861,7 +828,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -876,7 +843,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -892,7 +859,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -908,7 +875,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -924,7 +891,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -940,7 +907,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -956,7 +923,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_MODE_EVENT, SEEK_TIME, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -972,7 +939,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -988,7 +955,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1004,7 +971,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1020,7 +987,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, GETDESCRIPTION, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1036,7 +1003,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_1200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, PAUSE_EVENT, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1052,7 +1019,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -1067,7 +1034,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1083,7 +1050,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1099,7 +1066,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1115,7 +1082,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1131,7 +1098,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1147,7 +1114,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_MODE_EVENT, SEEK_TIME, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1163,7 +1130,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1179,7 +1146,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1195,7 +1162,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1211,7 +1178,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, GETDESCRIPTION, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1227,7 +1194,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_1200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, STOP_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1243,7 +1210,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -1258,7 +1225,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1274,7 +1241,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1290,7 +1257,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1306,7 +1273,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1322,7 +1289,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1338,7 +1305,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_MODE_EVENT, SEEK_TIME, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1354,7 +1321,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1370,7 +1337,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1386,7 +1353,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1402,7 +1369,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, GETDESCRIPTION, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1418,7 +1385,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_1200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, RESET_EVENT, RESET_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1434,7 +1401,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -1449,7 +1416,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1465,7 +1432,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1481,7 +1448,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1497,7 +1464,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1513,7 +1480,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -1529,7 +1496,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_MODE_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -1545,7 +1512,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1561,7 +1528,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1577,7 +1544,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -1592,7 +1559,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, GETDESCRIPTION, RELEASE_EVENT, END_EVENT);
......@@ -1608,7 +1575,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_1200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1624,7 +1591,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SEEK_EVENT, SEEK_TIME, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -1639,7 +1606,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, SEEK_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -1655,7 +1622,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -1671,7 +1638,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, SEEK_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -1687,7 +1654,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, SEEK_EVENT, SEEK_TIME, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1703,7 +1670,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, SEEK_EVENT, SEEK_TIME, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1719,7 +1686,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, SEEK_EVENT,
......@@ -1736,7 +1703,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE,
......@@ -1753,7 +1720,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
SEEK_EVENT, SEEK_TIME, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1769,7 +1736,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, GETDESCRIPTION, SEEK_EVENT, SEEK_TIME, RELEASE_EVENT, END_EVENT);
......@@ -1785,7 +1752,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, SEEK_EVENT, SEEK_TIME,
......@@ -1802,7 +1769,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, -1, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -1818,7 +1785,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, DURATION_TIME + 1000, RELEASE_EVENT, END_EVENT);
......@@ -1834,7 +1801,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -1849,7 +1816,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1865,7 +1832,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1881,7 +1848,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1897,7 +1864,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1913,7 +1880,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1929,7 +1896,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME, SETVOLUME_EVENT,
......@@ -1946,7 +1913,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, SETVOLUME_EVENT,
......@@ -1963,7 +1930,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
SETVOLUME_EVENT, VOLUME_VALUE, END_EVENT);
......@@ -1979,7 +1946,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, GETDESCRIPTION, SETVOLUME_EVENT, VOLUME_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -1995,7 +1962,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, SETVOLUME_EVENT, VOLUME_VALUE,
......@@ -2012,7 +1979,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_1300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, -1, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -2028,7 +1995,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_1400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, 2, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -2044,7 +2011,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETSPEED_EVENT, SPEED_VALUE,ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoPlayer, mySteps, done);
......@@ -2059,7 +2026,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0200', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, SETSPEED_EVENT, SPEED_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -2075,7 +2042,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -2091,7 +2058,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, PAUSE_EVENT, SETSPEED_EVENT, SPEED_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -2107,7 +2074,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0500', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, STOP_EVENT, SETSPEED_EVENT, SPEED_VALUE,
......@@ -2124,7 +2091,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0600', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, RESET_EVENT, SETSPEED_EVENT, SPEED_VALUE,
......@@ -2141,7 +2108,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0700', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SEEK_EVENT, SEEK_TIME,
......@@ -2158,7 +2125,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0800', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETVOLUME_EVENT, VOLUME_VALUE, SETSPEED_EVENT,
......@@ -2175,7 +2142,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0900', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
SETSPEED_EVENT, SPEED_VALUE, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -2191,7 +2158,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_1000', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, GETDESCRIPTION, SETSPEED_EVENT, SPEED_VALUE, RELEASE_EVENT, END_EVENT);
......@@ -2207,7 +2174,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_1100', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, SPEED_VALUE, SETSPEED_EVENT, SPEED_VALUE,
......@@ -2224,7 +2191,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_1300', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, -1, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -2240,7 +2207,7 @@ describe('VideoPlayerAPICallbackTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_1400', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETURL_EVENT, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, 5, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......
......@@ -15,7 +15,7 @@
import media from '@ohos.multimedia.media'
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'
describe('VideoPlayerFuncCallbackTest', function () {
......@@ -58,7 +58,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
beforeAll(async function() {
console.info('beforeAll case');
await getFileDescriptor(VIDEO_SOURCE).then((res) => {
await mediaTestBase.getFileDescriptor(VIDEO_SOURCE).then((res) => {
fileDescriptor = res;
});
})
......@@ -66,7 +66,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
beforeEach(async function() {
await toNewPage(page);
page = (page + 1) % 2;
await msleep(1000).then(() => {}, failureCallback).catch(catchCallback);
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
surfaceID = globalThis.value;
console.info('case new surfaceID is ' + surfaceID);
console.info('beforeEach case');
......@@ -78,44 +79,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
})
afterAll(async function() {
await closeFileDescriptor(VIDEO_SOURCE);
await mediaTestBase.closeFileDescriptor(VIDEO_SOURCE);
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) {
if (steps[0] == END_EVENT) {
console.info('case success!!');
......@@ -164,7 +131,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -192,7 +159,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(WAIT_EVENT, (videoPlayer, steps, done) => {
steps.shift();
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
toNextStep(videoPlayer, steps, done);
});
......@@ -207,7 +174,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
})
});
......@@ -226,7 +193,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -245,7 +212,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -255,14 +222,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
videoPlayer.getTrackDescription((err, arrlist) => {
if (typeof (err) == 'undefined') {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
mediaTestBase.printDescription(arrlist[i]);
}
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -274,7 +241,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
if (typeof (err) == 'undefined') {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
toNextStep(videoPlayer, steps, done);
......@@ -282,7 +249,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -298,7 +265,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -314,7 +281,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -330,7 +297,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -345,7 +312,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -391,7 +358,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -414,7 +381,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -431,7 +398,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -468,7 +435,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
let startTime = videoPlayer.currentTime;
videoPlayer.setSpeed(speedValue, (err, speedMode) => {
if (typeof (err) == 'undefined') {
sleep(1000);
mediaTestBase.msleep(1000);
expect(speedValue).assertEqual(speedMode);
console.info('case setSpeed success and speedMode is '+ speedMode);
checkSpeedTime(videoPlayer, speedValue, startTime);
......@@ -477,7 +444,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -491,7 +458,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SETSOURCE', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let fdPath = '';
let mySteps = new Array(CREATE_EVENT, SETSOURCE_EVENT, fdPath, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......@@ -507,7 +474,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETVOLUME', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
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,
......@@ -524,7 +491,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETSPEED', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSOURCE_EVENT, fileDescriptor, SETSURFACE_EVENT,
PREPARE_EVENT, PLAY_EVENT, SETSPEED_EVENT, media.PlaybackSpeed.SPEED_FORWARD_0_75_X,
......@@ -544,7 +511,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
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,
......@@ -561,7 +528,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_CALLBACK', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let frameCount = -1;
let completedCount = 0;
......@@ -576,7 +543,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case createVideoPlayer success!!');
eventEmitter.emit('test_callback');
}else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -593,7 +560,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case release success!!');
done();
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -623,7 +590,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case setDisplaySurface success!!');
eventEmitter.emit('test_prepare');
}else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
})
});
......@@ -638,7 +605,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console.info('case prepare success!!');
eventEmitter.emit('test_play');
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -649,7 +616,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
} else {
printfError(err, done);
mediaTestBase.printError(err, done);
}
});
});
......@@ -665,7 +632,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSOURCE_EVENT, fileDescriptor, SETSURFACE_EVENT,
PREPARE_EVENT, GETDESCRIPTION, RELEASE_EVENT, END_EVENT);
......@@ -681,7 +648,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_LOOP', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSOURCE_EVENT, fileDescriptor, SETSURFACE_EVENT,
PREPARE_EVENT, SETLOOP_EVENT, true, PLAY_EVENT, SEEK_EVENT, DURATION_TIME, WAIT_EVENT,
......@@ -699,7 +666,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let fdPath = fdHead + fileDescriptor.fd;
let mySteps = new Array(CREATE_EVENT, SETFDSOURCE_EVENT, fileDescriptor, SETSURFACE_EVENT,
......
......@@ -15,7 +15,7 @@
import media from '@ohos.multimedia.media'
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'
describe('VideoPlayerFuncPromiseTest', function () {
......@@ -36,7 +36,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
beforeAll(async function() {
console.info('beforeAll case');
await getFileDescriptor(VIDEO_SOURCE).then((res) => {
await mediaTestBase.getFileDescriptor(VIDEO_SOURCE).then((res) => {
fileDescriptor = res;
});
})
......@@ -44,7 +44,8 @@ describe('VideoPlayerFuncPromiseTest', function () {
beforeEach(async function() {
await toNewPage(page);
page = (page + 1) % 2;
await msleep(1000).then(() => {}, failureCallback).catch(catchCallback);
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
surfaceID = globalThis.value;
console.info('case new surfaceID is ' + surfaceID);
console.info('beforeEach case');
......@@ -56,38 +57,10 @@ describe('VideoPlayerFuncPromiseTest', function () {
})
afterAll(async function() {
await closeFileDescriptor(VIDEO_SOURCE);
await mediaTestBase.closeFileDescriptor(VIDEO_SOURCE);
console.info('afterAll case');
})
function sleep(time) {
for(let t = Date.now(); Date.now() - t <= time;);
}
function msleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
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 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 checkSpeedTime(videoPlayer, speedValue, startTime) {
let newTime = videoPlayer.currentTime;
if (videoPlayer.state == 'playing') {
......@@ -122,7 +95,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SetSource', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
......@@ -133,13 +106,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.on('error', async (error) => {
console.info(`case error called,errMessage is ${error.message}`);
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
});
videoPlayer.url = "";
......@@ -154,7 +127,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SetVolume', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
......@@ -164,13 +137,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.url = fdHead + fileDescriptor.fd;
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared');
......@@ -178,14 +151,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
......@@ -193,12 +166,12 @@ describe('VideoPlayerFuncPromiseTest', function () {
await videoPlayer.setVolume(i * 0.5).then(() => {
expect(videoPlayer.state).assertEqual('playing');
console.info('case setVolume called');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
}
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
})
......@@ -211,7 +184,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SetSpeed', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
......@@ -221,13 +194,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.url = fdHead + fileDescriptor.fd;
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared');
......@@ -235,14 +208,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(1000);
mediaTestBase.msleep(1000);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
......@@ -250,50 +223,50 @@ describe('VideoPlayerFuncPromiseTest', function () {
await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_0_75_X).then((speedMode) => {
expect(videoPlayer.state).assertEqual('playing');
expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_0_75_X);
sleep(1000);
mediaTestBase.msleep(1000);
checkSpeedTime(videoPlayer, media.PlaybackSpeed.SPEED_FORWARD_0_75_X, startTime);
console.info('case setSpeed called and speedMode is ' + speedMode);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
startTime = videoPlayer.currentTime;
await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_00_X).then((speedMode) => {
expect(videoPlayer.state).assertEqual('playing');
expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_1_00_X);
sleep(1000);
mediaTestBase.msleep(1000);
checkSpeedTime(videoPlayer, media.PlaybackSpeed.SPEED_FORWARD_1_00_X, startTime);
console.info('case setSpeed called and speedMode is ' + speedMode);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
startTime = videoPlayer.currentTime;
await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_25_X).then((speedMode) => {
expect(videoPlayer.state).assertEqual('playing');
expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_1_25_X);
sleep(1000);
mediaTestBase.msleep(1000);
checkSpeedTime(videoPlayer, media.PlaybackSpeed.SPEED_FORWARD_1_25_X, startTime);
console.info('case setSpeed called and speedMode is ' + speedMode);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
startTime = videoPlayer.currentTime;
await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_75_X).then((speedMode) => {
expect(videoPlayer.state).assertEqual('playing');
expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_1_75_X);
sleep(1000);
mediaTestBase.msleep(1000);
checkSpeedTime(videoPlayer, media.PlaybackSpeed.SPEED_FORWARD_1_75_X, startTime);
console.info('case setSpeed called and speedMode is ' + speedMode);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
startTime = videoPlayer.currentTime;
await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X).then((speedMode) => {
expect(videoPlayer.state).assertEqual('playing');
expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_2_00_X);
sleep(1000);
mediaTestBase.msleep(1000);
checkSpeedTime(videoPlayer, media.PlaybackSpeed.SPEED_FORWARD_2_00_X, startTime);
console.info('case setSpeed called and speedMode is ' + speedMode);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
})
......@@ -306,7 +279,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
......@@ -316,13 +289,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.url = fdHead + fileDescriptor.fd;
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared');
......@@ -330,14 +303,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
......@@ -345,41 +318,41 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(SEEK_TIME, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(PREV_FRAME_TIME - 100, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime + DELTA_SEEK_TIME).assertClose(DELTA_SEEK_TIME, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(PREV_FRAME_TIME + 100, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(NEXT_FRAME_TIME - 100, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(NEXT_FRAME_TIME + 100, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime).assertClose(NEXT_FRAME_TIME + 100, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
})
......@@ -392,7 +365,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_Callback', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let frameCount = -1;
let completedCount = 0;
......@@ -406,14 +379,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.on('playbackCompleted', async () => {
console.info('case playbackCompleted success');
completedCount++;
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
expect(widthValue).assertEqual(WIDTH_VALUE);
expect(heightValue).assertEqual(HEIGHT_VALUE);
//expect(frameCount).assertEqual(1);
......@@ -441,7 +414,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared');
......@@ -449,13 +422,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
})
/* *
......@@ -467,7 +440,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level1
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let arrayDescription = null;
await media.createVideoPlayer().then((video) => {
......@@ -478,18 +451,18 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.url = fdHead + fileDescriptor.fd;
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared');
console.info('case prepare called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.getTrackDescription().then((arrayList) => {
console.info('case getTrackDescription called!!');
......@@ -499,15 +472,15 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case getTrackDescription is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
for (let i = 0; i < arrayDescription.length; i++) {
printfDescription(arrayDescription[i]);
mediaTestBase.printDescription(arrayDescription[i]);
}
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
})
......@@ -520,7 +493,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level1
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_Loop', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
let bufferCount = 0;
await media.createVideoPlayer().then((video) => {
......@@ -531,13 +504,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.on('playbackCompleted', async () => {
console.info('case playbackCompleted success');
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
expect(bufferCount).assertEqual(19);
done();
});
......@@ -553,7 +526,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
videoPlayer.loop = true;
......@@ -562,15 +535,15 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
expect(videoPlayer.loop).assertEqual(true);
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
......@@ -579,8 +552,8 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.state).assertEqual('playing');
expect(seekDoneTime).assertClose(DURATION_TIME, DELTA_SEEK_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
sleep(3000);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
mediaTestBase.msleep(3000);
expect(videoPlayer.state).assertEqual('playing');
}
videoPlayer.loop = false;
......@@ -595,7 +568,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_BASE', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
......@@ -606,13 +579,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.on('playbackCompleted', async () => {
console.info('case playbackCompleted success');
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
});
......@@ -620,7 +593,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
console.info('case setDisplaySurface success');
expect(videoPlayer.state).assertEqual('idle');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
console.info('case prepare called!!');
......@@ -628,37 +601,37 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.duration).assertEqual(DURATION_TIME);
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
await videoPlayer.pause().then(() => {
expect(videoPlayer.state).assertEqual('paused');
console.info('case pause called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.stop().then(() => {
console.info('case stop called!!');
expect(videoPlayer.state).assertEqual('stopped');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.reset().then(() => {
console.info('case reset called!!');
expect(videoPlayer.state).assertEqual('idle');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.url = fdHead + fileDescriptor.fd;
await videoPlayer.prepare().then(() => {
......@@ -667,34 +640,34 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect(videoPlayer.duration).assertEqual(DURATION_TIME);
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.loop = true;
startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
await videoPlayer.seek(videoPlayer.duration / 2).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(0).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.seek(videoPlayer.duration).then((seekDoneTime) => {
expect(videoPlayer.state).assertEqual('playing');
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
console.info('case seek called and seekDoneTime is' + seekDoneTime);
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoPlayer.loop = false;
})
......@@ -707,7 +680,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
* @tc.level : Level2
*/
it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_MULTIPLE', 0, async function (done) {
isFileOpen(fileDescriptor, done);
mediaTestBase.isFileOpen(fileDescriptor, done);
let testVideoPlayer1 = null;
let testVideoPlayer2 = null;
await media.createVideoPlayer().then((video) => {
......@@ -719,16 +692,17 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
testVideoPlayer1.url = fdHead + fileDescriptor.fd;
await testVideoPlayer1.setDisplaySurface(surfaceID).then(() => {
console.info('case setDisplaySurface success');
expect(testVideoPlayer1.state).assertEqual('idle');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await toNewPage(page);
page = (page + 1) % 2;
await msleep(1000).then(() => {}, failureCallback).catch(catchCallback);
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
surfaceID = globalThis.value;
for (let i = 0; i < 3; i++) {
......@@ -741,47 +715,47 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
testVideoPlayer2.url = fdHead + fileDescriptor.fd;
await testVideoPlayer2.setDisplaySurface(surfaceID).then(() => {
console.info('case setDisplaySurface success');
expect(testVideoPlayer2.state).assertEqual('idle');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await testVideoPlayer1.prepare().then(() => {
console.info('case prepare called!!');
expect(testVideoPlayer1.state).assertEqual('prepared');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await testVideoPlayer1.play().then(() => {
console.info('case play called!!');
expect(testVideoPlayer1.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await testVideoPlayer2.prepare().then(() => {
console.info('case prepare called!!');
expect(testVideoPlayer2.state).assertEqual('prepared');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await testVideoPlayer2.play().then(() => {
console.info('case play called!!');
expect(testVideoPlayer2.state).assertEqual('playing');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
sleep(PLAY_TIME);
mediaTestBase.msleep(PLAY_TIME);
await testVideoPlayer1.reset().then(() => {
console.info('case reset called!!');
expect(testVideoPlayer1.state).assertEqual('idle');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
testVideoPlayer1.url = fdHead + fileDescriptor.fd;
await testVideoPlayer2.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
}
await testVideoPlayer1.release().then(() => {
console.info('case release called!!');
}, failureCallback).catch(catchCallback);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
done();
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册