未验证 提交 ecf375f2 编写于 作者: O openharmony_ci 提交者: Gitee

!3089 【媒体子系统】SystemApi用例迁移

Merge pull request !3089 from tongtongdad/OpenHarmony-3.1-Release
......@@ -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')
......@@ -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
......
......@@ -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 -------------------------
});
/*
* 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
/*
* 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
/*
* 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
/*
* 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
/*
* 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
/*
* 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
/*
* 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
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册