From 1e70550a0b51ceb5deb5fd6277c82db96d60cb50 Mon Sep 17 00:00:00 2001 From: tongtongdad Date: Thu, 28 Apr 2022 11:02:01 +0800 Subject: [PATCH] Signed-off-by: tongtongdad --- .../src/main/js/test/List.test.js | 6 - .../main/js/test/albumTestCallBack.test.js | 52 --- .../src/main/js/test/albumTestPromise.test.js | 46 --- .../src/main/js/test/distributed.test.js | 93 ------ .../main/js/test/distributedCallback.test.js | 97 ------ .../main/js/test/distributedPromise.test.js | 91 ------ .../getAllPeersDeviceTestCallback.test.js | 241 -------------- .../test/getAllPeersDeviceTestPromise.test.js | 179 ---------- .../js/test/getAllPeersTestCallback.test.js | 307 ------------------ .../js/test/getAllPeersTestPromise.test.js | 242 -------------- .../js/test/mediaLibraryTestCallBack.test.js | 74 ----- .../js/test/mediaLibraryTestPromise.test.js | 60 ---- 12 files changed, 1488 deletions(-) delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributed.test.js delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedCallback.test.js delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedPromise.test.js delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestCallback.test.js delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestPromise.test.js delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestCallback.test.js delete mode 100644 multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestPromise.test.js diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js index 814da949e..91c740736 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js @@ -36,10 +36,4 @@ require('./mediaLibraryTestPromise.test.js') require('./albumTestCallBack.test.js') require('./albumTestPromise.test.js') //require('./mediaLibraryTestPromiseOnOff.test.js') -require('./getAllPeersDeviceTestCallback.test.js') -require('./getAllPeersDeviceTestPromise.test.js') -require('./getAllPeersTestCallback.test.js') -require('./getAllPeersTestPromise.test.js') -require('./distributedCallback.test.js') -require('./distributedPromise.test.js') diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js index 432c3cea1..94a456641 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestCallBack.test.js @@ -832,58 +832,6 @@ describe('albumTestCallBack.test.js', async function () { }); // ------------------------------ 004 test end ------------------------- - // ------------------------------ 005 test start ------------------------- - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_005_01 - * @tc.name : deleteAsset - * @tc.desc : delete album - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_005_01', 0, async function (done) { - try { - const albumList = await media.getAlbums(albumDeletefetchOp); - - const album = albumList[0]; - let fetchFileResult = await album.getFileAssets(allTypefetchOp); - - let datas = await fetchFileResult.getAllObject(); - - const assetsLength = datas.length; - - for (let j = 0; j < assetsLength; j++) { - const asset = datas[j]; - if (j == assetsLength - 1) { - media.deleteAsset(asset.uri, async () => { - const albumId = album.albumId; - const newAlbumList = await media.getAlbums(allTypefetchOp); - - for (let i = 0; i < newAlbumList.length; i++) { - const album = newAlbumList[i]; - if (album.albumId == albumId) { - console.info('ALBUM_CALLBACK getAlbum 005_01 failed'); - expect(false).assertTrue(); - done(); - } - } - console.info('ALBUM_CALLBACK getAlbum 005_01 passed'); - expect(true).assertTrue(); - done(); - }); - } else { - await media.deleteAsset(asset.uri); - } - } - } catch (error) { - console.info('ALBUM_CALLBACK getAlbum 005_01 failed, message = ' + error); - expect(false).assertTrue(); - done(); - } - }); - // ------------------------------ 005 test end ------------------------- - // ------------------------------ 006 test start ------------------------- /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_01 diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js index dc848e170..ca8f34006 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js @@ -747,50 +747,4 @@ describe('albumTestPromise.test.js', async function () { done(); }); // ------------------------------ 006 test end ------------------------- - - // ------------------------------ 005 test start ------------------------- - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_005_01 - * @tc.name : deleteAsset - * @tc.desc : delete album - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_005_01', 0, async function (done) { - try { - const albumList = await media.getAlbums(albumDeletefetchOp); - - const album = albumList[0]; - let fetchFileResult = await album.getFileAssets(allTypefetchOp); - - let datas = await fetchFileResult.getAllObject(); - - for (let j = 0; j < datas.length; j++) { - const asset = datas[j]; - await media.deleteAsset(asset.uri); - } - - const albumId = album.albumId; - const newAlbumList = await media.getAlbums(allTypefetchOp); - - for (let i = 0; i < newAlbumList.length; i++) { - const album = newAlbumList[i]; - if (album.albumId == albumId) { - console.info('ALBUM_PROMISE getAlbum 005_01 failed'); - expect(false).assertTrue(); - done(); - } - } - console.info('ALBUM_PROMISE getAlbum 005_01 passed'); - expect(true).assertTrue(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE getAlbum 005_01 failed, message = ' + error); - expect(false).assertTrue(); - done(); - } - }); - // ------------------------------ 005 test end ------------------------- }); diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributed.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributed.test.js deleted file mode 100644 index f92d9ed33..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributed.test.js +++ /dev/null @@ -1,93 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility' -import image from '@ohos.multimedia.image'; - -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} from 'deccjsunit/index' -describe('distributed.promise.test.js', function () { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function () { - onsole.info('Distributed. Promise MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.'); - - }) - - beforeEach(function () { - console.info('Distributed. Promise MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.'); - - }) - afterEach(function () { - console.info('Distributed. Promise MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.'); - - }) - afterAll(function () { - console.info('Distributed. Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed'); - - }) - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_distributed_001_01 - * @tc.name : getActivePeers - * @tc.desc : getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01', 0, async function (done) { - try { - done(); - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 begin'); - let peers = await media.getActivePeers(); - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 done'); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 fail, message = ' + error); - done(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02 - * @tc.name : getAllPeers - * @tc.desc : getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02', 0, async function (done) { - try { - done(); - let peers = await media.getAllPeers(); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02 fail, message = ' + error); - done(); - } - done(); - }); -}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedCallback.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedCallback.test.js deleted file mode 100644 index a2e9c9052..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedCallback.test.js +++ /dev/null @@ -1,97 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility' -import image from '@ohos.multimedia.image'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -describe('distributedCallback.test.js', function() { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function() { - onsole.info( - 'Distributed. Callback MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.'); - }) - - beforeEach(function() { - console.info( - 'Distributed. Callback MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.'); - }) - afterEach(function() { - console.info( - 'Distributed. Callback MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.'); - }) - afterAll(function() { - console.info( - 'Distributed. Callback MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed'); - }) - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 - * @tc.name : getActivePeers - * @tc.desc : getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01', 0, async function(done) { - expect(true).assertTrue(); - done(); - return; - try { - done(); - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 begin'); - media.getActivePeers((error, peers) => { - expect(error == undefined).assertTrue(); - }); - done(); - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 done'); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_01 fail, message = ' - + error); - done(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_02 - * @tc.name : getAllPeers - * @tc.desc : getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_02', 0, async function(done) { - expect(true).assertTrue(); - done(); - return; - try { - done(); - media.getAllPeers((error, peers) => { - expect(error == undefined).assertTrue(); - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_CALLBACK_001_02 fail, message = ' - + error); - done(); - } - done(); - }); -}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedPromise.test.js deleted file mode 100644 index a72b3e65f..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/distributedPromise.test.js +++ /dev/null @@ -1,91 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility' -import image from '@ohos.multimedia.image'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -describe('distributedPromise.test.js', function() { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function() { - onsole.info( - 'Distributed. Promise MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.'); - }) - - beforeEach(function() { - console.info( - 'Distributed. Promise MediaLibraryTest: beforeEach:Prerequisites at the test case level, which are executed before each test case is executed.'); - }) - afterEach(function() { - console.info( - 'Distributed. Promise MediaLibraryTest: afterEach: Test case-level clearance conditions, which are executed after each test case is executed.'); - }) - afterAll(function() { - console.info( - 'Distributed. Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed'); - }) - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_distributed_001_01 - * @tc.name : getActivePeers - * @tc.desc : getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01', 0, async function(done) { - expect(true).assertTrue(); - done(); - return; - try { - done(); - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 begin'); - let peers = await media.getActivePeers(); - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 done'); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_01 fail, message = ' + error); - done(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02 - * @tc.name : getAllPeers - * @tc.desc : getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02', 0, async function(done) { - expect(true).assertTrue(); - done(); - return; - try { - done(); - let peers = await media.getAllPeers(); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_DISTRIBUTED_001_02 fail, message = ' + error); - done(); - } - done(); - }); -}) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestCallback.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestCallback.test.js deleted file mode 100644 index 47138105b..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestCallback.test.js +++ /dev/null @@ -1,241 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('getAllPeersDeviceTestCallback.test.js', function() { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function() {}); - beforeEach(function() {}); - afterEach(function() {}); - afterAll(function() {}); - - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02 begin'); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_UNKNOWN).assertEqual(0); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_LAPTOP - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_01', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_LAPTOP).assertEqual(1); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_02 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_PHONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_02', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_PHONE).assertEqual(2); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_03 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_TABLET - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_03', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_TABLET).assertEqual(3); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_04 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_WATCH - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_04', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_WATCH).assertEqual(4); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_05 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_CAR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_05', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_CAR).assertEqual(5); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_06 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_TV - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_CALLBACK_001_02_06', 0, async function(done) { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - expect(allPeerList[1].DeviceType.TYPE_TV).assertEqual(6); - done(); - } - }); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_06 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer networkId - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_NETWORKID_CALLBACK_001_02', 0, async function(done) { - try { - done(); - media.getActivePeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - networkId = allPeerList[0].networkId; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_01 peer.networkId = ' - + networkId); - done(); - } - }); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_06 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer isOnline - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_NETWORKID_ISONLINE_CALLBACK_001_02', 0, async function(done) { - try { - done(); - media.getActivePeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - isOnline = allPeerList[0].isOnline; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_01 peer.isOnline = ' + isOnline); - done(); - } - }); - done(); - } catch (error) { - done(); - } - }); -}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestPromise.test.js deleted file mode 100644 index bc8fe5380..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersDeviceTestPromise.test.js +++ /dev/null @@ -1,179 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('getAllPeersDeviceTestPromise.test.js', function() { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function() {}); - beforeEach(function() {}); - afterEach(function() {}); - afterAll(function() {}); - - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02 begin'); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_UNKNOWN).assertEqual(0); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_LAPTOP - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_01', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_LAPTOP).assertEqual(1); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_02 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_PHONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_02', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_PHONE).assertEqual(2); - - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_03 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_TABLET - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_03', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_TABLET).assertEqual(3); - - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_04 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_WATCH - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_04', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_WATCH).assertEqual(4); - - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_05 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_CAR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_05', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_CAR).assertEqual(5); - - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_06 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer device information TYPE_TV - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_06', 0, async function(done) { - done(); - let allPeerList = await media.getAllPeers(); - expect(allPeerList[1].DeviceType.TYPE_TV).assertEqual(6); - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_06 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer networkId - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_NETWORKID_PROMISE_001_02', 0, async function(done) { - try { - done(); - let allPeerList = await media.getActivePeers(); - networkId = allPeerList[0].networkId; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_01 peer.networkId = ' + networkId); - } catch (error) { - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_DEVICETYPE_PROMISE_001_02_06 - * @tc.name : getActivePeers - * @tc.desc : Get Active Peer isOnline - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_NETWORKID_ISONLINE_PROMISE_001_02', 0, async function(done) { - try { - done(); - let allPeerList = await media.getActivePeers(); - isOnline = allPeerList[0].isOnline; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_01 peer.isOnline = ' + isOnline); - } catch (error) { - done(); - } - }); -}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestCallback.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestCallback.test.js deleted file mode 100644 index be6769596..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestCallback.test.js +++ /dev/null @@ -1,307 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('getAllPeersTestCallback.test.js', function() { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function() {}); - beforeEach(function() {}); - afterEach(function() {}); - afterAll(function() {}); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_01 - * @tc.name : getAllPeers - * @tc.desc : getAllPeers device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_01', 0, async function(done) { - try { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_01 peer.deviceName = ' - + peer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_01 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_02 - * @tc.name : getAllPeers - * @tc.desc : get the first peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_02', 0, async function(done) { - try { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - peer = allPeerList[0]; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_02 peer.deviceName = ' - + peer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_02 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_03 - * @tc.name : getAllPeers - * @tc.desc : get the second peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_03', 0, async function(done) { - try { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - peer = allPeerList[1]; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_03 peer.deviceName = ' - + peer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_03 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_04 - * @tc.name : getAllPeers - * @tc.desc : get the third peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_04', 0, async function(done) { - try { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - peer = allPeerList[2]; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_04 peer.deviceName = ' - + peer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_04 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_04 - * @tc.name : getAllPeers - * @tc.desc : get the forth peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_05', 0, async function(done) { - try { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - peer = allPeerList[3]; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_05 peer.deviceName = ' - + peer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_05 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_04 - * @tc.name : getAllPeers - * @tc.desc : get the fifth peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_CALLBACK_001_06', 0, async function(done) { - try { - done(); - media.getAllPeers((error, allPeerList) => { - if (allPeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - peer = allPeerList[4]; - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_06 peer.deviceName = ' - + peer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_CALLBACK getAllPeers 001_06 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_01 - * @tc.name : getActivePeers - * @tc.desc : get the first peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_01', 0, async function(done) { - try { - done(); - media.getActivePeers((error, activePeerList) => { - if (activePeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - activePeer = activePeerList[0]; - console.info( - 'MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_01 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_01 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_02 - * @tc.name : getActivePeers - * @tc.desc : get the second peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_02', 0, async function(done) { - try { - done(); - media.getActivePeers((error, activePeerList) => { - if (activePeerList == undefined) { - expect(false).assertTrue(); - done(); - } else { - activePeer = activePeerList[1]; - console.info( - 'MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_02 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } - }); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_02 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_03 - * @tc.name : getActivePeers - * @tc.desc : get the third peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_03', 0, async function(done) { - try { - done(); - let activePeerList = await media.getActivePeers(); - activePeer = activePeerList[2]; - console.info('MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_03 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_03 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_04 - * @tc.name : getActivePeers - * @tc.desc : get the forth peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_CALLBACK_001_04', 0, async function(done) { - try { - done(); - let activePeerList = await media.getActivePeers(); - activePeer = activePeerList[3]; - console.info('MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_04 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_CALLBACK getActivePeers 001_04 fail, message = ' + error); - done(); - } - }); -}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestPromise.test.js deleted file mode 100644 index 244adfb25..000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/getAllPeersTestPromise.test.js +++ /dev/null @@ -1,242 +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 mediaLibrary from '@ohos.multimedia.medialibrary'; -import featureAbility from '@ohos.ability.featureAbility'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('getAllPeersTestPromise.test.js', function() { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function() {}); - beforeEach(function() {}); - afterEach(function() {}); - afterAll(function() {}); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_01 - * @tc.name : getAllPeers - * @tc.desc : getAllPeers device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_01', 0, async function(done) { - try { - done(); - let allPeerList = await media.getAllPeers(); - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_01 peer.deviceName = ' + peer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_01 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_02 - * @tc.name : getAllPeers - * @tc.desc : get the first peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_02', 0, async function(done) { - try { - done(); - let allPeerList = await media.getAllPeers(); - peer = allPeerList[0]; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_02 peer.deviceName = ' + peer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_02 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_03 - * @tc.name : getAllPeers - * @tc.desc : get the second peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_03', 0, async function(done) { - try { - done(); - let allPeerList = await media.getAllPeers(); - peer = allPeerList[1]; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_03 peer.deviceName = ' + peer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_03 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_04 - * @tc.name : getAllPeers - * @tc.desc : get the third peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_04', 0, async function(done) { - try { - done(); - let allPeerList = await media.getAllPeers(); - peer = allPeerList[2]; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_04 peer.deviceName = ' + peer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_04 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_04 - * @tc.name : getAllPeers - * @tc.desc : get the forth peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_05', 0, async function(done) { - try { - done(); - let allPeerList = await media.getAllPeers(); - peer = allPeerList[3]; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_05 peer.deviceName = ' + peer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_05 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_04 - * @tc.name : getAllPeers - * @tc.desc : get the fifth peers by getAllPeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ALL_PEER_PROMISE_001_06', 0, async function(done) { - try { - done(); - let allPeerList = await media.getAllPeers(); - peer = allPeerList[4]; - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_06 peer.deviceName = ' + peer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ALL_PEER_PROMISE getAllPeers 001_06 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_01 - * @tc.name : getActivePeers - * @tc.desc : get the first peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_01', 0, async function(done) { - try { - done(); - let activePeerList = await media.getActivePeers(); - activePeer = activePeerList[0]; - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_01 activePeer.deviceName = ' - + activePeer.deviceName); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_01 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_02 - * @tc.name : getActivePeers - * @tc.desc : get the second peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_02', 0, async function(done) { - try { - done(); - let activePeerList = await media.getActivePeers(); - activePeer = activePeerList[1]; - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_02 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_02 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_03 - * @tc.name : getActivePeers - * @tc.desc : get the third peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_03', 0, async function(done) { - try { - done(); - let activePeerList = await media.getActivePeers(); - activePeer = activePeerList[2]; - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_03 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_03 fail, message = ' + error); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_04 - * @tc.name : getActivePeers - * @tc.desc : get the forth peers by getActivePeers - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_ACTIVE_PEER_PROMISE_001_04', 0, async function(done) { - try { - done(); - let activePeerList = await media.getActivePeers(); - activePeer = activePeerList[3]; - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_04 activePeer.deviceName = ' - + activePeer.deviceName); - done(); - } catch (error) { - console.info('MediaLibraryTest : ACTIVE_PEER_PROMISE getActivePeers 001_04 fail, message = ' + error); - done(); - } - }); -}); \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestCallBack.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestCallBack.test.js index 34b7efd38..a3a98826d 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestCallBack.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestCallBack.test.js @@ -508,80 +508,6 @@ describe('mediaLibraryTestCallBack.test.js', function () { } }); - /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_DELETEASSET_001 - * @tc.name : deleteAsset - * @tc.desc : Delete File by Asset uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_DELETEASSET_001', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const dataList = await fetchFileResult.getAllObject(); - const asset1 = dataList[0]; - const delUri = asset1.uri; - - media.deleteAsset(asset1.uri, async () => { - const fetchFileResult1 = await media.getFileAssets(imagesfetchOp); - const dataList1 = await fetchFileResult1.getAllObject(); - - let passed = true; - for (let i = 0; i < dataList1.length; i++) { - const asset = dataList1[i]; - if (asset.uri == delUri) { - passed = false; - } - } - expect(passed).assertTrue(); - done(); - }); - } catch (error) { - console.info(`MediaLibraryTest : deleteAsset 001 failed, error: ${error}`); - expect(false).assertTrue(); - done(); - } - }); - - - - /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_DELETEASSET_002 - * @tc.name : deleteAsset - * @tc.desc : Delete File Asset by aaaa + uri + aaaaa - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_DELETEASSET_002', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const dataList = await fetchFileResult.getAllObject(); - const asset1 = dataList[0]; - const delUri = asset1.uri; - - await media.deleteAsset('aaaa' + asset1.uri + 'aaaa', async () => { - const fetchFileResult1 = await media.getFileAssets(imagesfetchOp); - const dataList1 = await fetchFileResult1.getAllObject(); - - let passed = false; - for (let i = 0; i < dataList1.length; i++) { - const asset = dataList1[i]; - if (asset.uri == delUri) { - passed = true; - } - } - expect(passed).assertTrue(); - done(); - }); - } catch (error) { - console.info(`MediaLibraryTest : deleteAsset 002 failed, error: ${error}`); - expect(false).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_009 * @tc.name : createAsset diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestPromise.test.js b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestPromise.test.js index a808f6e52..159a4b182 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestPromise.test.js +++ b/multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestPromise.test.js @@ -520,66 +520,6 @@ describe('mediaLibraryTestPromise.test.js', function () { } }); - /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_DELETEASSET_001 - * @tc.name : deleteAsset - * @tc.desc : Delete File by Asset uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_DELETEASSET_001', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const dataList = await fetchFileResult.getAllObject(); - const asset1 = dataList[0]; - const delUri = asset1.uri; - - await media.deleteAsset(asset1.uri); - - const fetchFileResult1 = await media.getFileAssets(imagesfetchOp); - const dataList1 = await fetchFileResult1.getAllObject(); - - let passed = true; - for (let i = 0; i < dataList1.length; i++) { - const asset = dataList1[i]; - if (asset.uri == delUri) { - passed = false; - } - } - expect(passed).assertTrue(); - done(); - } catch (error) { - console.info(`MediaLibraryTest : deleteAsset 001 failed, error: ${error}`); - expect(false).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_DELETEASSET_002 - * @tc.name : deleteAsset - * @tc.desc : Delete File Asset by aaaa + uri + aaaaa - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_DELETEASSET_002', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const dataList = await fetchFileResult.getAllObject(); - const asset1 = dataList[0]; - await media.deleteAsset('aaaa' + asset1.uri + 'aaaa'); - console.info('MediaLibraryTest : deleteAsset 002 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : deleteAsset 002 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001 * @tc.name : createAsset -- GitLab