提交 212476b5 编写于 作者: X XUXIAOBO 提交者: Gitee

media audio apii test

Signed-off-by: NXUXIAOBO <xuxiaobo5@huawei.com>
上级 766a2360
...@@ -20,7 +20,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -20,7 +20,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let audioPlayer = media.createAudioPlayer(); let audioPlayer = media.createAudioPlayer();
let loopValue = false; let loopValue = false;
let isTimeOut = false; let isTimeOut = false;
const Audio_SOURCE = "data/media/audio/Homey.mp3"; const AUDIO_SOURCE = 'file://data/media/audio/01.mp3';
const PLAY_TIME = 3000; const PLAY_TIME = 3000;
const END_STATE = 0; const END_STATE = 0;
const SRC_STATE = 1; const SRC_STATE = 1;
...@@ -34,7 +34,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -34,7 +34,7 @@ describe('PlayerLocalTestAudioAPI', function () {
const ERROR_STATE = 9; const ERROR_STATE = 9;
const FINISH_STATE = 10; const FINISH_STATE = 10;
const LOOP_STATE = 11; const LOOP_STATE = 11;
const DURATION_TIME = 89239; const DURATION_TIME = 99432;
const SEEK_TIME = 5000; const SEEK_TIME = 5000;
const DELTA_TIME = 1000; const DELTA_TIME = 1000;
const SECOND_INDEX = 1; const SECOND_INDEX = 1;
...@@ -42,20 +42,20 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -42,20 +42,20 @@ describe('PlayerLocalTestAudioAPI', function () {
const VOLUME_VALUE = 0.5; const VOLUME_VALUE = 0.5;
beforeAll(function() { beforeAll(function() {
console.info("beforeAll case"); console.info('beforeAll case');
}) })
beforeEach(function() { beforeEach(function() {
isTimeOut = false; isTimeOut = false;
console.info("beforeEach case"); console.info('beforeEach case');
}) })
afterEach(function() { afterEach(function() {
console.info("afterEach case"); console.info('afterEach case');
}) })
afterAll(function() { afterAll(function() {
console.info("afterAll case"); console.info('afterAll case');
}) })
function sleep(time) { function sleep(time) {
...@@ -63,7 +63,15 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -63,7 +63,15 @@ describe('PlayerLocalTestAudioAPI', function () {
}; };
function initAudioPlayer() { function initAudioPlayer() {
if (typeof (audioPlayer) != 'undefined') {
audioPlayer.release();
audioPlayer = undefined;
}
audioPlayer = media.createAudioPlayer(); audioPlayer = media.createAudioPlayer();
if (typeof (audioPlayer) == 'undefined') {
console.info('case create player is faild');
expect().assertFail();
}
} }
function nextStep(mySteps) { function nextStep(mySteps) {
...@@ -74,7 +82,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -74,7 +82,7 @@ describe('PlayerLocalTestAudioAPI', function () {
switch (mySteps[0]) { switch (mySteps[0]) {
case SRC_STATE: case SRC_STATE:
console.info(`case to prepare`); console.info(`case to prepare`);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
break; break;
case PLAY_STATE: case PLAY_STATE:
console.info(`case to play`); console.info(`case to play`);
...@@ -104,6 +112,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -104,6 +112,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info(`case to release`); console.info(`case to release`);
mySteps.shift(); mySteps.shift();
audioPlayer.release(); audioPlayer.release();
audioPlayer = undefined;
nextStep(mySteps); nextStep(mySteps);
break; break;
case LOOP_STATE: case LOOP_STATE:
...@@ -118,7 +127,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -118,7 +127,7 @@ describe('PlayerLocalTestAudioAPI', function () {
} }
} }
function setCallback(mySteps) { function setCallback(mySteps, done) {
console.info(`case setCallback`); console.info(`case setCallback`);
audioPlayer.on('dataLoad', () => { audioPlayer.on('dataLoad', () => {
mySteps.shift(); mySteps.shift();
...@@ -172,7 +181,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -172,7 +181,7 @@ describe('PlayerLocalTestAudioAPI', function () {
}); });
audioPlayer.on('timeUpdate', (seekDoneTime) => { audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == "undefined") { if (typeof (seekDoneTime) == 'undefined') {
console.info(`case seek filed,errcode is ${seekDoneTime}`); console.info(`case seek filed,errcode is ${seekDoneTime}`);
return; return;
} }
...@@ -189,7 +198,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -189,7 +198,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info('case loop is true'); console.info('case loop is true');
sleep(PLAY_STATE); sleep(PLAY_STATE);
} }
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == "paused")) { if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps); nextStep(mySteps);
} }
}); });
...@@ -198,7 +207,7 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -198,7 +207,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info(`case setvolume called`); console.info(`case setvolume called`);
mySteps.shift(); mySteps.shift();
mySteps.shift(); mySteps.shift();
if (audioPlayer.state == "playing") { if (audioPlayer.state == 'playing') {
sleep(PLAY_TIME); sleep(PLAY_TIME);
} }
nextStep(mySteps); nextStep(mySteps);
...@@ -231,6 +240,14 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -231,6 +240,14 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep(mySteps); nextStep(mySteps);
} }
}); });
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}; };
/* * /* *
...@@ -244,15 +261,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -244,15 +261,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -266,15 +276,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -266,15 +276,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PLAY_STATE, ERROR_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PLAY_STATE, ERROR_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -288,15 +291,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -288,15 +291,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, PLAY_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, PLAY_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -310,15 +306,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -310,15 +306,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, RESET_STATE, PLAY_STATE, ERROR_STATE, END_STATE); let mySteps = new Array(SRC_STATE, RESET_STATE, PLAY_STATE, ERROR_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -332,15 +321,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -332,15 +321,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100', 0, async function (done) {
let mySteps = new Array(PAUSE_STATE, ERROR_STATE, END_STATE); let mySteps = new Array(PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.pause(); audioPlayer.pause();
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -354,15 +336,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -354,15 +336,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -376,15 +351,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -376,15 +351,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300', 0, async function (done) {
let mySteps = new Array(PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE); let mySteps = new Array(PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -398,15 +366,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -398,15 +366,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, PAUSE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, PAUSE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -420,15 +381,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -420,15 +381,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -442,15 +396,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -442,15 +396,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -464,15 +411,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -464,15 +411,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, STOP_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, STOP_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -486,15 +426,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -486,15 +426,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -508,15 +441,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -508,15 +441,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300 * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300
...@@ -529,15 +455,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -529,15 +455,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -551,15 +470,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -551,15 +470,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -573,15 +485,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -573,15 +485,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RESET_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RESET_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -595,15 +500,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -595,15 +500,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100', 0, async function (done) {
var mySteps = new Array(VOLUME_STATE, VOLUME_VALUE, ERROR_STATE, END_STATE); var mySteps = new Array(VOLUME_STATE, VOLUME_VALUE, ERROR_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.setVolume(VOLUME_VALUE); audioPlayer.setVolume(VOLUME_VALUE);
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200 * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200
...@@ -616,15 +514,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -616,15 +514,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200', 0, async function (done) {
var mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE); var mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300 * @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300
...@@ -637,15 +528,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -637,15 +528,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300', 0, async function (done) {
var mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE); var mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -659,15 +543,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -659,15 +543,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -681,15 +558,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -681,15 +558,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -703,15 +573,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -703,15 +573,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -725,15 +588,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -725,15 +588,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, RELEASE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, RELEASE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -747,15 +603,8 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -747,15 +603,8 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer(); initAudioPlayer();
setCallback(mySteps); setCallback(mySteps, done);
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
}) })
/* * /* *
...@@ -786,9 +635,9 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -786,9 +635,9 @@ describe('PlayerLocalTestAudioAPI', function () {
*/ */
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200', 0, async function (done) {
initAudioPlayer(); initAudioPlayer();
audioPlayer.src = Audio_SOURCE; audioPlayer.src = AUDIO_SOURCE;
sleep(PLAY_TIME); sleep(PLAY_TIME);
expect(audioPlayer.src).assertEqual(Audio_SOURCE); expect(audioPlayer.src).assertEqual(AUDIO_SOURCE);
expect(audioPlayer.currentTime).assertEqual(0); expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME); expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused'); expect(audioPlayer.state).assertEqual('paused');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册