提交 d2941cbf 编写于 作者: F fulizhong

modify testcases Signed-off-by: FULIZHONG<fulizhong1@huawei.com>

Signed-off-by: Nfulizhong <fulizhong@huawei.com>
上级 e10756f4
......@@ -39,7 +39,7 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) {
}
audioPlayer.on('dataLoad', () => {
console.info('case set source success');
expect(audioPlayer.state).assertEqual('idle');
expect(audioPlayer.state).assertEqual('paused');
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertClose(duration, 500);
// step 0: dataLoad -> play
......
......@@ -76,12 +76,12 @@ describe('PlayerLocalTestAudioAPI', function () {
}
function initAudioPlayer() {
if (typeof (audioPlayer) != 'undefined') {
if (audioPlayer != null) {
audioPlayer.release();
audioPlayer = undefined;
audioPlayer = null;
}
audioPlayer = media.createAudioPlayer();
if (typeof (audioPlayer) == 'undefined') {
if (audioPlayer == null) {
console.info('case create player is faild');
expect().assertFail();
}
......@@ -126,7 +126,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info(`case to release`);
mySteps.shift();
audioPlayer.release();
audioPlayer = undefined;
audioPlayer = null;
nextStep(mySteps,done);
break;
case LOOP_STATE:
......@@ -148,7 +148,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info(`case dataLoad called`);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('idle');
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps,done);
});
audioPlayer.on('play', () => {
......@@ -191,7 +191,7 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep(mySteps,done);
});
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
return;
}
......@@ -229,9 +229,7 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep(mySteps,done);
});
audioPlayer.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
if ((mySteps[0] == SEEK_STATE) || (mySteps[0] == VOLUME_STATE)) {
mySteps.shift();
mySteps.shift();
......@@ -713,9 +711,9 @@ describe('PlayerLocalTestAudioAPI', function () {
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100', 0, async function (done) {
mediaTestBase.isFileOpen(fileDescriptor, done);
initAudioPlayer();
expect(audioPlayer.src).assertEqual(undefined);
expect(audioPlayer.duration).assertEqual(undefined);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.src).assertEqual('');
expect(audioPlayer.duration).assertEqual(-1);
expect(audioPlayer.currentTime).assertEqual(-1);
expect(audioPlayer.state).assertEqual('idle');
expect(audioPlayer.loop).assertEqual(false);
done();
......@@ -737,7 +735,7 @@ describe('PlayerLocalTestAudioAPI', function () {
expect(audioPlayer.src).assertEqual(fdHead + fileDescriptor.fd);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('idle');
expect(audioPlayer.state).assertEqual('paused');
expect(audioPlayer.loop).assertEqual(false);
done();
})
......
......@@ -84,12 +84,12 @@ describe('PlayerLocalTestAudioFUNC', function () {
}
function initAudioPlayer() {
if (typeof (audioPlayer) != 'undefined') {
if (audioPlayer != null) {
audioPlayer.release();
audioPlayer = undefined;
audioPlayer = null;
}
audioPlayer = media.createAudioPlayer();
if (typeof (audioPlayer) == 'undefined') {
if (audioPlayer == null) {
console.info('case create player is faild');
expect().assertFail();
}
......@@ -194,7 +194,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
console.info(`case dataLoad called`);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('idle');
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps, done);
});
audioPlayer.on('play', () => {
......@@ -342,7 +342,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
testAudioPlayer.on('dataLoad', () => {
expect(testAudioPlayer.duration).assertEqual(DURATION_TIME);
expect(testAudioPlayer.state).assertEqual('idle');
expect(testAudioPlayer.state).assertEqual('paused');
testAudioPlayer.play();
});
testAudioPlayer.on('play', () => {
......@@ -402,6 +402,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect(bufferFlag).assertEqual(true);
expect(testAudioPlayer.state).assertEqual('idle');
testAudioPlayer.release();
testAudioPlayer = null;
done();
});
testAudioPlayer.src = fdPath;
......
......@@ -79,11 +79,11 @@ describe('PlayerLocalTestAudioFormat', function () {
console.info('case reset success');
expect(audioPlayer.state).assertEqual('idle');
audioPlayer.release();
audioPlayer = undefined;
audioPlayer = null;
done();
});
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == "undefined") {
if (seekDoneTime == null) {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
audioPlayer.release();
expect().assertFail();
......
......@@ -48,7 +48,7 @@ describe('VideoPlayerAPICallbackTest', function () {
const PREV_FRAME_TIME = 4166;
const DELTA_TIME = 100;
let surfaceID = '';
let fileDescriptor = undefined;
let fileDescriptor = null;
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let pageId = 0;
......@@ -130,12 +130,12 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(CREATE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
media.createVideoPlayer((err, video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
console.info('case createVideoPlayer success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -156,11 +156,11 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(SETSURFACE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.setDisplaySurface(surfaceID, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -173,14 +173,14 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
setOnCallback(videoPlayer, steps, done);
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('prepared');
expect(videoPlayer.duration).assertEqual(DURATION_TIME);
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -192,12 +192,12 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(GETDESCRIPTION, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.getTrackDescription((err, arrlist) => {
if (typeof (err) == 'undefined') {
if (err == null) {
for (let i = 0; i < arrlist.length; i++) {
mediaTestBase.printDescription(arrlist[i]);
}
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -209,12 +209,12 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(PLAY_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
mediaTestBase.msleep(PLAY_TIME);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -226,11 +226,11 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(PAUSE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('paused');
console.info('case pause success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -242,11 +242,11 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(STOP_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('stopped');
console.info('case stop success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -258,11 +258,11 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(RESET_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('idle');
console.info('case reset success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -274,10 +274,10 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter.on(RELEASE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('case release success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -291,10 +291,10 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -333,11 +333,11 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, media.SeekMode.SEEK_NEXT_SYNC, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
if (err == null) {
checkSeekTime(media.SeekMode.SEEK_NEXT_SYNC, seekTime, seekDoneTime);
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -351,10 +351,10 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.setVolume(volumeValue, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('case setVolume success');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -368,11 +368,11 @@ describe('VideoPlayerAPICallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.setSpeed(speedValue, (err, speedMode) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(speedValue).assertEqual(speedMode);
console.info('case setSpeed success and speedMode is '+ speedMode);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -434,7 +434,7 @@ describe('VideoPlayerAPICallbackTest', function () {
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0400
* @tc.name : fileDescriptor is undefined
* @tc.name : fileDescriptor is null
* @tc.desc : Reliability Test
* @tc.size : MediumTest
* @tc.type : Reliability
......@@ -442,7 +442,7 @@ describe('VideoPlayerAPICallbackTest', function () {
*/
it(' SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0400', 0, async function (done) {
mediaTestBase.isFileOpen(fileDescriptor, done);
fileDescriptor = undefined;
fileDescriptor = null;
let videoPlayer = null;
let mySteps = new Array(CREATE_EVENT, SETFDSRC_EVENT, SETSURFACE_EVENT, ERROR_EVENT,
PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
......
......@@ -51,7 +51,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
const DELTA_SEEK_TIME = 100;
let surfaceID = '';
let fdHead = 'fd://';
let fileDescriptor = undefined;
let fileDescriptor = null;
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let pageId = 0;
......@@ -134,13 +134,13 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(CREATE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
media.createVideoPlayer((err, video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
setOnCallback(videoPlayer, steps, done);
expect(videoPlayer.state).assertEqual('idle');
console.info('case createVideoPlayer success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -179,11 +179,11 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(SETSURFACE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.setDisplaySurface(surfaceID, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -195,14 +195,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(PREPARE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('prepared');
expect(videoPlayer.duration).assertEqual(DURATION_TIME);
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -214,14 +214,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(SRC_PREPARE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('prepared');
expect(videoPlayer.duration).assertEqual(DURATION_TIME);
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
expect(videoPlayer.height).assertEqual(HEIGHT_VALUE);
console.info('case prepare success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -241,12 +241,12 @@ describe('VideoPlayerFuncCallbackTest', function () {
let descriptionKey = new Array(videoTrackKey, audioTrackKey);
let descriptionValue = new Array(videoTrackValue, audioTrackValue);
videoPlayer.getTrackDescription((err, arrlist) => {
if (typeof (err) == 'undefined') {
if (err == null) {
for (let i = 0; i < arrlist.length; i++) {
mediaTestBase.checkDescription(arrlist[i], descriptionKey[i], descriptionValue[i]);
}
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -259,14 +259,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
let startTime = videoPlayer.currentTime;
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
mediaTestBase.msleep(PLAY_TIME);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -278,11 +278,11 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(PAUSE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('paused');
console.info('case pause success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -294,11 +294,11 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(STOP_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('stopped');
console.info('case stop success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -310,11 +310,11 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(RESET_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('idle');
console.info('case reset success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -326,10 +326,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(RELEASE_EVENT, (videoPlayer, steps, done) => {
steps.shift();
videoPlayer.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('case release success!!');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -368,14 +368,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
if (err == null) {
if (seekTime > DURATION_TIME) {
seekTime = DURATION_TIME;
}
checkSeekTime(media.SeekMode.SEEK_PREV_SYNC, seekTime, seekDoneTime);
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -391,14 +391,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.seek(seekTime, seekMode, (err, seekDoneTime) => {
if (typeof (err) == 'undefined') {
if (err == null) {
if (seekTime > DURATION_TIME) {
seekTime = DURATION_TIME;
}
checkSeekTime(seekMode, seekTime, seekDoneTime);
console.info('case seek success and seekDoneTime is '+ seekDoneTime);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -412,10 +412,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
steps.shift();
videoPlayer.setVolume(volumeValue, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('case setVolume success');
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -455,13 +455,13 @@ describe('VideoPlayerFuncCallbackTest', function () {
steps.shift();
let startTime = videoPlayer.currentTime;
videoPlayer.setSpeed(speedValue, (err, speedMode) => {
if (typeof (err) == 'undefined') {
if (err == null) {
mediaTestBase.msleep(1000);
expect(speedValue).assertEqual(speedMode);
console.info('case setSpeed success and speedMode is '+ speedMode);
checkSpeedTime(videoPlayer, speedValue, startTime);
toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
} else if ((err != null) && (steps[0] == ERROR_EVENT)) {
steps.shift();
toNextStep(videoPlayer, steps, done);
} else {
......@@ -540,7 +540,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on('test_create', () => {
media.createVideoPlayer((err, video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
console.info('case createVideoPlayer success!!');
......@@ -560,7 +560,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
expect(completedCount).assertEqual(1);
expect(frameCount).assertEqual(true);
videoPlayer.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('case release success!!');
done();
} else {
......@@ -590,7 +590,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on('test_setSurface', () => {
videoPlayer.url = fdHead + fileDescriptor.fd;
videoPlayer.setDisplaySurface(surfaceID, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success!!');
eventEmitter.emit('test_prepare');
......@@ -602,7 +602,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on('test_prepare', () => {
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('prepared');
expect(videoPlayer.duration).assertEqual(DURATION_TIME);
expect(videoPlayer.width).assertEqual(WIDTH_VALUE);
......@@ -617,7 +617,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on('test_play', () => {
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
expect(videoPlayer.state).assertEqual('playing');
console.info('case play success!!');
} else {
......
......@@ -33,7 +33,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
const DELTA_SEEK_TIME = 100;
let surfaceID = '';
let fdHead = 'fd://';
let fileDescriptor = undefined;
let fileDescriptor = null;
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let pageId = 0;
......@@ -113,7 +113,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
console.info('case createVideoPlayer success');
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
......@@ -145,7 +145,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
......@@ -202,7 +202,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
......@@ -301,7 +301,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
let widthValue = -1;
let heightValue = -1;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
......@@ -373,7 +373,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
let videoPlayer = null;
let bufferCount = false;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
......@@ -453,7 +453,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
console.info('case createVideoPlayer success');
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
......@@ -565,7 +565,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
console.info('case createVideoPlayer success');
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
......@@ -698,7 +698,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
let bufferCount = false;
let count = 0;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
......@@ -782,7 +782,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
let videoPlayer = null;
let errorCount = 0;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
if (video != null) {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册