提交 88d7a482 编写于 作者: Y yangbo

update xts

Signed-off-by: Nyangbo <yangbo258@h-partners.com>
上级 a2b944fd
......@@ -13,10 +13,11 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
const presetsCount = {
ActsUserFileMgrAlbumJsTest: { albumsCount: 3, assetsCount: 3 },
......@@ -24,13 +25,14 @@ const presetsCount = {
ActsUserFileMgrFileAssetJsTest: { albumsCount: 45, assetsCount: 87 },
}
const IMAGE_TYPE = userfile_manager.MediaType.IMAGE;
const VIDEO_TYPE = userfile_manager.MediaType.VIDEO;
const AUDIO_TYPE = userfile_manager.MediaType.AUDIO;
const IMAGE_TYPE = userFileManager.FileType.IMAGE;
const VIDEO_TYPE = userFileManager.FileType.VIDEO;
const AUDIO_TYPE = userFileManager.FileType.AUDIO;
const AUDIOKEY = userfile_manager.AudioKey;
const IMAGEVIDEOKEY = userfile_manager.ImageVideoKey;
const ALBUMKEY = userfile_manager.AlbumKey;
const AUDIOKEY = userFileManager.AudioKey;
const IMAGEVIDEOKEY = userFileManager.ImageVideoKey;
const ALBUMKEY = userFileManager.AlbumKey;
const FILEKEY = mediaLibrary.FileKey;
const sleep = async function sleep(times) {
if (times == undefined) {
times = 10
......@@ -41,60 +43,65 @@ const sleep = async function sleep(times) {
const allFetchOp = function () {
let predicates = new dataSharePredicates.DataSharePredicates();
return {
fetchColumns: [],
predicates: predicates
};
}
const audioFetchOps = function (testNum, path) {
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(AUDIOKEY.RELATIVE_PATH, path);
predicates.equalTo(FILEKEY.RELATIVE_PATH, path);
let ops = {
fetchColumns: [],
predicates: predicates
};
console.info(`${testNum} queryOps: relative_path = ${path}`);
console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path}`);
return ops
}
const imageVideoFetchOps = function (testNum, path) {
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(IMAGEVIDEOKEY.RELATIVE_PATH, path);
predicates.equalTo(FILEKEY.RELATIVE_PATH, path);
let ops = {
fetchColumns: [],
predicates: predicates
};
console.info(`${testNum} queryOps: relative_path = ${path}`);
console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path}`);
return ops
}
const audioNameFetchOps = function (testNum, path, displayName) {
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(AUDIOKEY.RELATIVE_PATH, path)
predicates.equalTo(FILEKEY.RELATIVE_PATH, path)
.equalTo(AUDIOKEY.DISPLAY_NAME, displayName);
let ops = {
fetchColumns: [],
predicates: predicates
};
console.info(`${testNum} queryOps: relative_path = ${path} AND display_name = ${displayName}`);
console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND display_name = ${displayName}`);
return ops
}
const imageVideoNameFetchOps = function (testNum, path, displayName) {
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(IMAGEVIDEOKEY.RELATIVE_PATH, path)
predicates.equalTo(FILEKEY.RELATIVE_PATH, path)
.equalTo(IMAGEVIDEOKEY.DISPLAY_NAME, displayName);
let ops = {
fetchColumns: [],
predicates: predicates
};
console.info(`${testNum} queryOps: relative_path = ${path} AND display_name = ${displayName}`);
console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND display_name = ${displayName}`);
return ops
}
const albumFetchOps = function (testNum, path, albumName) {
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(ALBUMKEY.RELATIVE_PATH, path)
predicates.equalTo(FILEKEY.RELATIVE_PATH, path)
.equalTo("bucket_display_name", albumName);
let ops = {
predicates: predicates
};
console.info(`${testNum} queryOps: relative_path = ${path} AND bucket_display_name = ${albumName}`);
console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND bucket_display_name = ${albumName}`);
return ops
}
......
......@@ -14,7 +14,7 @@
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}",
"mkdir -pv /storage/media/100/local/files/Pictures",
"mkdir -p /storage/media/100/local/temp"
]
},
......@@ -23,21 +23,15 @@
"pre-push": [
],
"push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp"
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp"
]
},
{
"type": "ShellKit",
"run-command": [
"mkdir -pv /storage/media/100/local/files/Pictures/{Static,DynamicCb,DynamicPro}",
"mkdir -pv /storage/media/100/local/files/Audios/{Static,DynamicCb,DynamicPro}",
"mkdir -pv /storage/media/100/local/files/Videos/{Static,DynamicCb,DynamicPro}",
"for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -27,7 +27,7 @@ import {
export default function albumCommitModifyCallback(abilityContext) {
describe('albumCommitModifyCallback', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -27,7 +27,7 @@ import {
export default function albumCommitModifyPromise(abilityContext) {
describe('albumCommitModifyPromise', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
......
......@@ -12,8 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import {
sleep,
......@@ -25,7 +26,7 @@ import {
export default function albumGetFileAssetsCallback(abilityContext) {
describe('albumGetFileAssetsCallback', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
......@@ -41,7 +42,7 @@ export default function albumGetFileAssetsCallback(abilityContext) {
console.info('afterAll case');
});
const checkAlbumAssetsCount = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
const getPhotoAssetsTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
......@@ -68,6 +69,37 @@ export default function albumGetFileAssetsCallback(abilityContext) {
}
}
const getPhotoAssetsErrCodeTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
if (!albumCountPass) return;
const album = await fetchAlbumResult.getFirstObject();
fetchAlbumResult.close();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo('222', '333');
let op = {
fetchColumns: ['111'],
predicates: predicates
};
album.getPhotoAssets(op, (error, fetchAssetResult) => {
if (error != undefined) {
console.info(`${testNum} getPhotoAssetsErrCodeTest error: ${error}`);
expect(false).assertTrue();
done();
return;
}
expect(false).assertTrue();
fetchAssetResult.close();
done();
});
} catch (error) {
console.info(`${testNum}, error: ${error}`);
expect(true).assertTrue();
done();
}
}
/**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01
* @tc.name : getPhotoAssets
......@@ -79,7 +111,21 @@ export default function albumGetFileAssetsCallback(abilityContext) {
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await checkAlbumAssetsCount(done, testNum, currentFetchOp);
await getPhotoAssetsTest(done, testNum, currentFetchOp);
});
/**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_CALLBACK_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid AlbumFetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_CALLBACK_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await getPhotoAssetsErrCodeTest(done, testNum, currentFetchOp);
});
});
}
\ No newline at end of file
......@@ -14,8 +14,9 @@
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import {
sleep,
......@@ -27,7 +28,7 @@ import {
export default function albumGetFileAssetsPromise(abilityContext) {
describe('albumGetFileAssetsPromise', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
......@@ -43,14 +44,14 @@ export default function albumGetFileAssetsPromise(abilityContext) {
console.info('afterAll case');
});
const checkAlbumAssetsCount = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
const getPhotoAssetsTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
if (!albumCountPass) return;
const album = await fetchAlbumResult.getFirstObject();
fetchAlbumResult.close();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
let fetchAssetResult = await album.getPhotoAssets(op);
if (fetchAssetResult == undefined) {
expect(false).assertTrue();
......@@ -68,6 +69,30 @@ export default function albumGetFileAssetsPromise(abilityContext) {
done();
}
}
const getPhotoAssetsErrCodeTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) {
try {
const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp);
const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount);
if (!albumCountPass) return;
const album = await fetchAlbumResult.getFirstObject();
fetchAlbumResult.close();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo('222', '333');
let op = {
fetchColumns: ['111'],
predicates: predicates
};
let fetchAssetResult = await album.getPhotoAssets(op);
expect(false).assertTrue();
fetchAssetResult.close();
done();
} catch (error) {
console.info(`${testNum}, error: ${error}`);
expect(true).assertTrue();
done();
}
}
/**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01
......@@ -80,7 +105,21 @@ export default function albumGetFileAssetsPromise(abilityContext) {
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await checkAlbumAssetsCount(done, testNum, currentFetchOp);
await getPhotoAssetsTest(done, testNum, currentFetchOp);
});
/**
* @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_PROMISE_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid AlbumFetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_ERRCODE_PROMISE_01';
let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static');
await getPhotoAssetsTest(done, testNum, currentFetchOp);
});
});
}
\ No newline at end of file
......@@ -14,7 +14,7 @@
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}",
"mkdir -p /storage/media/100/local/temp"
]
},
......@@ -25,26 +25,22 @@
"push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.dat ->/storage/media/100/local/temp"
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp"
]
},
{
"type": "ShellKit",
"run-command": [
"mkdir -pv /storage/media/100/local/files/Pictures/{Static,On,Off}",
"mkdir -pv /storage/media/100/local/files/Videos/{Static,On,Off}",
"mkdir -pv /storage/media/100/local/files/Audios/{Static,On,Off}",
"mkdir -pv /storage/media/100/local/files/Documents/{Static,On,Off}",
"mkdir -pv /storage/media/100/local/files/Pictures/{Static,On,Off,myAlbum}",
"mkdir -pv /storage/media/100/local/files/Videos/{Static,On,Off,myAlbum}",
"mkdir -pv /storage/media/100/local/files/Audios/{Static,On,Off,myAlbum}",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
......
......@@ -17,8 +17,8 @@ import getAlbumsCallbackTest from './getAlbumsCallback.test.ets'
import getAlbumsPromiseTest from './getAlbumsPromise.test.ets'
import getFileAssetsCallbackTest from './getFileAssetsCallback.test.ets'
import getFileAssetsPromiseTest from './getFileAssetsPromise.test.ets'
import getPublicDirectoryCallbackTest from './getPublicDirectoryCallback.test.ets'
import getPublicDirectoryPromiseTest from './getPublicDirectoryPromise.test.ets'
//import getPublicDirectoryCallbackTest from './getPublicDirectoryCallback.test.ets'
//import getPublicDirectoryPromiseTest from './getPublicDirectoryPromise.test.ets'
import getUserFileMgrTest from './getUserFileMgr.test.ets'
import onOffReleasePromiseTest from './onOffReleasePromise.test.ets'
export default function testsuite(abilityContext) {
......@@ -26,8 +26,8 @@ export default function testsuite(abilityContext) {
getAlbumsPromiseTest(abilityContext)
getFileAssetsCallbackTest(abilityContext)
getFileAssetsPromiseTest(abilityContext)
getPublicDirectoryCallbackTest(abilityContext)
getPublicDirectoryPromiseTest(abilityContext)
//getPublicDirectoryCallbackTest(abilityContext)
//getPublicDirectoryPromiseTest(abilityContext)
getUserFileMgrTest(abilityContext)
onOffReleasePromiseTest(abilityContext)
}
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -28,7 +28,7 @@ import {
export default function getAlbumsCallbackTest(abilityContext) {
describe('getAlbumsCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -25,7 +25,7 @@ import {
export default function getAlbumsPromiseTest(abilityContext) {
describe('getAlbumsPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
......@@ -29,7 +29,7 @@ import {
export default function getFileAssetsCallbackTest(abilityContext) {
describe('getFileAssetsCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest');
......@@ -150,6 +150,36 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
async function getPositionObjectErrCodeTest(done, testNum, fetchOp, pos, isAudio) {
try {
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
fetchAssetResult.getPositionObject(pos, async (err, asset) => {
if (err) {
console.info(`${testNum} err : ${err}`)
expect.assertFail();
fetchAssetResult.close();
done();
return;
}
expect(false).assertTrue();
fetchAssetResult.close();
done();
});
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
async function isAfterLastTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult;
......@@ -200,7 +230,7 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
expect(asset.displayName).assertEqual(props[type].displayName);
expect(asset.fileType.toString()).assertEqual(props[type].fileType);
expect(asset.uri).assertEqual(props[type].uri);
expect(asset.uri != undefined).assertTrue();
fetchAssetResult.close();
done();
});
......@@ -211,6 +241,38 @@ export default function getFileAssetsCallbackTest(abilityContext) {
}
}
async function getFileAssetsErrCodeTest(done, testNum, fetchOp, isAudio) {
try {
if (isAudio) {
await userfilemgr.getAudioAssets(fetchOp, (err, fetchAssetResult) => {
if (err != undefined) {
console.info(`${testNum}:: getAudioAssets error :${err}`);
expect(false).assertTrue();
done();
return;
}
expect(false).assertTrue();
done();
})
} else {
await userfilemgr.getPhotoAssets(fetchOp, (err, fetchAssetResult) => {
if (err != undefined) {
console.info(`${testNum}:: getAudioAssets error :${err}`);
expect(false).assertTrue();
done();
return;
}
expect(false).assertTrue();
done();
})
}
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_001
* @tc.name : getFirstObject
......@@ -355,6 +417,40 @@ export default function getFileAssetsCallbackTest(abilityContext) {
//------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_01
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/');
let pos = 'aaa';
let isAudio = false;
await getPositionObjectErrCodeTest(done, testNum, currentFetchOps, pos, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_02
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPOSITIONOBJECT_ERRCODE_CALLBACK_02';
let currentFetchOps = imageVideoFetchOps(testNum, 'Audios/Static/');
let pos = 'aaa';
let isAudio = true;
await getPositionObjectErrCodeTest(done, testNum, currentFetchOps, pos, isAudio);
});
//-----------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_001
* @tc.name : isAfterLast
......@@ -449,6 +545,38 @@ export default function getFileAssetsCallbackTest(abilityContext) {
let isAudio = false;
await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio);
});
//------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'aaa/');
let isAudio = false;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_02
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_CALLBACK_02';
let currentFetchOps = audioFetchOps(testNum, 'aaa/');
let isAudio = true;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
});
}
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
......@@ -30,7 +30,7 @@ import {
export default function getFileAssetsPromiseTest(abilityContext) {
describe('getFileAssetsPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest');
......@@ -127,6 +127,28 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
async function getPositionObjectErrCodeTest(done, testNum, fetchOp, pos, isAudio) {
try {
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
let expectCount = 4;
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount);
if (!checkAssetCountPass) return;
await fetchAssetResult.getPositionObject(pos);
expect(false).assertTrue();
fetchAssetResult.close();
done();
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
async function isAfterLastTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult;
......@@ -187,6 +209,22 @@ export default function getFileAssetsPromiseTest(abilityContext) {
}
}
async function getFileAssetsErrCodeTest(done, testNum, fetchOp, isAudio) {
try {
let fetchAssetResult;
if (isAudio) {
fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp);
} else {
fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp);
}
expect(false).assertTrue();
} catch (error) {
console.info(`${testNum}:: error :${error}`);
expect(true).assertTrue();
done();
}
}
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_001
* @tc.name : getFirstObject
......@@ -331,6 +369,40 @@ export default function getFileAssetsPromiseTest(abilityContext) {
//------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/');
let pos = 'aaa';
let isAudio = false;
await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02
* @tc.name : getPositionObject
* @tc.desc : pos is not number
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02';
let currentFetchOps = imageVideoFetchOps(testNum, 'Audios/Static/');
let pos = 'aaa';
let isAudio = true;
await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio);
});
//---------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_001
* @tc.name : isAfterLast
......@@ -425,6 +497,38 @@ export default function getFileAssetsPromiseTest(abilityContext) {
let isAudio = false;
await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio);
});
//------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_01';
let currentFetchOps = imageVideoFetchOps(testNum, 'aaa/');
let isAudio = false;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02
* @tc.name : getPhotoAssets
* @tc.desc : invalid FetchOptions
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_ERRCODE_PROMISE_02';
let currentFetchOps = audioFetchOps(testNum, 'aaa/');
let isAudio = true;
await getFileAssetsErrCodeTest(done, testNum, currentFetchOps, isAudio);
});
});
}
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -23,7 +23,7 @@ import {
export default function getPublicDirectoryCallbackTest(abilityContext) {
describe('getPublicDirectoryCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
});
......@@ -67,7 +67,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_01';
let dir = userfile_manager.DirectoryType.DIR_CAMERA;
let dir = userFileManager.DirectoryType.DIR_CAMERA;
let val = 'Camera/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -82,7 +82,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_02';
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let dir = userFileManager.DirectoryType.DIR_VIDEO;
let val = 'Videos/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -97,7 +97,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_03';
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let dir = userFileManager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -112,7 +112,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_04';
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let dir = userFileManager.DirectoryType.DIR_AUDIO;
let val = 'Audios/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -127,7 +127,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_05';
let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS;
let dir = userFileManager.DirectoryType.DIR_DOCUMENTS;
let val = 'Documents/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -142,7 +142,7 @@ export default function getPublicDirectoryCallbackTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_CALLBACK_06';
let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD;
let dir = userFileManager.DirectoryType.DIR_DOWNLOAD;
let val = 'Download/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -23,7 +23,7 @@ import {
export default function getPublicDirectoryPromiseTest(abilityContext) {
describe('getPublicDirectoryPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
});
......@@ -60,7 +60,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_01';
let dir = userfile_manager.DirectoryType.DIR_CAMERA;
let dir = userFileManager.DirectoryType.DIR_CAMERA;
let val = 'Camera/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -75,7 +75,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_02';
let dir = userfile_manager.DirectoryType.DIR_VIDEO;
let dir = userFileManager.DirectoryType.DIR_VIDEO;
let val = 'Videos/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -90,7 +90,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_03';
let dir = userfile_manager.DirectoryType.DIR_IMAGE;
let dir = userFileManager.DirectoryType.DIR_IMAGE;
let val = 'Pictures/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -105,7 +105,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_04';
let dir = userfile_manager.DirectoryType.DIR_AUDIO;
let dir = userFileManager.DirectoryType.DIR_AUDIO;
let val = 'Audios/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -120,7 +120,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_05';
let dir = userfile_manager.DirectoryType.DIR_DOCUMENTS;
let dir = userFileManager.DirectoryType.DIR_DOCUMENTS;
let val = 'Documents/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......@@ -135,7 +135,7 @@ export default function getPublicDirectoryPromiseTest(abilityContext) {
*/
it('SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06', 0, async function (done) {
let testNum = 'SUB_USERFILE_MGR_GETPUBLICDIRECTORY_PROMISE_06';
let dir = userfile_manager.DirectoryType.DIR_DOWNLOAD;
let dir = userFileManager.DirectoryType.DIR_DOWNLOAD;
let val = 'Download/';
await getPublicDirectoryTest(done, testNum, dir, val)
});
......
......@@ -13,13 +13,13 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import { sleep } from '../../../../../../common';
export default function getUserFileMgrTest(abilityContext) {
describe('getUserFileMgrTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
});
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -27,7 +27,7 @@ import {
export default function onOffReleasePromiseTest(abilityContext) {
describe('onOffReleasePromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest');
......
......@@ -14,7 +14,7 @@
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}",
"mkdir -p /storage/media/100/local/temp"
]
},
......@@ -25,8 +25,7 @@
"push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp",
"./resource/medialibrary/01.dat ->/storage/media/100/local/temp"
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp"
]
},
{
......@@ -35,22 +34,18 @@
"mkdir -pv /storage/media/100/local/files/Pictures/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"mkdir -pv /storage/media/100/local/files/Videos/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"mkdir -pv /storage/media/100/local/files/Audios/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"mkdir -pv /storage/media/100/local/files/Documents/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
......
......@@ -17,10 +17,11 @@ import fileAssetCommitModifyCallbackTest from './fileAssetCommitModifyCallback.t
import fileAssetCommitModifyPromiseTest from './fileAssetCommitModifyPromise.test.ets'
import fileAssetFavoriteCallbackTest from './fileAssetFavoriteCallback.test.ets'
import fileAssetFavoritePromiseTest from './fileAssetFavoritePromise.test.ets'
import fileAssetFileKeyTest from './fileAssetFileKey.test.ets'
import fileAssetGetThumbnailCallbackTest from './fileAssetGetThumbnailCallback.test.ets'
import fileAssetGetThumbnailPromiseTest from './fileAssetGetThumbnailPromise.test.ets'
import fileAssetIsDirectoryCallbackTest from './fileAssetIsDirectoryCallback.test.ets'
import fileAssetIsDirectoryPromiseTest from './fileAssetIsDirectoryPromise.test.ets'
//import fileAssetIsDirectoryCallbackTest from './fileAssetIsDirectoryCallback.test.ets'
//import fileAssetIsDirectoryPromiseTest from './fileAssetIsDirectoryPromise.test.ets'
import fileAssetOpenCallbackTest from './fileAssetOpenCallback.test.ets'
import fileAssetOpenPromiseTest from './fileAssetOpenPromise.test.ets'
import fileAssetTrashCallbackTest from './fileAssetTrashCallback.test.ets'
......@@ -30,10 +31,11 @@ export default function testsuite(abilityContext) {
fileAssetCommitModifyPromiseTest(abilityContext)
fileAssetFavoriteCallbackTest(abilityContext)
fileAssetFavoritePromiseTest(abilityContext)
fileAssetFileKeyTest(abilityContext)
fileAssetGetThumbnailCallbackTest(abilityContext)
fileAssetGetThumbnailPromiseTest(abilityContext)
fileAssetIsDirectoryCallbackTest(abilityContext)
fileAssetIsDirectoryPromiseTest(abilityContext)
//fileAssetIsDirectoryCallbackTest(abilityContext)
//fileAssetIsDirectoryPromiseTest(abilityContext)
fileAssetOpenCallbackTest(abilityContext)
fileAssetOpenPromiseTest(abilityContext)
fileAssetTrashCallbackTest(abilityContext)
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -30,7 +30,7 @@ import {
export default function fileAssetCommitModifyCallbackTest(abilityContext) {
describe('fileAssetCommitModifyCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -29,7 +29,7 @@ import {
export default function fileAssetCommitModifyPromiseTest(abilityContext) {
describe('fileAssetCommitModifyPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
......@@ -26,7 +26,7 @@ import {
export default function fileAssetFavoriteCallbackTest(abilityContext) {
describe('fileAssetFavoriteCallbackTest', function () {
var userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
var userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await getPermission();
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
......@@ -25,7 +25,7 @@ import {
export default function fileAssetFavoritePromiseTest(abilityContext) {
describe('fileAssetFavoritePromiseTest', function () {
var userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
var userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFavorite');
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import image from '@ohos.multimedia.image';
......@@ -27,7 +27,7 @@ import {
export default function fileAssetGetThumbnailCallbackTest(abilityContext) {
describe('fileAssetGetThumbnailCallbackTest', function () {
image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { });
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest');
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import image from '@ohos.multimedia.image';
import {
......@@ -27,7 +27,7 @@ import {
export default function fileAssetGetThumbnailPromiseTest(abilityContext) {
describe('fileAssetGetThumbnailPromiseTest', function () {
image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { });
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest');
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -25,7 +25,7 @@ import {
export default function fileAssetIsDirectoryCallbackTest(abilityContext) {
describe('fileAssetIsDirectoryCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -25,7 +25,7 @@ import {
export default function fileAssetIsDirectoryPromiseTest(abilityContext) {
describe('fileAssetIsDirectoryPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -27,7 +27,7 @@ import {
} from '../../../../../../common';
export default function fileAssetOpenCallbackTest(abilityContext) {
describe('fileAssetOpenCallbackTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
......@@ -31,7 +31,7 @@ import {
} from '../../../../../../common';
export default function fileAssetOpenPromiseTest(abilityContext) {
describe('fileAssetOpenPromiseTest', function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest')
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index";
import {
sleep,
......@@ -26,7 +26,7 @@ import {
export default function fileAssetTrashCallbackTest(abilityContext) {
describe("fileAssetTrashCallbackTest", function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info("beforeAll case");
});
......@@ -85,7 +85,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum);
......@@ -127,7 +127,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum - 1);
......@@ -190,7 +190,7 @@ export default function fileAssetTrashCallbackTest(abilityContext) {
if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum);
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index";
import {
sleep,
......@@ -26,7 +26,7 @@ import {
export default function fileAssetTrashPromiseTest(abilityContext) {
describe("fileAssetTrashPromiseTest", function () {
const userfilemgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info("beforeAll case");
});
......@@ -78,7 +78,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum);
......@@ -103,7 +103,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
if (!noAlbum) {
var fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
var album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
var albumFetchFileResult = await album.getPhotoAssets(op);
var albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum - 1);
......@@ -143,7 +143,7 @@ export default function fileAssetTrashPromiseTest(abilityContext) {
if (!noAlbum) {
let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps);
let album = await fetchAlbumResult.getFirstObject();
let op: userfile_manager.MediaFetchOptions = allFetchOp();
let op: userFileManager.FetchOptions = allFetchOp();
let albumFetchFileResult = await album.getPhotoAssets(op);
let albumFilesCount = albumFetchFileResult.getCount();
expect(albumFilesCount).assertEqual(expectAssetNum);
......
......@@ -12,7 +12,9 @@
"pre-push": [
],
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}"
]
},
{
......
......@@ -13,21 +13,18 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
allFetchOp,
} from '../../../../../../common';
export default function userFileMgrNoPermissionCallback(abilityContext) {
describe('userFileMgrNoPermissionCallback', function () {
const userfile_mgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
});
......@@ -42,9 +39,9 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
console.info('afterAll case');
});
const getFileAssetsTest = async function (done, testNum, media_type) {
const getPhotoAssetsTest = async function (done, testNum) {
try {
await userfile_mgr.getFileAssets(media_type, allFetchOp(), async (err, fetchFileResult) => {
await userfilemgr.getPhotoAssets(allFetchOp(), async (err, fetchAssetResult) => {
if (err != undefined) {
console.info(`${testNum}, err: ${err}`);
expect(true).assertTrue();
......@@ -61,9 +58,9 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
}
}
const getAlbumsTest = async function (done, testNum, media_type) {
const getPhotoAlbumsTest = async function (done, testNum) {
try {
await userfile_mgr.getAlbums(media_type, allFetchOp(), async (err, fetchAlbumResult) => {
await userfilemgr.getPhotoAlbums(allFetchOp(), async (err, fetchAlbumResult) => {
if (err != undefined) {
console.info(`${testNum}, err: ${err}`);
expect(true).assertTrue();
......@@ -82,88 +79,30 @@ export default function userFileMgrNoPermissionCallback(abilityContext) {
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(image) with no permission
* @tc.name : getPhotoAssets
* @tc.desc : getPhotoAssets(image) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01';
let media_type = [IMAGE_TYPE];
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_02
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_02';
let media_type = [AUDIO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_03
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(video) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_03';
let media_type = [VIDEO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
await getPhotoAssetsTest(done, testNum);
});
//--------------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_01
* @tc.name : getAlbums
* @tc.desc : getAlbums(image) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_01';
let media_type = [IMAGE_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_02
* @tc.name : getAlbums
* @tc.desc : getAlbums(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_02';
let media_type = [AUDIO_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_03
* @tc.name : getAlbums
* @tc.desc : getAlbums(video) with no permission
* @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01
* @tc.name : getPhotoAlbums
* @tc.desc : getPhotoAlbums with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_CALLBACK_03';
let media_type = [VIDEO_TYPE];
await getAlbumsTest(done, testNum, media_type);
it('SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01';
await getPhotoAlbumsTest(done, testNum);
});
});
}
......
......@@ -13,21 +13,18 @@
* limitations under the License.
*/
import userfile_manager from '@ohos.filemanagement.userfile_manager';
import userFileManager from '@ohos.filemanagement.userFileManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
allFetchOp,
} from '../../../../../../common';
export default function userFileMgrNoPermissionPromise(abilityContext) {
describe('userFileMgrNoPermissionPromise', function () {
const userfile_mgr = userfile_manager.getUserFileMgr(abilityContext);
const userfilemgr = userFileManager.getUserFileMgr(abilityContext);
beforeAll(async function () {
console.info('beforeAll case');
});
......@@ -42,9 +39,9 @@ export default function userFileMgrNoPermissionPromise(abilityContext) {
console.info('afterAll case');
});
const getFileAssetsTest = async function (done, testNum, media_type) {
const getPhotoAssetsTest = async function (done, testNum) {
try {
await userfile_mgr.getFileAssets(media_type, allFetchOp());
await userfilemgr.getPhotoAssets(allFetchOp());
expect(false).assertTrue();
done();
} catch (error) {
......@@ -54,9 +51,9 @@ export default function userFileMgrNoPermissionPromise(abilityContext) {
}
}
const getAlbumsTest = async function (done, testNum, media_type) {
const getPhotoAlbumsTest = async function (done, testNum) {
try {
await userfile_mgr.getAlbums(media_type, allFetchOp());
await userfilemgr.getPhotoAlbums(allFetchOp());
expect(false).assertTrue();
done();
} catch (error) {
......@@ -68,88 +65,30 @@ export default function userFileMgrNoPermissionPromise(abilityContext) {
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(image) with no permission
* @tc.name : getPhotoAssets
* @tc.desc : getPhotoAssets(image) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01';
let media_type = [IMAGE_TYPE];
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_02
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_02';
let media_type = [AUDIO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_03
* @tc.name : getFileAssets
* @tc.desc : getFileAssets(video) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_03';
let media_type = [VIDEO_TYPE];
await getFileAssetsTest(done, testNum, media_type);
await getPhotoAssetsTest(done, testNum);
});
//--------------------------------------------------------------------------------------
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01
* @tc.name : getAlbums
* @tc.desc : getAlbums(image) with no permission
* @tc.name : getPhotoAlbums
* @tc.desc : getPhotoAlbums with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01';
let media_type = [IMAGE_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_02
* @tc.name : getAlbums
* @tc.desc : getAlbums(audio) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_02', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_02';
let media_type = [AUDIO_TYPE];
await getAlbumsTest(done, testNum, media_type);
});
/**
* @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_03
* @tc.name : getAlbums
* @tc.desc : getAlbums(video) with no permission
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_03', 0, async function (done) {
const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_03';
let media_type = [VIDEO_TYPE];
await getAlbumsTest(done, testNum, media_type);
await getPhotoAlbumsTest(done, testNum);
});
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册