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 2c310dd4652055a01d1207759e6856efb1abe7b8..2e098c633fdda15cc200be4fc1fba74cd4a49ea6 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 @@ -37,10 +37,5 @@ 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 566069169c32795d25839b222fc2df71168c5960..8104aaa8c9a2e1d0070b673c40817aafa18bbaea 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 @@ -833,58 +833,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 39421a4a2e23be2a94be6ea1b82e31bc1aa0ab78..ed46974b5fa86241a9987493204f96537ab4fdeb 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 @@ -760,50 +760,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 f92d9ed33a400f6a1833c31039495af05871b3db..0000000000000000000000000000000000000000 --- 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 a2e9c90524bb3a8a7e9cd0f9ccf3b5d83caea06e..0000000000000000000000000000000000000000 --- 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 a72b3e65ff3158f06c262414cc5f59c31f25d14d..0000000000000000000000000000000000000000 --- 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 47138105b641ff08e5ad39e5bbafc018539b2684..0000000000000000000000000000000000000000 --- 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 bc8fe53804d545989e7a48b8b5e936ea735ab6bb..0000000000000000000000000000000000000000 --- 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 be6769596f77dacf0f14d71fafad124289d3a2c4..0000000000000000000000000000000000000000 --- 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 244adfb2565055ff076cf8c1fc6095c808c9b792..0000000000000000000000000000000000000000 --- 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 d76d5f3b4e997ea06fc48948edd14ac6a113d3ab..fc4f79a122f30fd83e8ff785b9238bb9335aba2b 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 @@ -648,81 +648,6 @@ describe('mediaLibraryTestCallBack.test.js', function () { done(); } }); - - /** - * @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 157bf36b18ca2748a01d7e73c6fcfd0b149ebc58..adc48c1fd3c07fb5daf311c04d9ae2002db22c52 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 @@ -662,66 +662,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