diff --git a/multimedia/media/media_js_standard/VideoPlayerTestBase.js b/multimedia/media/media_js_standard/VideoPlayerTestBase.js new file mode 100644 index 0000000000000000000000000000000000000000..351f367ae588f3dee63d8c2524f094099ab44100 --- /dev/null +++ b/multimedia/media/media_js_standard/VideoPlayerTestBase.js @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import router from '@system.router' +import media from '@ohos.multimedia.media' +import * as mediaTestBase from './MediaTestBase.js'; + +export async function toNewPage(pagePath1, pagePath2, page) { + let path = ''; + if (page == 0) { + path = 'pages/surfaceTest/surfaceTest'; + } else { + path = 'pages/surfaceTest2/surfaceTest2'; + } + let options = { + uri: path, + } + try { + await router.push(options); + } catch { + console.info('case route failed'); + } +} + +export async function clearRouter() { + await router.clear(); +} + +export async function playVideoSource(url, width, height, duration, playTime) { + console.info(`case media source url: ${url}`) + let videoPlayer = null; + let surfaceID = globalThis.value; + await media.createVideoPlayer().then((video) => { + if (typeof (video) != 'undefined') { + console.info('case createVideoPlayer success'); + videoPlayer = video; + } else { + console.error('case createVideoPlayer failed'); + expect().assertFail(); + } + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + videoPlayer.on('videoSizeChanged', (w, h) => { + console.info('case videoSizeChanged width: ' + w + ' height: ' + h); + }); + + videoPlayer.on('error', (err) => { + console.error(`case error called, errMessage is ${err.message}`); + expect().assertFail(); + }); + videoPlayer.url = url; + if (width != null & height != null) { + await videoPlayer.setDisplaySurface(surfaceID).then(() => { + console.info('case setDisplaySurface success, surfaceID: ' + surfaceID); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + + await videoPlayer.prepare().then(() => { + console.info('case prepare called'); + expect(videoPlayer.duration).assertClose(duration, 500); + if (width != null & height != null) { + expect(videoPlayer.width).assertEqual(width); + expect(videoPlayer.height).assertEqual(height); + } + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.getTrackDescription().then((arrayList) => { + console.info('case getTrackDescription called'); + if (typeof (arrayList) != 'undefined') { + for (let i = 0; i < arrayList.length; i++) { + mediaTestBase.printDescription(arrayList[i]); + } + } else { + console.error('case getTrackDescription failed'); + expect().assertFail(); + } + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + let startTime = videoPlayer.currentTime; + await videoPlayer.play().then(() => { + console.info('case play called'); + expect(videoPlayer.state).assertEqual('playing'); + mediaTestBase.msleep(playTime); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + let endTime = videoPlayer.currentTime; + expect(endTime - startTime).assertClose(playTime, 1000); + + await videoPlayer.seek(videoPlayer.duration / 3).then((seekDoneTime) => { + console.info('case seek called and seekDoneTime is ' + seekDoneTime); + expect(videoPlayer.state).assertEqual('playing'); + mediaTestBase.msleep(playTime); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.pause().then(() => { + console.info('case pause called'); + expect(videoPlayer.state).assertEqual('paused'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + videoPlayer.loop = true; + await videoPlayer.seek(0, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { + expect(videoPlayer.state).assertEqual('paused'); + console.info('case seek called and seekDoneTime is ' + seekDoneTime); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.play().then(() => { + console.info('case play called'); + expect(videoPlayer.state).assertEqual('playing'); + mediaTestBase.msleep(playTime); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X).then((speedMode) => { + console.info('case setSpeed called and speedMode is ' + speedMode); + mediaTestBase.msleep(playTime); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.setVolume(0.5).then(() => { + console.info('case setVolume called'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.seek(duration, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { + console.info('case seek called and seekDoneTime is ' + seekDoneTime); + mediaTestBase.msleep(duration - seekDoneTime); + expect(videoPlayer.state).assertEqual('playing'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + videoPlayer.loop = false; + await videoPlayer.seek(duration, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { + console.info('case seek called and seekDoneTime is ' + seekDoneTime); + mediaTestBase.msleep(duration - seekDoneTime); + expect(videoPlayer.state).assertEqual('stopped'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.play().then(() => { + console.info('case play called'); + expect(videoPlayer.state).assertEqual('playing'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.stop().then(() => { + console.info('case stop called'); + expect(videoPlayer.state).assertEqual('stopped'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.reset().then(() => { + console.info('case reset called'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + videoPlayer.url = url; + await videoPlayer.setDisplaySurface(surfaceID).then(() => { + console.info('case setDisplaySurface success, surfaceID: ' + surfaceID); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.prepare().then(() => { + console.info('case prepare called'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.play().then(() => { + console.info('case play called'); + expect(videoPlayer.state).assertEqual('playing'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.pause().then(() => { + console.info('case pause called'); + expect(videoPlayer.state).assertEqual('paused'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.stop().then(() => { + console.info('case stop called'); + expect(videoPlayer.state).assertEqual('stopped'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await videoPlayer.release().then(() => { + console.info('case release called'); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoPlayer/Test.json b/multimedia/media/media_js_standard/videoPlayer/Test.json index 615d3fd9cd91b428bf516d66ab22bff794d66bc7..e318313eb3cb42f7f9c8a0ca8a28d72a16eebc26 100644 --- a/multimedia/media/media_js_standard/videoPlayer/Test.json +++ b/multimedia/media/media_js_standard/videoPlayer/Test.json @@ -27,76 +27,7 @@ "pre-push": [ ], "push": [ - "./resource/audio/H264_AAC.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_none_audio.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_none_audio.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_none_audio.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_aac.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_mp3.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_720p_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_480p_25r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_270p_10r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_320x240_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_480x320_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_640x480_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_640x480_25r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_none_audio_640x480_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_none_audio_640x480_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_none_audio_640x480_30r.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_none_audio.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_none_audio.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_none_audio.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_aac.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_mp3.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_720p_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_480p_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_270p_10r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_720p_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_480p_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_270p_10r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_aac_720p_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_aac_480p_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_aac_270p_10r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_mp3_720p_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_mp3_480p_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_mp3_270p_10r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_720p_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_480p_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_270p_10r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_mp3_720p_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_mp3_480p_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_mp3_270p_10r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_none_audio_640x480_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_none_audio_640x480_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_none_audio_640x480_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_aac_640x480_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_mp3_640x480_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_aac_640x480_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_mp3_640x480_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_640x480_30r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_mp3_640x480_25r.ts ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/vp8_none_audio.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_vorbis.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/vp8_vorbis_720p_30r.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/vp8_vorbis_480p_25r.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/vp8_vorbis_270p_10r.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/vp8_none_audio_640x480_30r.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/vp8_vorbis_640x480_25r.webm ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_none_audio.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_none_audio.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_none_audio.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_aac.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/none_video_mp3.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_720p_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_480p_25r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_270p_10r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h264_none_audio_640x480_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h263_none_audio_640x480_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg2_none_audio_640x480_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_none_audio_640x480_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/h263_aac_640x480_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_640x480_30r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/", - "./resource/audio/mpeg4_aac_270p_25r.mkv ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/" + "./resource/audio/H264_AAC.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/" ] } ] diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/List.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/List.test.js index eed8f99d173ad320edc82a6053f8298f5d122304..734f64a5b0f9f26926f2d9257dac3f9366e4d217 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/List.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/List.test.js @@ -16,5 +16,4 @@ require('./VideoPlayerFuncCallbackTest.test.js') require('./VideoPlayerFuncPromiseTest.test.js') require('./VideoPlayerAPICallbackTest.test.js') -require('./VideoPlayerEnumTest.test.js') -require('./VideoPlayerFormatCompatibilityTest.test.js') \ No newline at end of file +require('./VideoPlayerEnumTest.test.js') \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js index e401e31e70bbd744e907b45244e372c0a3dd0c3a..442a55bff33746e73f942fb3e56b146811988ecf 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js @@ -14,7 +14,7 @@ */ import media from '@ohos.multimedia.media' -import {toNewPage, clearRouter} from './VideoPlayerTestBase.js'; +import {toNewPage, clearRouter} from '../../../../../VideoPlayerTestBase.js'; import * as mediaTestBase from '../../../../../MediaTestBase.js'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' @@ -49,7 +49,9 @@ describe('VideoPlayerAPICallbackTest', function () { const DELTA_TIME = 100; let surfaceID = ''; let fileDescriptor = undefined; - let page = 0; + const pagePath1 = 'pages/surfaceTest/surfaceTest'; + const pagePath2 = 'pages/surfaceTest2/surfaceTest2'; + let pageId = 0; let fdHead = 'fd://'; let events = require('events'); let eventEmitter = new events.EventEmitter(); @@ -62,8 +64,8 @@ describe('VideoPlayerAPICallbackTest', function () { await mediaTestBase.getFileDescriptor(VIDEO_SOURCE).then((res) => { fileDescriptor = res; }); - await toNewPage(page); - page = (page + 1) % 2; + await toNewPage(pagePath1, pagePath2, pageId); + pageId = (pageId + 1) % 2; await mediaTestBase.msleepAsync(1000).then( () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); surfaceID = globalThis.value; diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFormatCompatibilityTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFormatCompatibilityTest.test.js deleted file mode 100644 index 8cff29ac5104799959a714476fd03ff831ac68a8..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFormatCompatibilityTest.test.js +++ /dev/null @@ -1,1151 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import {toNewPage, clearRouter} from './VideoPlayerTestBase.js'; -import {getFileDescriptor, closeFileDescriptor, isFileOpen} from '../../../../../MediaTestBase.js'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - - -describe('VideoPlayerFormatCompatibilityTest', function () { - const PLAY_TIME = 2000; - const SEEK_TIME = 3000; - const DELTA_TIME = 1000; - let surfaceID = ''; - - let fileDescriptor = undefined; - let page = 0; - let fdHead = 'fd://'; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - await toNewPage(page); - page = (page + 1) % 2; - await msleep(1000).then(() => {}, failureCallback).catch(catchCallback); - surfaceID = globalThis.value; - console.info('case new surfaceID is ' + surfaceID); - console.info('beforeEach case'); - }) - - afterEach(async function() { - await clearRouter(); - sleep(5000); - console.info('afterEach case'); - }) - - afterAll(function() { - 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.error(`case error called, errMessage is ${error.message}`); - } - - function catchCallback(error) { - expect().assertFail(); - console.error(`case error called, errMessage is ${error.message}`); - } - - function printfDescription(obj) { - for(let i in obj) { - let property = obj[i]; - console.info(`case key is ${i}, value is ${property}`); - } - } - - async function playVideoSource(videoSource, done) { - console.info(`case media source videoSource: ${videoSource}`) - - await getFileDescriptor(videoSource).then((res) => { - fileDescriptor = res; - }); - isFileOpen(fileDescriptor, done); - - let videoPlayer = null; - surfaceID = globalThis.value; - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('case createVideoPlayer success'); - videoPlayer = video; - expect(videoPlayer.state).assertEqual('idle'); - } else { - console.error('case createVideoPlayer failed'); - expect().assertFail(); - } - }, failureCallback).catch(catchCallback); - - videoPlayer.on('error', (err) => { - console.error(`case error called, errMessage is ${err.message}`); - expect().assertFail(); - }); - videoPlayer.url = fdHead + fileDescriptor.fd; - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('case setDisplaySurface success'); - }, failureCallback).catch(catchCallback); - - await videoPlayer.prepare().then(() => { - console.info('case prepare called'); - expect(videoPlayer.state).assertEqual('prepared'); - }, failureCallback).catch(catchCallback); - - await videoPlayer.getTrackDescription().then((arrayList) => { - console.info('case getTrackDescription called'); - if (typeof (arrayList) != 'undefined') { - for (let i = 0; i < arrayList.length; i++) { - printfDescription(arrayList[i]); - } - } else { - console.error('case getTrackDescription failed'); - expect().assertFail(); - } - }, failureCallback).catch(catchCallback); - - let startTime = videoPlayer.currentTime; - await videoPlayer.play().then(() => { - console.info('case play called'); - expect(videoPlayer.state).assertEqual('playing'); - sleep(PLAY_TIME); - }, failureCallback).catch(catchCallback); - let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); - - await videoPlayer.seek(SEEK_TIME).then((seekDoneTime) => { - console.info('case seek called and seekDoneTime is ' + seekDoneTime); - expect(videoPlayer.state).assertEqual('playing'); - sleep(DELTA_TIME); - }, failureCallback).catch(catchCallback); - - await videoPlayer.pause().then(() => { - console.info('case pause called'); - expect(videoPlayer.state).assertEqual('paused'); - sleep(DELTA_TIME); - }, failureCallback).catch(catchCallback); - - await videoPlayer.play().then(() => { - console.info('case play called'); - expect(videoPlayer.state).assertEqual('playing'); - sleep(PLAY_TIME); - }, failureCallback).catch(catchCallback); - - await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X).then((speedMode) => { - console.info('case setSpeed called and speedMode is ' + speedMode); - expect(videoPlayer.state).assertEqual('playing'); - expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_2_00_X); - sleep(DELTA_TIME); - }, failureCallback).catch(catchCallback); - - await videoPlayer.setVolume(1).then(() => { - console.info('case setVolume called'); - expect(videoPlayer.state).assertEqual('playing'); - }, failureCallback).catch(catchCallback); - - await videoPlayer.stop().then(() => { - console.info('case stop called'); - expect(videoPlayer.state).assertEqual('stopped'); - }, failureCallback).catch(catchCallback); - - await videoPlayer.reset().then(() => { - console.info('case reset called'); - expect(videoPlayer.state).assertEqual('idle'); - }, failureCallback).catch(catchCallback); - - await videoPlayer.release().then(() => { - console.info('case release called'); - }, failureCallback).catch(catchCallback); - - await closeFileDescriptor(videoSource); - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_0900 - * @tc.name : play h264_none_audio.mp4 - * @tc.desc : h264_none_audio.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_0900', 0, async function (done) { - console.info('1') - let videoSource = 'h264_none_audio.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1100 - * @tc.name : play mpeg2_none_audio.mp4 - * @tc.desc : mpeg2_none_audio.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1100', 0, async function (done) { - let videoSource = 'mpeg2_none_audio.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1200 - * @tc.name : play mpeg4_none_audio.mp4 - * @tc.desc : mpeg4_none_audio.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1200', 0, async function (done) { - let videoSource = 'mpeg4_none_audio.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1300 - * @tc.name : play none_video_aac.mp4 - * @tc.desc : none_video_aac.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1300', 0, async function (done) { - let videoSource = 'none_video_aac.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1400 - * @tc.name : play none_video_mp3.mp4 - * @tc.desc : none_video_mp3.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1400', 0, async function (done) { - let videoSource = 'none_video_mp3.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1600 - * @tc.name : play h264_aac_720p_30r.mp4 - * @tc.desc : h264_aac_720p_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1600', 0, async function (done) { - let videoSource = 'h264_aac_720p_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1700 - * @tc.name : play h264_mp3_480p_25r.mp4 - * @tc.desc : h264_mp3_480p_25r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1700', 0, async function (done) { - let videoSource = 'h264_mp3_480p_25r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1800 - * @tc.name : play h264_mp3_270p_10r.mp4 - * @tc.desc : h264_mp3_270p_10r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_1800', 0, async function (done) { - let videoSource = 'h264_mp3_270p_10r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_2500 - * @tc.name : play h264_aac_320x240_30r.mp4 - * @tc.desc : h264_aac_320x240_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_2500', 0, async function (done) { - let videoSource = 'h264_aac_320x240_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_3000 - * @tc.name : play h264_mp3_480x320_30r.mp4 - * @tc.desc : h264_mp3_480x320_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_3000', 0, async function (done) { - let videoSource = 'h264_mp3_480x320_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_3700 - * @tc.name : play h264_aac_640x480_30r.mp4 - * @tc.desc : h264_aac_640x480_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_3700', 0, async function (done) { - let videoSource = 'h264_aac_640x480_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_3800 - * @tc.name : play h264_mp3_640x480_25r.mp4 - * @tc.desc : h264_mp3_640x480_25r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_3800', 0, async function (done) { - let videoSource = 'h264_mp3_640x480_25r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_7800 - * @tc.name : h264_none_audio_640x480_30r.mp4 - * @tc.desc : h264_none_audio_640x480_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_7800', 0, async function (done) { - let videoSource = 'h264_none_audio_640x480_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_7900 - * @tc.name : mpeg2_none_audio_640x480_30r.mp4 - * @tc.desc : mpeg2_none_audio_640x480_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_7900', 0, async function (done) { - let videoSource = 'mpeg2_none_audio_640x480_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_8000 - * @tc.name : mpeg4_none_audio_640x480_30r.mp4 - * @tc.desc : mpeg4_none_audio_640x480_30r.mp4 test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MP4_8000', 0, async function (done) { - let videoSource = 'mpeg4_none_audio_640x480_30r.mp4'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_0900 - * @tc.name : play h264_none_audio.ts - * @tc.desc : h264_none_audio.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_0900', 0, async function (done) { - let videoSource = 'h264_none_audio.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1100 - * @tc.name : play mpeg2_none_audio.ts - * @tc.desc : mpeg2_none_audio.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1100', 0, async function (done) { - let videoSource = 'mpeg2_none_audio.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1200 - * @tc.name : play mpeg4_none_audio.ts - * @tc.desc : mpeg4_none_audio.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1200', 0, async function (done) { - let videoSource = 'mpeg4_none_audio.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1300 - * @tc.name : play none_video_aac.ts - * @tc.desc : none_video_aac.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1300', 0, async function (done) { - let videoSource = 'none_video_aac.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1400 - * @tc.name : play none_video_mp3.ts - * @tc.desc : none_video_mp3.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1400', 0, async function (done) { - let videoSource = 'none_video_mp3.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1600 - * @tc.name : play h264_aac_720p_30r.ts - * @tc.desc : h264_aac_720p_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1600', 0, async function (done) { - let videoSource = 'h264_aac_720p_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1700 - * @tc.name : play h264_aac_480p_25r.ts - * @tc.desc : h264_aac_480p_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1700', 0, async function (done) { - let videoSource = 'h264_aac_480p_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1800 - * @tc.name : play h264_aac_270p_10r.ts - * @tc.desc : h264_aac_270p_10r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_1800', 0, async function (done) { - let videoSource = 'h264_aac_270p_10r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2000 - * @tc.name : play h264_mp3_720p_30r.ts - * @tc.desc : h264_mp3_720p_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2000', 0, async function (done) { - let videoSource = 'h264_mp3_720p_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2100 - * @tc.name : play h264_mp3_480p_25r.ts - * @tc.desc : h264_mp3_480p_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2100', 0, async function (done) { - let videoSource = 'h264_mp3_480p_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2200 - * @tc.name : play h264_mp3_270p_10r.ts - * @tc.desc : h264_mp3_270p_10r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2200', 0, async function (done) { - let videoSource = 'h264_mp3_270p_10r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2400 - * @tc.name : play mpeg2_aac_720p_30r.ts - * @tc.desc : mpeg2_aac_720p_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2400', 0, async function (done) { - let videoSource = 'mpeg2_aac_720p_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2500 - * @tc.name : play mpeg2_aac_480p_25r.ts - * @tc.desc : mpeg2_aac_480p_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2500', 0, async function (done) { - let videoSource = 'mpeg2_aac_480p_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2600 - * @tc.name : play mpeg2_aac_270p_10r.ts - * @tc.desc : mpeg2_aac_270p_10r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2600', 0, async function (done) { - let videoSource = 'mpeg2_aac_270p_10r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2800 - * @tc.name : play mpeg2_mp3_720p_30r.ts - * @tc.desc : mpeg2_mp3_720p_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2800', 0, async function (done) { - let videoSource = 'mpeg2_mp3_720p_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2900 - * @tc.name : play mpeg2_mp3_480p_25r.ts - * @tc.desc : mpeg2_mp3_480p_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_2900', 0, async function (done) { - let videoSource = 'mpeg2_mp3_480p_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3000 - * @tc.name : play mpeg2_mp3_270p_10r.ts - * @tc.desc : mpeg2_mp3_270p_10r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3000', 0, async function (done) { - let videoSource = 'mpeg2_mp3_270p_10r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3200 - * @tc.name : play mpeg4_aac_720p_30r.ts - * @tc.desc : mpeg4_aac_720p_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3200', 0, async function (done) { - let videoSource = 'mpeg4_aac_720p_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3300 - * @tc.name : play mpeg4_aac_480p_25r.ts - * @tc.desc : mpeg4_aac_480p_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3300', 0, async function (done) { - let videoSource = 'mpeg4_aac_480p_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3400 - * @tc.name : play mpeg4_aac_270p_10r.ts - * @tc.desc : mpeg4_aac_270p_10r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3400', 0, async function (done) { - let videoSource = 'mpeg4_aac_270p_10r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3600 - * @tc.name : play mpeg4_mp3_720p_30r.ts - * @tc.desc : mpeg4_mp3_720p_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3600', 0, async function (done) { - let videoSource = 'mpeg4_mp3_720p_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3700 - * @tc.name : play mpeg4_mp3_480p_25r.ts - * @tc.desc : mpeg4_mp3_480p_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3700', 0, async function (done) { - let videoSource = 'mpeg4_mp3_480p_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3800 - * @tc.name : play mpeg4_mp3_270p_10r.ts - * @tc.desc : mpeg4_mp3_270p_10r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3800', 0, async function (done) { - let videoSource = 'mpeg4_mp3_270p_10r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3900 - * @tc.name : play h264_none_audio_640x480_30r.ts - * @tc.desc : h264_none_audio_640x480_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_3900', 0, async function (done) { - let videoSource = 'h264_none_audio_640x480_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4000 - * @tc.name : play mpeg2_none_audio_640x480_30r.ts - * @tc.desc : mpeg2_none_audio_640x480_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4000', 0, async function (done) { - let videoSource = 'mpeg2_none_audio_640x480_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4100 - * @tc.name : play mpeg4_none_audio_640x480_30r.ts - * @tc.desc : mpeg4_none_audio_640x480_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4100', 0, async function (done) { - let videoSource = 'mpeg4_none_audio_640x480_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4200 - * @tc.name : play h264_aac_640x480_30r.ts - * @tc.desc : h264_aac_640x480_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4200', 0, async function (done) { - let videoSource = 'h264_aac_640x480_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4300 - * @tc.name : play h264_mp3_640x480_25r.ts - * @tc.desc : h264_mp3_640x480_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4300', 0, async function (done) { - let videoSource = 'h264_mp3_640x480_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4400 - * @tc.name : play mpeg2_aac_640x480_30r.ts - * @tc.desc : mpeg2_aac_640x480_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4400', 0, async function (done) { - let videoSource = 'mpeg2_aac_640x480_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4500 - * @tc.name : play mpeg2_mp3_640x480_25r.ts - * @tc.desc : mpeg2_mp3_640x480_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4500', 0, async function (done) { - let videoSource = 'mpeg2_mp3_640x480_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4600 - * @tc.name : play mpeg4_aac_640x480_30r.ts - * @tc.desc : mpeg4_aac_640x480_30r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4600', 0, async function (done) { - let videoSource = 'mpeg4_aac_640x480_30r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4700 - * @tc.name : play mpeg4_mp3_640x480_25r.ts - * @tc.desc : mpeg4_mp3_640x480_25r.ts test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_TS_4700', 0, async function (done) { - let videoSource = 'mpeg4_mp3_640x480_25r.ts'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0200 - * @tc.name : play vp8_none_audio.webm - * @tc.desc : vp8_none_audio.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0200', 0, async function (done) { - let videoSource = 'vp8_none_audio.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0300 - * @tc.name : play none_video_vorbis.webm - * @tc.desc : none_video_vorbis.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0300', 0, async function (done) { - let videoSource = 'none_video_vorbis.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0500 - * @tc.name : play vp8_vorbis_720p_30r.webm - * @tc.desc : vp8_vorbis_720p_30r.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0500', 0, async function (done) { - let videoSource = 'vp8_vorbis_720p_30r.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0600 - * @tc.name : play vp8_vorbis_480p_25r.webm - * @tc.desc : vp8_vorbis_480p_25r.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0600', 0, async function (done) { - let videoSource = 'vp8_vorbis_480p_25r.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0700 - * @tc.name : play vp8_vorbis_270p_10r.webm - * @tc.desc : vp8_vorbis_270p_10r.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0700', 0, async function (done) { - let videoSource = 'vp8_vorbis_270p_10r.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0800 - * @tc.name : play vp8_none_audio_640x480_30r.webm - * @tc.desc : vp8_none_audio_640x480_30r.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0800', 0, async function (done) { - let videoSource = 'vp8_none_audio_640x480_30r.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0900 - * @tc.name : play vp8_vorbis_640x480_25r.webm - * @tc.desc : vp8_vorbis_640x480_25r.webm test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_WEBM_0900', 0, async function (done) { - let videoSource = 'vp8_vorbis_640x480_25r.webm'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_0900 - * @tc.name : play h264_none_audio.mkv - * @tc.desc : h264_none_audio.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_0900', 0, async function (done) { - let videoSource = 'h264_none_audio.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1100 - * @tc.name : play mpeg2_none_audio.mkv - * @tc.desc : mpeg2_none_audio.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1100', 0, async function (done) { - let videoSource = 'mpeg2_none_audio.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1200 - * @tc.name : play mpeg4_none_audio.mkv - * @tc.desc : mpeg4_none_audio.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1200', 0, async function (done) { - let videoSource = 'mpeg4_none_audio.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1300 - * @tc.name : play none_video_aac.mkv - * @tc.desc : none_video_aac.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1300', 0, async function (done) { - let videoSource = 'none_video_aac.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1400 - * @tc.name : play none_video_mp3.mkv - * @tc.desc : none_video_mp3.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_1400', 0, async function (done) { - let videoSource = 'none_video_mp3.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2000 - * @tc.name : play mpeg4_aac_720p_30r.mkv - * @tc.desc : mpeg4_aac_720p_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2000', 0, async function (done) { - let videoSource = 'mpeg4_aac_720p_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2100 - * @tc.name : play mpeg4_aac_480p_25r.mkv - * @tc.desc : mpeg4_aac_480p_25r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2100', 0, async function (done) { - let videoSource = 'mpeg4_aac_480p_25r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2200 - * @tc.name : play mpeg4_aac_270p_10r.mkv - * @tc.desc : mpeg4_aac_270p_10r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2200', 0, async function (done) { - let videoSource = 'mpeg4_aac_270p_10r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2300 - * @tc.name : play h264_none_audio_640x480_30r.mkv - * @tc.desc : h264_none_audio_640x480_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2300', 0, async function (done) { - let videoSource = 'h264_none_audio_640x480_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2400 - * @tc.name : play h263_none_audio_640x480_30r.mkv - * @tc.desc : h263_none_audio_640x480_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2400', 0, async function (done) { - let videoSource = 'h263_none_audio_640x480_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2500 - * @tc.name : play mpeg2_none_audio_640x480_30r.mkv - * @tc.desc : mpeg2_none_audio_640x480_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2500', 0, async function (done) { - let videoSource = 'mpeg2_none_audio_640x480_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2600 - * @tc.name : play mpeg4_none_audio_640x480_30r.mkv - * @tc.desc : mpeg4_none_audio_640x480_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2600', 0, async function (done) { - let videoSource = 'mpeg4_none_audio_640x480_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2700 - * @tc.name : play h263_aac_640x480_30r.mkv - * @tc.desc : h263_aac_640x480_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_2700', 0, async function (done) { - let videoSource = 'h263_aac_640x480_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_3100 - * @tc.name : play mpeg4_aac_640x480_30r.mkv - * @tc.desc : mpeg4_aac_640x480_30r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_3100', 0, async function (done) { - let videoSource = 'mpeg4_aac_640x480_30r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_3200 - * @tc.name : play mpeg4_aac_270p_25r.mkv - * @tc.desc : mpeg4_aac_270p_25r.mkv test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_PLAYER_FORMAT_MKV_3200', 0, async function (done) { - let videoSource = 'mpeg4_aac_270p_25r.mkv'; - await playVideoSource(videoSource, done); - done(); - }) - -}) - diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js index 9cffa5dc89ac6efe6d7bbbb1ebf4622d08b0da80..6614e65dcabade51ef12b4ab84fff6dbb0bfd8a1 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js @@ -14,7 +14,7 @@ */ import media from '@ohos.multimedia.media' -import {toNewPage, clearRouter} from './VideoPlayerTestBase.js'; +import {toNewPage, clearRouter} from '../../../../../VideoPlayerTestBase.js'; import * as mediaTestBase from '../../../../../MediaTestBase.js'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' @@ -52,7 +52,9 @@ describe('VideoPlayerFuncCallbackTest', function () { let surfaceID = ''; let fdHead = 'fd://'; let fileDescriptor = undefined; - let page = 0; + const pagePath1 = 'pages/surfaceTest/surfaceTest'; + const pagePath2 = 'pages/surfaceTest2/surfaceTest2'; + let pageId = 0; let events = require('events'); let eventEmitter = new events.EventEmitter(); @@ -64,8 +66,8 @@ describe('VideoPlayerFuncCallbackTest', function () { }) beforeEach(async function() { - await toNewPage(page); - page = (page + 1) % 2; + await toNewPage(pagePath1, pagePath2, pageId); + pageId = (pageId + 1) % 2; await mediaTestBase.msleepAsync(1000).then( () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); surfaceID = globalThis.value; diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js index 32386471e89952a027a188a1b955c4135c7693a6..4edb0d64825d54cda241396b11b5229d61b3e0d8 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js @@ -14,7 +14,7 @@ */ import media from '@ohos.multimedia.media' -import {toNewPage, clearRouter} from './VideoPlayerTestBase.js'; +import {toNewPage, clearRouter} from '../../../../../VideoPlayerTestBase.js'; import * as mediaTestBase from '../../../../../MediaTestBase.js'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' @@ -32,7 +32,9 @@ describe('VideoPlayerFuncPromiseTest', function () { let surfaceID = ''; let fdHead = 'fd://'; let fileDescriptor = undefined; - let page = 0; + const pagePath1 = 'pages/surfaceTest/surfaceTest'; + const pagePath2 = 'pages/surfaceTest2/surfaceTest2'; + let pageId = 0; beforeAll(async function() { console.info('beforeAll case'); @@ -42,8 +44,8 @@ describe('VideoPlayerFuncPromiseTest', function () { }) beforeEach(async function() { - await toNewPage(page); - page = (page + 1) % 2; + await toNewPage(pagePath1, pagePath2, pageId); + pageId = (pageId + 1) % 2; await mediaTestBase.msleepAsync(1000).then( () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); surfaceID = globalThis.value; diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js deleted file mode 100644 index e1c67d344c5d59918436d7c47fd7b1d9193243f1..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import router from '@system.router' - -export async function toNewPage(page) { - let path = ''; - if (page == 0) { - path = 'pages/surfaceTest/surfaceTest'; - } else { - path = 'pages/surfaceTest2/surfaceTest2'; - } - let options = { - uri: path, - } - try { - await router.push(options); - } catch { - console.info('case route failed'); - } -} - -export async function clearRouter() { - await router.clear(); -}