提交 faf02efb 编写于 作者: O openharmony_ci 提交者: Gitee

!1032 Modify test code

Merge pull request !1032 from blackleon/master_1102
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"test-timeout": "120000",
"package": "com.example.amsZipfileUnzipfileST",
"shell-timeout": "60000"
},
......@@ -24,16 +24,33 @@
{
"type": "PushKit",
"push": [
"amsZipfileUnzipfileST.hap->/data/test/amsZipfileUnzipfileST.hap"
"ceshi.txt->/data/test/ceshi.txt"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
"chmod 777 /data/test/*"
]
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/testA"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 777 /data/testA/*"
]
}
]
}
......@@ -14,2036 +14,1692 @@
*/
import zlib from '@ohos.zlib'
import fileio from '@ohos.fileio'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
console.log("-----------------888888888------------------");
describe('ZlibTest', function () {
var FLUSH_TYPE_NO_FLUSH = 0;
var FLUSH_TYPE_PARTIAL_FLUSH = 1;
var FLUSH_TYPE_SYNC_FLUSH = 2;
var FLUSH_TYPE_FULL_FLUSH = 3;
var FLUSH_TYPE_FINISH = 4;
var FLUSH_TYPE_BLOCK = 5;
var FLUSH_TYPE_TREES = 6;
var COMPRESS_LEVEL_NO_COMPRESSION = 0;
var COMPRESS_LEVEL_BEST_SPEED = 1;
var COMPRESS_LEVEL_BEST_COMPRESSION = 9;
var COMPRESS_LEVEL_DEFAULT_COMPRESSION = -1;
var COMPRESS_STRATEGY_DEFAULT_STRATEGY = 0;
var COMPRESS_STRATEGY_FILTERED = 1;
var COMPRESS_STRATEGY_HUFFMAN_ONLY = 2;
var COMPRESS_STRATEGY_RLE = 3;
var COMPRESS_STRATEGY_FIXED = 4;
var MEM_LEVEL_MIN_MEMLEVEL = 1;
var MEM_LEVEL_DEFAULT_MEMLEVEL = 8;
var MEM_LEVEL_MAX_MEMLEVEL = 9;
/*
* @tc.number: ACTS_zipFile_0100
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0100
* @tc.name: zipFile
* @tc.desc: inFile doesn't exist
*/
function zipFileCallBack(err, data){
console.log("zipFileCallBack_0100 err: " + err.code);
console.log("zipFileCallBack_0100 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
}
it('ACTS_zipFile_0100', 0, async function (done) {
console.log("==================ACTS_zipFile_0100 start==================");
var src ="";
var dest ="";
zlib.zipFile(src,dest,
(err, data) => {
console.log("zipFileCallBack_0100 err: " + err.code);
console.log("zipFileCallBack_0100 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
function timeout() {
expect().assertFail();
console.debug('ACTS_zipFile_0100=====timeout======');
}
setTimeout(timeout, 5000);
done();
})
it('FWK_ZipFile_0100', 0, async function (done) {
console.log("==================FWK_ZipFile_0100 start==================");
var src = "/data/noExist.txt";
var dest = "/data/test/";
var options = {}
zlib.zipFile(src, dest, options,
(err, data) => {
console.log("zipFileCallback_0100 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
done();
});
})
/*
* @tc.number: ACTS_zipFile_0200
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0200
* @tc.name: zipFile
* @tc.desc: inFile is a directory that doesn't exist
*/
it('ACTS_zipFile_0200', 0, async function (done) {
console.log("==================ACTS_zipFile_0200 start==================");
var src ="/data/test/";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
zlib.zipFile(src,dest,
(err, data) => {
console.log("zipFileCallBack_0200 err: " + err.code);
console.log("zipFileCallBack_0200 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
function timeout() {
expect().assertFail();
console.debug('ACTS_zipFile_0100=====timeout======');
}
setTimeout(timeout, 5000);
done();
})
it('FWK_ZipFile_0200', 0, async function (done) {
console.log("==================FWK_ZipFile_0200 start==================");
var src = "/data/test/not_exist/";
var dest = "/data/testA/not_exist.zip";
var options = {}
zlib.zipFile(src, dest, options,
(err, data) => {
console.log("zipFileCallBack_0200 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR);
done();
});
})
/*
* @tc.number: ACTS_zipFile_0300
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0300
* @tc.name: zipFile
* @tc.desc: output file not specified
*/
it('ACTS_zipFile_0300', 0, async function (done) {
console.log("==================ACTS_zipFile_0300 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="";
zlib.zipFile(src,dest,
(err, data) => {
console.log("zipFileCallBack_0300 err: " + err.code);
console.log("zipFileCallBack_0300 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
function timeout() {
expect().assertFail();
console.debug('ACTS_zipFile_0300=====timeout======');
}
setTimeout(timeout, 5000);
done();
})
it('FWK_ZipFile_0300', 0, async function (done) {
console.log("==================FWK_ZipFile_0300 start==================");
var src = "/data/test/ceshi.txt";
var dest = "";
var options = {}
zlib.zipFile(src, dest, options,
(err, data) => {
console.log("zipFileCallBack_0300 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
done();
});
})
/*
* @tc.number: ACTS_zipFile_0400
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0400
* @tc.name: zipFile
* @tc.desc: The ouput file is a directory that does not exist
*/
it('ACTS_zipFile_0400', 0, async function (done) {
console.log("==================ACTS_zipFile_0400 start==================");
var src ="/data/test/";
var dest ="/data/testA/zip_amsZipfileUnzipfileST-signed.zip";
zlib.zipFile(src,dest,
(err, data) => {
console.log("zipFileCallBack_0400 err: " + err.code);
console.log("zipFileCallBack_0400 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
function timeout() {
expect().assertFail();
console.debug('ACTS_zipFile_0400=====timeout======');
}
setTimeout(timeout, 5000);
done();
})
it('FWK_ZipFile_0400', 0, async function (done) {
console.log("==================FWK_ZipFile_0400 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testB/ceshi.txt.zip";
var options = {}
zlib.zipFile(src, dest, options,
(err, data) => {
console.log("zipFileCallBack_0400 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
done();
});
})
/*
* @tc.number: ACTS_zipFile_0500
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0500
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
*/
it('ACTS_zipFile_0500', 0, async function (done) {
console.log("==================ACTS_zipFile_0500 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
try{
var Options= {
flush:FLUSH_TYPE_NO_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_0500 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_0500 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_0500 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_0500 big=" + big);
console.log("ACTS_zipFile_0500 small=" + small);
console.log("ACTS_zipFile_0500 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_0500 assertTure err:' + err);
}
console.debug('ACTS_zipFile_0500=====size======');
done();
});
}catch(err) {
console.error('ACTS_zipFile_0500 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_0500=====timeout======');
}, '1000');
})
it('FWK_ZipFile_0500', 0, async function (done) {
console.log("==================FWK_ZipFile_0500 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try {
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
} catch(err) {
console.error('FWK_ZipFile_0500 err:' + err);
done();
}
console.log("==================FWK_ZipFile_0500 end==================");
})
/*
* @tc.number: ACTS_zipFile_0600
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0600
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
*/
it('ACTS_zipFile_0600', 0, async function (done) {
console.log("==================ACTS_zipFile_0600 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_0600', 0, async function (done) {
console.log("==================FWK_ZipFile_0600 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flush:FLUSH_TYPE_NO_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_0600 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_0600 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_0600 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_0600 big=" + big);
console.log("ACTS_zipFile_0600 small=" + small);
console.log("ACTS_zipFile_0600 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_0600 assertTure err:' + err);
}
console.debug('ACTS_zipFile_0600=====size======');
try {
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_0600 size err:' + err);
} catch(err) {
console.error('FWK_ZipFile_0500 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_000=====timeout======');
}, '1000');
}
console.log("==================FWK_ZipFile_0600 end==================");
})
/*
* @tc.number: ACTS_zipFile_700
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0700
* @tc.name: zipFile
* @tc.desc: zipFile
*/
it('ACTS_zipFile_0700', 0, async function (done) {
console.log("==================ACTS_zipFile_0700 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_0700', 0, async function (done) {
console.log("==================FWK_ZipFile_0700 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flush:FLUSH_TYPE_SYNC_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_0500 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_0700 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_0700 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_0700 big=" + big);
console.log("ACTS_zipFile_0700 small=" + small);
console.log("ACTS_zipFile_0700 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_0700 assertTure err:' + err);
}
console.debug('ACTS_zipFile_0700=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_0700 size err:' + err);
console.error('FWK_ZipFile_0700 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_0700=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_0700 end==================");
})
/*
* @tc.number: ACTS_zipFile_0800
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0800
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_FULL_FLUSH
*/
it('ACTS_zipFile_0800', 0, async function (done) {
console.log("==================ACTS_zipFile_0800 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_0800', 0, async function (done) {
console.log("==================FWK_ZipFile_0800 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flush:FLUSH_TYPE_FULL_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_0800 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_0800 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_0800 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_0800 big=" + big);
console.log("ACTS_zipFile_0800 small=" + small);
console.log("ACTS_zipFile_0800 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_0800 assertTure err:' + err);
}
console.debug('ACTS_zipFile_0800=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_0800 size err:' + err);
console.error('FWK_ZipFile_0800 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_0800=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_0800 end==================");
})
/*
* @tc.number: ACTS_zipFile_0900
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_0900
* @tc.name: zipFile
* @tc.desc: zipFile
*/
it('ACTS_zipFile_0900', 0, async function (done) {
console.log("==================ACTS_zipFile_0900 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_0900', 0, async function (done) {
console.log("==================FWK_ZipFile_0900 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flush:FLUSH_TYPE_FINISH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_0900 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_0900 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_0900 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_0900 big=" + big);
console.log("ACTS_zipFile_0900 small=" + small);
console.log("ACTS_zipFile_0900 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_0900 assertTure err:' + err);
}
console.debug('ACTS_zipFile_0900=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_FINISH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_0900 size err:' + err);
console.error('FWK_ZipFile_0900 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_0900=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_0900 end==================");
})
/*
* @tc.number: ACTS_zipFile_1000
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1000
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_BLOCK
*/
it('ACTS_zipFile_1000', 0, async function (done) {
console.log("==================ACTS_zipFile_1000 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1000', 0, async function (done) {
console.log("==================FWK_ZipFile_1000 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flush:FLUSH_TYPE_BLOCK,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1000 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1000 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1000 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1000 big=" + big);
console.log("ACTS_zipFile_1000 small=" + small);
console.log("ACTS_zipFile_1000 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1000 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1000=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1000 size err:' + err);
console.error('FWK_ZipFile_1000 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1000=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1000 end==================");
})
/*
* @tc.number: ACTS_zipFile_1100
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1100
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_TREES
*/
it('ACTS_zipFile_1100', 0, async function (done) {
console.log("==================ACTS_zipFile_1100 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1100', 0, async function (done) {
console.log("==================FWK_ZipFile_1100 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flush:FLUSH_TYPE_TREES,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1100 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1100 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1100 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1100 big=" + big);
console.log("ACTS_zipFile_1100 small=" + small);
console.log("ACTS_zipFile_1100 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1100 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1100=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_TREES,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1100 size err:' + err);
console.error('FWK_ZipFile_1100 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1100=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1100 end==================");
sleep(10);
})
/*
* @tc.number: ACTS_zipFile_1200
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1200
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
*/
it('ACTS_zipFile_1200', 0, async function (done) {
console.log("==================ACTS_zipFile_0900 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1200', 0, async function (done) {
console.log("==================FWK_ZipFile_1200 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
finishFlush:FLUSH_TYPE_NO_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1200 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1200 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1200 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1200 big=" + big);
console.log("ACTS_zipFile_1200 small=" + small);
console.log("ACTS_zipFile_1200 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1200 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1200=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1200 size err:' + err);
console.error('ACTS_zipFile_1200 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1200=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1200 end==================");
sleep(10);
})
/*
* @tc.number: ACTS_zipFile_1300
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1300
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_PARTIAL_FLUSH
*/
it('ACTS_zipFile_1300', 0, async function (done) {
console.log("==================ACTS_zipFile_1300 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1300', 0, async function (done) {
console.log("==================FWK_ZipFile_1300 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flushFlush:FLUSH_TYPE_PARTIAL_FLUSH
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1300 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1300 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1300 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1300 big=" + big);
console.log("ACTS_zipFile_1300 small=" + small);
console.log("ACTS_zipFile_1300 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1300 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1300=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1300 size err:' + err);
console.error('FWK_ZipFile_1300 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1300=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1300 end==================");
})
/*
* @tc.number: ACTS_zipFile_1400
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1400
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_SYNC_FLUSH
*/
it('ACTS_zipFile_1400', 0, async function (done) {
console.log("==================ACTS_zipFile_1400 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1400', 0, async function (done) {
console.log("==================FWK_ZipFile_1400 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flushFlush:FLUSH_TYPE_SYNC_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1400 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1400 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1400 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1400 big=" + big);
console.log("ACTS_zipFile_1400 small=" + small);
console.log("ACTS_zipFile_1400 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1400 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1400=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1400 size err:' + err);
console.error('FWK_ZipFile_1400 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1400=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1400 end==================");
})
/*
* @tc.number: ACTS_zipFile_1500
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1500
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_FULL_FLUSH
*/
it('ACTS_zipFile_1500', 0, async function (done) {
console.log("==================ACTS_zipFile_1500 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1500', 0, async function (done) {
console.log("==================FWK_ZipFile_1500 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flushFlush:FLUSH_TYPE_FULL_FLUSH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1500 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1500 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1500 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1500 big=" + big);
console.log("ACTS_zipFile_1500 small=" + small);
console.log("ACTS_zipFile_1500 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1500 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1500=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1500 size err:' + err);
console.error('FWK_ZipFile_1500 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1500=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1500 end==================");
})
/*
* @tc.number: ACTS_zipFile_1600
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1600
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_FINISH
*/
it('ACTS_zipFile_1600', 0, async function (done) {
console.log("==================ACTS_zipFile_1600 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1600', 0, async function (done) {
console.log("==================FWK_ZipFile_1600 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flushFlush:FLUSH_TYPE_FINISH,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1600 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1600 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1600 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1600 big=" + big);
console.log("ACTS_zipFile_1600 small=" + small);
console.log("ACTS_zipFile_1600 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1600 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1600=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_FINISH,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1600 size err:' + err);
console.error('FWK_ZipFile_1600 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1600=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1600 end==================");
})
/*
* @tc.number: ACTS_zipFile_1700
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1700
* @tc.name: zipFile
* @tc.desc: zipFile
*/
it('ACTS_zipFile_1700', 0, async function (done) {
console.log("==================ACTS_zipFile_1700 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1700', 0, async function (done) {
console.log("==================FWK_ZipFile_1700 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flushFlush:FLUSH_TYPE_BLOCK,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1700 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1700 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1700 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1700 big=" + big);
console.log("ACTS_zipFile_1700 small=" + small);
console.log("ACTS_zipFile_1700 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1700 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1700=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1700 size err:' + err);
console.error('FWK_ZipFile_1700 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1700=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1700 end==================");
})
/*
* @tc.number: ACTS_zipFile_1800
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1800
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_TREES
*/
it('ACTS_zipFile_1800', 0, async function (done) {
console.log("==================ACTS_zipFile_1800 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1800', 0, async function (done) {
console.log("==================FWK_ZipFile_1800 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
flushFlush:FLUSH_TYPE_TREES,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1800 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1800 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1800 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1800 big=" + big);
console.log("ACTS_zipFile_1800 small=" + small);
console.log("ACTS_zipFile_1800 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1800 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1800=====size======');
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_TREES,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1800 size err:' + err);
console.error('FWK_ZipFile_1800 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1800=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1800 end==================");
})
/*
* @tc.number: ACTS_zipFile_1900
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_1900
* @tc.name: zipFile
* @tc.desc: chunkSize:64
*/
it('ACTS_zipFile_1900', 0, async function (done) {
console.log("==================ACTS_zipFile_1900 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_1900', 0, async function (done) {
console.log("==================FWK_ZipFile_1900 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
var options = {
chunkSize:64,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_1900 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_1900 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_1900 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_1900 big=" + big);
console.log("ACTS_zipFile_1900 small=" + small);
console.log("ACTS_zipFile_1900 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_1900 assertTure err:' + err);
}
console.debug('ACTS_zipFile_1900=====size======');
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_1900 size err:' + err);
console.error('FWK_ZipFile_1900 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_1900=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_1900 end==================");
})
/*
* @tc.number: ACTS_zipFile_2000
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2000
* @tc.name: zipFile
* @tc.desc: chunkSize:1024
*/
it('ACTS_zipFile_2000', 0, async function (done) {
console.log("==================ACTS_zipFile_2000 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2000', 0, async function (done) {
console.log("==================FWK_ZipFile_2000 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
var options = {
chunkSize:1024,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2000 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2000 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2000 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2000 big=" + big);
console.log("ACTS_zipFile_2000 small=" + small);
console.log("ACTS_zipFile_2000 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2000 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2000=====size======');
done();
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();;
});
}catch(err) {
console.error('ACTS_zipFile_2000 size err:' + err);
console.error('FWK_ZipFile_2000 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2000=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2000 end==================");
})
/*
* @tc.number: ACTS_zipFile_2100
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2100
* @tc.name: zipFile
* @tc.desc: chunkSize:999
*/
it('ACTS_zipFile_2100', 0, async function (done) {
console.log("==================ACTS_zipFile_2100 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2100', 0, async function (done) {
console.log("==================FWK_ZipFile_2100 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
var options = {
chunkSize:999,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2100 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2100 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2100 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2100 big=" + big);
console.log("ACTS_zipFile_2100 small=" + small);
console.log("ACTS_zipFile_2100 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2100 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2100=====size======');
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2100 size err:' + err);
console.error('FWK_ZipFile_2100 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2100=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2100 end==================");
})
/*
* @tc.number: ACTS_zipFile_2200
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2200
* @tc.name: zipFile
* @tc.desc: level.COMPRESS_LEVEL_NO_COMPRESSION
*/
it('ACTS_zipFile_2200', 0, async function (done) {
console.log("==================ACTS_zipFile_2200 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2200', 0, async function (done) {
console.log("==================FWK_ZipFile_2200 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
level:COMPRESS_LEVEL_NO_COMPRESSION ,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2200 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2200 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2200 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2200 big=" + big);
console.log("ACTS_zipFile_2200 small=" + small);
console.log("ACTS_zipFile_2200 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2200 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2200=====size======');
var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION ,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2200 size err:' + err);
console.error('FWK_ZipFile_2200 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2200=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2200 end==================");
})
/*
* @tc.number: ACTS_zipFile_2300
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2300
* @tc.name: zipFile
* @tc.desc: level.COMPRESS_LEVEL_BEST_SPEED
*/
it('ACTS_zipFile_2300', 0, async function (done) {
console.log("==================ACTS_zipFile_2300 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2300', 0, async function (done) {
console.log("==================FWK_ZipFile_2300 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
level:COMPRESS_LEVEL_BEST_SPEED,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2300 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2300 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2300 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2300 big=" + big);
console.log("ACTS_zipFile_2300 small=" + small);
console.log("ACTS_zipFile_2300 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2300 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2300=====size======');
var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_SPEED,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2300 size err:' + err);
console.error('FWK_ZipFile_2300 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2300=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2300 end==================");
})
/*
* @tc.number: ACTS_zipFile_2400
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2400
* @tc.name: zipFile
* @tc.desc: level.COMPRESS_LEVEL_BEST_COMPRESSION
*/
it('ACTS_zipFile_2400', 0, async function (done) {
console.log("==================ACTS_zipFile_2400 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2400', 0, async function (done) {
console.log("==================FWK_ZipFile_2400 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
level:COMPRESS_LEVEL_BEST_COMPRESSION,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2400 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2400 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2400 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2400 big=" + big);
console.log("ACTS_zipFile_2400 small=" + small);
console.log("ACTS_zipFile_2400 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2400 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2400=====size======');
var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_COMPRESSION,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2400 size err:' + err);
console.error('FWK_ZipFile_2400 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2400=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2400 end==================");
})
/*
* @tc.number: ACTS_zipFile_2500
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2500
* @tc.name: zipFile
* @tc.desc: level.COMPRESS_LEVEL_DEFAULT_COMPRESSION
*/
it('ACTS_zipFile_2500', 0, async function (done) {
console.log("==================ACTS_zipFile_2500 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2500', 0, async function (done) {
console.log("==================FWK_ZipFile_2500 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
level:COMPRESS_LEVEL_DEFAULT_COMPRESSION,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2000 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2500 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2500 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2500 big=" + big);
console.log("ACTS_zipFile_2500 small=" + small);
console.log("ACTS_zipFile_2500 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2500 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2500=====size======');
var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2500 size err:' + err);
console.error('FWK_ZipFile_2500 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2500=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2500 end==================");
})
/*
* @tc.number: ACTS_zipFile_2600
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2600
* @tc.name: zipFile
* @tc.desc: memlevel.MEM_LEVEL_MIN_MEMLEVEL
*/
it('FWK_ZipFile_2600', 0, async function (done) {
console.log("==================FWK_ZipFile_2600 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
it('ACTS_zipFile_2600', 0, async function (done) {
console.log("==================ACTS_zipFile_2600 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
try{
var Options= {
memlevel:MEM_LEVEL_MIN_MEMLEVEL,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2600 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2600 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2600 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2600 big=" + big);
console.log("ACTS_zipFile_2600 small=" + small);
console.log("ACTS_zipFile_2600 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2600 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2600=====size======');
var options = {};
options.memlevel = zlib.MemLevel.MEM_LEVEL_MIN_MEMLEVEL,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2600 size err:' + err);
console.error('FWK_ZipFile_2600 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2600=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2600 end==================");
})
/*
* @tc.number: ACTS_zipFile_2700
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2700
* @tc.name: zipFile
* @tc.desc: memlevel.MEM_LEVEL_MAX_MEMLEVEL
*/
it('ACTS_zipFile_2700', 0, async function (done) {
console.log("==================ACTS_zipFile_2700 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2700', 0, async function (done) {
console.log("==================FWK_ZipFile_2700 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
memlevel:MEM_LEVEL_MAX_MEMLEVEL,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2700 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2700 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2700 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2700 big=" + big);
console.log("ACTS_zipFile_2700 small=" + small);
console.log("ACTS_zipFile_2700 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2700 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2700=====size======');
var options = {};
options.memlevel = zlib.MemLevel.MEM_LEVEL_MAX_MEMLEVEL,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2700 size err:' + err);
console.error('FWK_ZipFile_2700 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2700=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2700 end==================");
})
/*
* @tc.number: ACTS_zipFile_2800
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2800
* @tc.name: zipFile
* @tc.desc: memlevel.MEM_LEVEL_DEFAULT_MEMLEVEL
*/
it('ACTS_zipFile_2800', 0, async function (done) {
console.log("==================ACTS_zipFile_2800 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2800', 0, async function (done) {
console.log("==================FWK_ZipFile_2800 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
memlevel:MEM_LEVEL_DEFAULT_MEMLEVEL,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2800 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2800 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2800 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2800 big=" + big);
console.log("ACTS_zipFile_2800 small=" + small);
console.log("ACTS_zipFile_2800 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2800 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2800=====size======');
var options = {};
options.memlevel = zlib.MemLevel.MEM_LEVEL_DEFAULT_MEMLEVEL,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2800 size err:' + err);
console.error('FWK_ZipFile_2800 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2800=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2800 end==================");
})
/*
* @tc.number: ACTS_zipFile_2900
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_2900
* @tc.name: zipFile
* @tc.desc: strategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY
*/
it('ACTS_zipFile_2900', 0, async function (done) {
console.log("==================ACTS_zipFile_2900 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_2900', 0, async function (done) {
console.log("==================FWK_ZipFile_2900 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
strategy:COMPRESS_STRATEGY_DEFAULT_STRATEGY,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_2900 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_2900 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_2900 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_2900 big=" + big);
console.log("ACTS_zipFile_2900 small=" + small);
console.log("ACTS_zipFile_2900 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_2900 assertTure err:' + err);
}
console.debug('ACTS_zipFile_2900=====size======');
var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_2900 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_2900=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_2900 end==================");
})
/*
* @tc.number: ACTS_zipFile_3000
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_3000
* @tc.name: zipFile
* @tc.desc: strategy.COMPRESS_STRATEGY_FILTERED
*/
it('ACTS_zipFile_3000', 0, async function (done) {
console.log("==================ACTS_zipFile_3000 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_3000', 0, async function (done) {
console.log("==================FWK_ZipFile_3000 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
strategy:COMPRESS_STRATEGY_FILTERED,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_3000 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_3000 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_3000 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_3000 big=" + big);
console.log("ACTS_zipFile_3000 small=" + small);
console.log("ACTS_zipFile_3000 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_3000 assertTure err:' + err);
}
console.debug('ACTS_zipFile_3000=====size======');
var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_3000 size err:' + err);
console.error('FWK_ZipFile_3000 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_3000=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_3000 end==================");
})
/*
* @tc.number: ACTS_zipFile_3100
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_3100
* @tc.name: zipFile
* @tc.desc: strategy.COMPRESS_STRATEGY_HUFFMAN_ONLY
*/
it('ACTS_zipFile_3100', 0, async function (done) {
console.log("==================ACTS_zipFile_3100 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_3100', 0, async function (done) {
console.log("==================FWK_ZipFile_3100 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
strategy:COMPRESS_STRATEGY_HUFFMAN_ONLY,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_3100 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_3100 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_3100 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_3100 big=" + big);
console.log("ACTS_zipFile_3100 small=" + small);
console.log("ACTS_zipFile_3100 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_3100 assertTure err:' + err);
}
console.debug('ACTS_zipFile_3100=====size======');
var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_3100 size err:' + err);
console.error('FWK_ZipFile_3100 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_3100=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_3100 end==================");
})
/*
* @tc.number: ACTS_zipFile_3200
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_3200
* @tc.name: zipFile
* @tc.desc: strategy.COMPRESS_STRATEGY_RLE
*/
it('ACTS_zipFile_3200', 0, async function (done) {
console.log("==================ACTS_zipFile_3200 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_3200', 0, async function (done) {
console.log("==================FWK_ZipFile_3200 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
strategy:COMPRESS_STRATEGY_RLE,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_3200 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_3200 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_3200 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_3200 big=" + big);
console.log("ACTS_zipFile_3200 small=" + small);
console.log("ACTS_zipFile_3200 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_3200 assertTure err:' + err);
}
console.debug('ACTS_zipFile_3200=====size======');
var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_RLE,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_3200 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_3200=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_3200 end==================");
})
/*
* @tc.number: ACTS_zipFile_3300
* @tc.name: zipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_3300
* @tc.name: zipFile
* @tc.desc: strategy.COMPRESS_STRATEGY_HUFFMAN_ONLY
*/
it('ACTS_zipFile_3300', 0, async function (done) {
console.log("==================ACTS_zipFile_3300 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
it('FWK_ZipFile_3300', 0, async function (done) {
console.log("==================FWK_ZipFile_3300 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try{
var Options= {
strategy:COMPRESS_STRATEGY_HUFFMAN_ONLY,
};
await zlib.zipFile(src,dest,Options,
() => {
console.log("ACTS_zipFile_3300 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_zipFile_3300 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_zipFile_3300 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big>=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_zipFile_3300 big=" + big);
console.log("ACTS_zipFile_3300 small=" + small);
console.log("ACTS_zipFile_3300 big>=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_zipFile_3300 assertTure err:' + err);
}
console.debug('ACTS_zipFile_3300=====size======');
var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY,
await zlib.zipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_zipFile_3300 size err:' + err);
console.error('FWK_ZipFile_3300 size err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_zipFile_3300=====timeout======');
}, '1000');
console.log("==================FWK_ZipFile_3300 end==================");
})
/*
* @tc.number: FWK_ZipFile_3400
* @tc.name: zipFile
* @tc.desc: inFile doesn't exist
*/
it('FWK_ZipFile_3400', 0, async function (done) {
console.log("==================FWK_ZipFile_3400 start==================");
var src = "/data/noExist.txt";
var dest = "/data/test/";
var options = {}
zlib.zipFile(src, dest, options).then((data) => {
console.log("zipFilePromise_3400 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
done();
}).catch((err)=>{
console.log("zipFilePromise_3400 err: " + err);
done();
});
console.log("==================zipFilePromise_3400 end ==================");
})
/*
* @tc.number: ACTS_unzipFile_0100
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_3500
* @tc.name: zipFile
* @tc.desc: inFile is a directory that doesn't exist
*/
it('FWK_ZipFile_3500', 0, async function (done) {
console.log("==================FWK_ZipFile_3500 start==================");
var src = "/data/test/not_exist/";
var dest = "/data/test/not_exist.zip";
var options = {}
zlib.zipFile(src, dest, options).then((data) => {
console.log("zipFilePromise_3500 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR);
done();
}).catch((err)=>{
console.log("zipFilePromise_3500 err: " + err);
done();
});
console.log("==================zipFilePromise_3500 end ==================");
})
it('ACTS_unzipFile_0100', 0, async function (done) {
console.log("==================ACTS_unzipFile_0100 start==================");
var src ="";
var dest ="";
/*
* @tc.number: FWK_ZipFile_3600
* @tc.name: zipFile
* @tc.desc:output file not specified
*/
it('FWK_ZipFile_3600', 0, async function (done) {
console.log("==================FWK_ZipFile_3600 start==================");
var src = "/data/test/amsZipfileUnzipfileST.hap";
var dest = "";
var options = {}
zlib.zipFile(src, dest, options).then((data) => {
console.log("zipFilePromise_3600 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
done();
}).catch((err)=>{
console.log("zipFilePromise_3600 err: " + err);
done();
});
console.log("==================zipFilePromise_3600 end ==================");
})
zlib.unzipFile(src,dest,
(err, data) => {
console.log("unzipFileCallBack_0100 err: " + err.code);
console.log("unzipFileCallBack_0100 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
/*
* @tc.number: FWK_ZipFile_3700
* @tc.name: zipFile
* @tc.desc:output file not specified
*/
it('FWK_ZipFile_3700', 0, async function (done) {
console.log("==================zipFilePromise_3700 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testB/ceshi.txt.zip";
var options = {}
zlib.zipFile(src, dest, options).then((data) => {
console.log("zipFilePromise_3700 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
done();
}).catch((err)=>{
console.log("zipFilePromise_3700 err: " + err);
done();
});
console.log("==================zipFilePromise_3700 end ==================");
})
function timeout() {
expect().assertFail();
console.debug('ACTS_unzipFile_0100=====timeout======');
/*
* @tc.number: FWK_ZipFile_3800
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
*/
it('FWK_ZipFile_3800', 0, async function (done) {
console.log("==================FWK_ZipFile_3800 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try {
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
await zlib.zipFile(src, dest, options,).then((data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
}).catch((err)=>{
console.log("FWK_ZipFile_3800 .catch((err)=>" + err);
done();
});
} catch(err) {
console.error('FWK_ZipFile_3800 err:' + err);
done();
}
setTimeout(timeout, 5000);
done();
console.log("==================FWK_ZipFile_3800 end==================");
})
/*
* @tc.number: ACTS_unzipFile_0200
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_ZipFile_3900
* @tc.name: zipFile
* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
*/
it('FWK_ZipFile_3900', 0, async function (done) {
console.log("==================FWK_ZipFile_3900 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testA/ceshi.txt.zip";
try {
var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH,
await zlib.zipFile(src, dest, options,).then((data) => {
var smallStat = fileio.statSync(dest);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = smallStat.size;
expect(srcSize>=destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
}).catch((err)=>{
console.log("FWK_ZipFile_3900 .catch((err)=>" + err);
done();
});
} catch(err) {
console.error('FWK_ZipFile_3900 err:' + err);
done();
}
console.log("==================FWK_ZipFile_3900 end==================");
})
it('ACTS_unzipFile_0200', 0, async function (done) {
console.log("==================ACTS_unzipFile_0200 start==================");
var src ="/data/test/";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
zlib.unzipFile(src,dest,
(err, data) => {
console.log("unzipFileCallBack_0200 err: " + err.code);
console.log("unzipFileCallBack_0200 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
function timeout() {
expect().assertFail();
console.debug('ACTS_unzipFile_0200=====timeout======');
}
setTimeout(timeout, 5000);
done();
})
/*
* @tc.number: ACTS_unzipFile_0300
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_0100
* @tc.name: unzipFile
* @tc.desc: unzipFile
*/
it('ACTS_unzipFile_0300', 0, async function (done) {
console.log("==================ACTS_unzipFile_0300 start==================");
var src ="/data/test/amsZipfileUnzipfileST.hap";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
it('FWK_UnzipFile_0100', 0, async function (done) {
console.log("==================FWK_UnzipFile_0100 start==================");
var src = "/data/noExist.txt";
var dest = "/data/test/";
var options = {}
zlib.unzipFile(src, dest, options,
(err, data) => {
console.log("unzipfilecallback_0100 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR);
done();
});
})
zlib.unzipFile(src,dest,
/*
* @tc.number: FWK_UnzipFile_0200
* @tc.name: unzipFile
* @tc.desc: unzipFile
*/
it('FWK_UnzipFile_0200', 0, async function (done) {
console.log("==================FWK_UnzipFile_0200 start==================");
var src = "/data/test/";
var dest = "/data/testA/ceshi.txt.zip";
var options = {}
zlib.unzipFile(src, dest, options,
(err, data) => {
console.log("unzipFileCallBack_0300 err: " + err.code);
console.log("unzipFileCallBack_0300 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
console.log("unzipfilecallback_0200 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done();
});
})
function timeout() {
expect().assertFail();
console.debug('ACTS_unzipFile_0300=====timeout======');
}
setTimeout(timeout, 5000);
done();
/*
* @tc.number: FWK_UnzipFile_0300
* @tc.name: unzipFile
* @tc.desc: unzipFile
*/
it('FWK_UnzipFile_0300', 0, async function (done) {
console.log("==================FWK_UnzipFile_0300 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "";
var options = {}
zlib.unzipFile(src, dest, options,
(err, data) => {
console.log("unzipfilecallback_0300 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done();
});
})
/*
* @tc.number: ACTS_unzipFile_0400
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_0400
* @tc.name: unzipFile
* @tc.desc: unzipFile
*/
it('ACTS_unzipFile_0400', 0, async function (done) {
console.log("==================ACTS_unzipFile_0400 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/testA/";
zlib.unzipFile(src,dest,
it('FWK_UnzipFile_0400', 0, async function (done) {
console.log("==================FWK_UnzipFile_0400 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testB";
var options = {}
zlib.unzipFile(src, dest, options,
(err, data) => {
console.log("unzipFileCallBack_0400 err: " + err.code);
console.log("unzipFileCallBack_0400 data: " + data);
expect(err).assertEqual(0);
expect(data).assertEqual(0);
});
function timeout() {
expect().assertFail();
console.debug('ACTS_unzipFile_0400=====timeout======');
}
setTimeout(timeout, 5000);
done();
console.log("unzipfilecallback_0400 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done();
});
})
/*
* @tc.number: ACTS_unzipFile_0500
* @tc.number: FWK_UnzipFile_0500
* @tc.name: unzipFile :
* @tc.desc:
* @tc.desc: flushFlush.FLUSH_TYPE_NO_FLUSH
*/
it('ACTS_unzipFile_0500', 0, async function (done) {
console.log("==================ACTS_unzipFile_0500 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
it('FWK_UnzipFile_0500', 0, async function (done) {
console.log("==================FWK_UnzipFile_0500 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_NO_FLUSH,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_0500 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_0500 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_0500 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_0500 big=" + big);
console.log("ACTS_unzipFile_0500 small=" + small);
console.log("ACTS_unzipFile_0500 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_0500 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_0500=====size======');
try {
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_0500 destSize=" + destSize);
console.log("FWK_UnzipFile_0500 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_0500 size err:' + err);
} catch(err) {
console.error('FWK_UnzipFile_0500 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_unzipFile_0500=====timeout======');
}, '1000');
console.log("==================FWK_UnzipFile_0500 end==================");
})
/*
* @tc.number: ACTS_unzipFile_0600
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_0600
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_PARTIAL_FLUSH
*/
it('ACTS_unzipFile_0600', 0, async function (done) {
console.log("==================ACTS_unzipFile_0600 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
it('FWK_UnzipFile_0600', 0, async function (done) {
console.log("==================FWK_UnzipFile_0600 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_PARTIAL_FLUSH,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_0600 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_0600 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_0600 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_0600 big=" + big);
console.log("ACTS_unzipFile_0600 small=" + small);
console.log("ACTS_unzipFile_0600 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_0600 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_0600=====size======');
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_0600 destSize=" + destSize);
console.log("FWK_UnzipFile_0600 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_0600 size err:' + err);
console.error('FWK_UnzipFile_0600 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_unzipFile_0600=====timeout======');
}, '1000');
console.log("==================FWK_UnzipFile_0600 end==================");
})
/*
* @tc.number: ACTS_unzipFile_0700
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_0700
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_SYNC_FLUSH
*/
it('ACTS_unzipFile_0700', 0, async function (done) {
console.log("==================ACTS_unzipFile_0700 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
it('FWK_UnzipFile_0700', 0, async function (done) {
console.log("==================FWK_UnzipFile_0700 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_SYNC_FLUSH,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_0700 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_0700 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_0700 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_0700 big=" + big);
console.log("ACTS_unzipFile_0700 small=" + small);
console.log("ACTS_unzipFile_0700 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_0700 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_0700=====size======');
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_0700 destSize=" + destSize);
console.log("FWK_UnzipFile_0700 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_0700 size err:' + err);
console.error('FWK_UnzipFile_0700 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_unzipFile_0700=====timeout======');
}, '1000');
console.log("==================FWK_UnzipFile_0700 end==================");
})
/*
* @tc.number: ACTS_unzipFile_0800
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_0800
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_FULL_FLUSH
*/
it('ACTS_unzipFile_0800', 0, async function (done) {
console.log("==================ACTS_unzipFile_0800 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
it('FWK_UnzipFile_0800', 0, async function (done) {
console.log("==================FWK_UnzipFile_0800 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_FULL_FLUSH,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_0800 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_0800 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_0800 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_0800 big=" + big);
console.log("ACTS_unzipFile_0800 small=" + small);
console.log("ACTS_unzipFile_0800 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_0800 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_0800=====size======');
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_0800 destSize=" + destSize);
console.log("FWK_UnzipFile_0800 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_0800 size err:' + err);
console.error('FWK_UnzipFile_0800 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_unzipFile_0800=====timeout======');
}, '1000');
console.log("==================FWK_UnzipFile_0800 end==================");
})
/*
* @tc.number: ACTS_unzipFile_0900
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_0900
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_FINISH
*/
it('ACTS_unzipFile_0900', 0, async function (done) {
it('FWK_UnzipFile_0900', 0, async function (done) {
console.log("==================ACTS_unzipFile_0900 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_FINISH,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_0900 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_0900 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_0900 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_0900 big=" + big);
console.log("ACTS_unzipFile_0900 small=" + small);
console.log("ACTS_unzipFile_0900 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_0900 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_0900=====size======');
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_FINISH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_0900 destSize=" + destSize);
console.log("FWK_UnzipFile_0900 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_0900 size err:' + err);
console.error('FWK_UnzipFile_0900 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_unzipFile_0900=====timeout======');
}, '1000');
console.log("==================FWK_UnzipFile_0900 end==================");
})
/*
* @tc.number: ACTS_unzipFile_1000
* @tc.name: unzipFile :
* @tc.desc:
* @tc.number: FWK_UnzipFile_1000
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_BLOCK
*/
it('ACTS_unzipFile_1000', 0, async function (done) {
console.log("==================ACTS_unzipFile_1000 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
it('FWK_UnzipFile_1000', 0, async function (done) {
console.log("==================FWK_UnzipFile_1000 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_BLOCK,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_1000 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_1000 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_1000 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_1000 big=" + big);
console.log("ACTS_unzipFile_1000 small=" + small);
console.log("ACTS_unzipFile_1000 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_1000 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_1000=====size======');
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_BLOCK,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_1000 destSize=" + destSize);
console.log("FWK_UnzipFile_1000 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_1000 size err:' + err);
console.error('FWK_UnzipFile_1000 err:' + err);
done();
}
console.log("==================FWK_UnzipFile_1000 end==================");
})
/*
* @tc.number: FWK_UnzipFile_1100
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_TREES
*/
it('FWK_UnzipFile_1100', 0, async function (done) {
console.log("==================ACTS_unzipFile_1100 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_TREES,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_1100 destSize=" + destSize);
console.log("FWK_UnzipFile_1100 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('FWK_UnzipFile_1100 err:' + err);
done();
}
console.log("==================FWK_UnzipFile_1100 end==================");
})
/*
* @tc.number: FWK_UnzipFile_1200
* @tc.name: zipFile
* @tc.desc: inFile doesn't exist
*/
it('FWK_UnzipFile_1200', 0, async function (done) {
console.log("==================FWK_UnzipFile_1200 start==================");
var src = "/data/noExist.txt";
var dest = "/data/test/";
var options = {}
zlib.unzipFile(src, dest, options).then((data) => {
console.log("FWK_UnzipFile_1200 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR);
done();
}).catch((err)=>{
console.log("FWK_UnzipFile_1200 err: " + err);
done();
});
console.log("==================FWK_UnzipFile_1200 end ==================");
})
/*
* @tc.number: FWK_UnzipFile_1300
* @tc.name: zipFile
* @tc.desc: inFile is a directory that doesn't exist
*/
it('FWK_UnzipFile_1300', 0, async function (done) {
console.log("==================FWK_UnzipFile_1300 start==================");
var src = "/data/test";
var dest = "/data/testA/ceshi.txt";
var options = {}
zlib.unzipFile(src, dest, options).then((data) => {
console.log("FWK_UnzipFile_1300 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done();
}).catch((err)=>{
console.log("FWK_UnzipFile_1300 err: " + err);
done();
});
console.log("==================FWK_UnzipFile_1300 end ==================");
})
setTimeout(function(){
console.debug('ACTS_unzipFile_1000=====timeout======');
}, '1000');
/*
* @tc.number: FWK_UnzipFile_1400
* @tc.name: zipFile
* @tc.desc:output file not specified
*/
it('FWK_UnzipFile_1400', 0, async function (done) {
console.log("==================FWK_UnzipFile_1400 start==================");
var src = "/data/test/ceshi.txt";
var dest = "/data/testB/ceshi.txt.zip";
var options = {}
zlib.unzipFile(src, dest, options).then((data) => {
console.log("FWK_UnzipFile_1400 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done();
}).catch((err)=>{
console.log("FWK_UnzipFile_1400 err: " + err);
done();
});
console.log("==================FWK_UnzipFile_1400 end ==================");
})
/*
* @tc.number: ACTS_unzipFile_1100
* @tc.number: FWK_UnzipFile_1500
* @tc.name: zipFile
* @tc.desc:output file not specified
*/
it('FWK_UnzipFile_1500', 0, async function (done) {
console.log("==================FWK_UnzipFile_1500 start==================");
var src = "/data/testB/ceshi.txt.zip";
var dest = "/data/testA/ceshi.txt";
var options = {}
zlib.unzipFile(src, dest, options).then((data) => {
console.log("FWK_UnzipFile_1500 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR);
done();
}).catch((err)=>{
console.log("FWK_UnzipFile_1500 err: " + err);
done();
});
console.log("==================FWK_UnzipFile_1500 end ==================");
})
/*
* @tc.number: FWK_UnzipFile_1600
* @tc.name: unzipFile :
* @tc.desc:
* @tc.desc: flushFlush.FLUSH_TYPE_NO_FLUSH
*/
it('FWK_UnzipFile_1600', 0, async function (done) {
console.log("==================FWK_UnzipFile_1600 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_1100 destSize=" + destSize);
console.log("FWK_UnzipFile_1100 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('FWK_UnzipFile_01600 err:' + err);
done();
}
console.log("==================FWK_UnzipFile_01600 end==================");
})
it('ACTS_unzipFile_1100', 0, async function (done) {
console.log("==================ACTS_unzipFile_1100 start==================");
var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip";
var dest ="/data/test/amsZipfileUnzipfileST.hap";
/*
* @tc.number: FWK_UnzipFile_1700
* @tc.name: unzipFile
* @tc.desc: flushFlush.FLUSH_TYPE_FINISH
*/
it('FWK_UnzipFile_1700', 0, async function (done) {
console.log("==================FWK_UnzipFile_1700 start==================");
var src = "/data/testA/ceshi.txt.zip";
var dest = "/data/testA";
var origin = "/data/test/ceshi.txt";
var destFile = "/data/testA/ceshi.txt";
try{
var Options= {
flushFlush:FLUSH_TYPE_TREES,
};
await zlib.unzipFile(src,dest,Options,
() => {
console.log("ACTS_unzipFile_1100 err:================================ ");
try{
var isfileio = fileio.accessSync(dest)
console.log("ACTS_unzipFile_1100 isfileio:==============> "+JSON.stringify(isfileio));
var isDest = (fileio.accessSync(dest) !== null)
console.log("ACTS_unzipFile_1100 isDest:==============> " +isDest);
expect(isDest).assertTrue();
var big = fileio.statSync(src).size;
var small = fileio.statSync(dest).size;
var isBigSmall = (big<=small)
expect(isBigSmall).assertTrue();
console.log("ACTS_unzipFile_1100 big=" + big);
console.log("ACTS_unipFile_1100 small=" + small);
console.log("ACTS_unzipFile_1100 big<=small=" + isBigSmall);
}catch(err) {
console.error('ACTS_unzipFile_1100 assertTure err:' + err);
}
console.debug('ACTS_unzipFile_1100=====size======');
var options = {};
options.flushFlush = zlib.FlushType.FLUSH_TYPE_FINISH,
await zlib.unzipFile(src, dest, options,
(err, data) => {
var smallStat = fileio.statSync(destFile);
var isFile = smallStat.isFile();
expect(isFile).assertTrue();
var destSize = smallStat.size;
var originStat = fileio.statSync(origin);
var originSize = originStat.size;
console.log("FWK_UnzipFile_1700 destSize=" + destSize);
console.log("FWK_UnzipFile_1700 data=" + data);
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
});
}catch(err) {
console.error('ACTS_unzipFile_0500 size err:' + err);
console.error('FWK_UnzipFile_1700 err:' + err);
done();
}
setTimeout(function(){
console.debug('ACTS_unzipFile_1100=====timeout======');
}, '1000');
console.log("==================FWK_UnzipFile_1700 end==================");
})
})
......@@ -19,20 +19,21 @@
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
"mkdir /data/test"
]
},
{
"type": "PushKit",
"push": [
"amsStDataAbility.hap->/system/vendor/amsStDataAbility.hap"
"amsStDataAbility.hap->/data/test/amsStDataAbility.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
"chmod 644 /data/test/*.hap",
"bm install -p /data/test/amsStDataAbility.hap"
]
}
]
......
......@@ -26,7 +26,8 @@ group("bundlemanager") {
"actsbmsmoduleusagerecordtest:ActsBmsModuleUsageRecordTest",
"actsbundlemanagertest:ActsBundleManagerTest",
"actsbundlemanageruninstall:ActsBundleManagerUninstall",
"bmscheckpermissiontest:BmsCheckPermissionTest",
# "bmscheckpermissiontest:BmsCheckPermissionTest",
"sceneProject/bmsgetinfosfifthscene:bmsThirdBundleTest5",
"sceneProject/bmsgetinfosfirstscene:bmsThirdBundleTest1",
"sceneProject/bmsgetinfosfirstsceneupdate:bmsThirdBundleTestA1",
......
......@@ -16,7 +16,6 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 1000;
const NAMECOUNT = 10000;
describe('ActsBmsAllShortcutInfoTest', function () {
......@@ -29,45 +28,51 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_0100', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_0100==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
await install(bundlePath);
var bundleName = 'com.example.third1';
bundle.getAllShortcutInfo(bundleName).then(async(data) => {
for (var i = 0; i < data.length; i++) {
expect(data[i].id).assertEqual('id.third1');
console.info('==========data[i].id==========' + data[i].id)
expect(data[i].bundleName).assertEqual('com.example.third1');
console.info('==========data[i].bundleName==========' + data[i].bundleName)
expect(data[i].hostAbility).assertEqual("");
console.info('==========data[i].hostAbility==========' + data[i].hostAbility)
expect(data[i].icon).assertEqual('$media:icon');
console.info('==========data[i].icon==========' + data[i].icon)
expect(data[i].label).assertEqual('$string:app_name');
console.info('==========data[i].label==========' + data[i].label)
expect(data[i].disableMessage).assertEqual("");
console.info('==========data[i].disableMessage==========' + data[i].disableMessage)
expect(data[i].isStatic).assertEqual(false);
console.info('==========data[i].isStatic==========' + data[i].isStatic)
expect(data[i].isHomeShortcut).assertEqual(false);
console.info('==========data[i].isHomeShortcut==========' + data[i].isHomeShortcut)
expect(data[i].isEnabled).assertEqual(false);
console.info('==========data[i].isEnabled==========' + data[i].isEnabled)
for (var j = 0; j < data[i].wants.length; j++) {
console.info('==========data[i].wants[j].targetClass==========' + data[i].wants[j].targetClass)
expect(data[i].wants[j].targetClass).assertEqual('com.example.third1.MainAbility');
console.info('==========data[i].wants[j].targetBundle==========' + data[i].wants[j].targetBundle)
expect(data[i].wants[j].targetBundle).assertEqual('com.example.third1');
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
let shortInfos = await bundle.getAllShortcutInfo(bundleName)
expect(typeof shortInfos).assertEqual('object');
expect(shortInfos.length).assertEqual(1);
for (var i = 0; i < shortInfos.length; i++) {
expect(shortInfos[i].id).assertEqual('id.third1');
expect(shortInfos[i].bundleName).assertEqual('com.example.third1');
expect(shortInfos[i].hostAbility).assertEqual("");
expect(shortInfos[i].icon).assertEqual('$media:icon');
expect(shortInfos[i].label).assertEqual('$string:app_name');
expect(shortInfos[i].disableMessage).assertEqual("");
expect(shortInfos[i].isStatic).assertEqual(false);
expect(shortInfos[i].isHomeShortcut).assertEqual(false);
expect(shortInfos[i].isEnabled).assertEqual(false);
for (var j = 0; j < shortInfos[i].wants.length; j++) {
expect(shortInfos[i].wants[j].targetClass).assertEqual('com.example.third1.MainAbility');
expect(shortInfos[i].wants[j].targetBundle).assertEqual('com.example.third1');
}
}
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.third1', 'third1');
await uninstall('com.example.third1');
checkShortcutIsExist(shortInfos, 'id.third1', 'third1');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, OnReceiveUninstallEvent);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0100==================end');
}, TIMEOUT)
};
function OnReceiveUninstallEvent(err, data) {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
};
});
/*
......@@ -78,18 +83,36 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_0200', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_0200==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
await install(bundlePath);
var bundleName = 'com.example.third1';
bundle.getAllShortcutInfo(bundleName, async(result, data) => {
expect(result.code).assertEqual(0);
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.third1', 'third1');
await uninstall('com.example.third1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0200==================end');
}, TIMEOUT)
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, OnReceiveInstallEvent);
function OnReceiveInstallEvent(err, data) {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
bundle.getAllShortcutInfo(bundleName, async (result, shortcutInfos) => {
expect(result.code).assertEqual(0);
expect(shortcutInfos.length).assertEqual(1);
checkShortcutIsExist(shortcutInfos, 'id.third1', 'third1');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
}
})
/*
......@@ -102,17 +125,33 @@ describe('ActsBmsAllShortcutInfoTest', function () {
console.info('=====================bms_getAllShortcutInfo_0300==================');
var bundleName = 'com.example.third1';
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'];
await install(bundlePath);
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(2);
checkShortcutIsExist(data, 'id.third1', 'third1');
checkShortcutIsExist(data, 'id.third3', 'third3');
await uninstall('com.example.third1');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0300==================end');
}, TIMEOUT)
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
var shortInfos = await bundle.getAllShortcutInfo(bundleName);
expect(typeof shortInfos).assertEqual('object');
expect(shortInfos.length).assertEqual(2);
checkShortcutIsExist(shortInfos, 'id.third1', 'third1');
checkShortcutIsExist(shortInfos, 'id.third3', 'third3');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
})
/*
......@@ -123,19 +162,35 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_0400', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_0400==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'];
await install(bundlePath);
var bundleName = 'com.example.third1';
bundle.getAllShortcutInfo(bundleName, async (result, data) => {
expect(result.code).assertEqual(0);
expect(data.length).assertEqual(2);
checkShortcutIsExist(data, 'id.third1', 'third1');
checkShortcutIsExist(data, 'id.third3', 'third3');
await uninstall('com.example.third1');
done();
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
bundle.getAllShortcutInfo(bundleName, async (result, shortInfos) => {
expect(result.code).assertEqual(0);
expect(shortInfos.length).assertEqual(2);
checkShortcutIsExist(shortInfos, 'id.third1', 'third1');
checkShortcutIsExist(shortInfos, 'id.third3', 'third3');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0400==================end');
}, TIMEOUT)
})
/*
......@@ -149,9 +204,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0500==================end');
}, TIMEOUT)
})
/*
......@@ -167,9 +219,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0600==================end');
}, TIMEOUT)
})
/*
......@@ -182,35 +231,60 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_0700', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_0700==================');
var bundlePath1 = ['/data/test/bmsThirdBundleTest1.hap'];
await install(bundlePath1);
var bundleName = 'com.example.third1';
var bundlePath2 = ['/data/test/bmsThirdBundleTestA1.hap'];
await install(bundlePath2);
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof data[i]).assertEqual('object');
expect(typeof data[i].id).assertEqual('string');
expect(data[i].id).assertEqual('id.thirdA1');
expect(typeof data[i].disableMessage).assertEqual('string');
expect(typeof data[i].isStatic).assertEqual('boolean');
expect(typeof data[i].isHomeShortcut).assertEqual('boolean');
expect(typeof data[i].isEnabled).assertEqual('boolean');
expect(typeof data[i].hostAbility).assertEqual('string');
expect(typeof data[i].wants).assertEqual('object')
if (typeof data[i].wants != 'undefined' && Object.keys(data[i].wants).length != 0) {
for (var j = 0; j < data[i].wants.length; j++) {
expect(data[i].wants[j].targetClass).assertEqual('com.example.third1.AMainAbility');
expect(data[i].wants[j].targetBundle).assertEqual('com.example.third1');
}
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}
await uninstall('com.example.third1')
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0700==================end');
}, TIMEOUT)
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
installer.install(bundlePath2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
var shortInfos = await bundle.getAllShortcutInfo(bundleName);
expect(typeof shortInfos).assertEqual('object');
expect(shortInfos.length).assertEqual(1);
for (var i = 0; i < shortInfos.length; i++) {
expect(typeof shortInfos[i]).assertEqual('object');
expect(typeof shortInfos[i].id).assertEqual('string');
expect(shortInfos[i].id).assertEqual('id.thirdA1');
expect(typeof shortInfos[i].disableMessage).assertEqual('string');
expect(typeof shortInfos[i].isStatic).assertEqual('boolean');
expect(typeof shortInfos[i].isHomeShortcut).assertEqual('boolean');
expect(typeof shortInfos[i].isEnabled).assertEqual('boolean');
expect(typeof shortInfos[i].hostAbility).assertEqual('string');
expect(typeof shortInfos[i].wants).assertEqual('object')
if (typeof shortInfos[i].wants != 'undefined' && Object.keys(shortInfos[i].wants).length != 0) {
for (var j = 0; j < shortInfos[i].wants.length; j++) {
expect(shortInfos[i].wants[j].targetClass).assertEqual('com.example.third1.AMainAbility');
expect(shortInfos[i].wants[j].targetBundle).assertEqual('com.example.third1');
}
}
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
});
})
/*
......@@ -222,35 +296,60 @@ describe('ActsBmsAllShortcutInfoTest', function () {
console.info('=====================bms_getAllShortcutInfo_0800==================');
var bundleName = 'com.example.third1';
var bundlePath1 = ['/data/test/bmsThirdBundleTest1.hap'];
await install(bundlePath1);
var bundlePath2 = ['/data/test/bmsThirdBundleTestA1.hap'];
await install(bundlePath2);
bundle.getAllShortcutInfo(bundleName, async (result, data) => {
expect(result.code).assertEqual(0);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof data[i]).assertEqual('object');
expect(typeof data[i].id).assertEqual('string');
expect(data[i].id).assertEqual('id.thirdA1');
expect(typeof data[i].disableMessage).assertEqual('string');
expect(typeof data[i].isStatic).assertEqual('boolean');
expect(typeof data[i].isHomeShortcut).assertEqual('boolean');
expect(typeof data[i].isEnabled).assertEqual('boolean');
expect(typeof data[i].hostAbility).assertEqual('string');
expect(typeof data[i].wants).assertEqual('object')
if (typeof data[i].wants != 'undefined' && Object.keys(data[i].wants).length != 0) {
for (var j = 0; j < data[i].wants.length; j++) {
expect(data[i].wants[j].targetClass).assertEqual('com.example.third1.AMainAbility');
expect(data[i].wants[j].targetBundle).assertEqual('com.example.third1');
}
}
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
await uninstall('com.example.third1');
done();
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
installer.install(bundlePath2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
bundle.getAllShortcutInfo(bundleName, async (result, shortInfos) => {
expect(result.code).assertEqual(0);
expect(shortInfos.length).assertEqual(1);
for (var i = 0; i < shortInfos.length; i++) {
expect(typeof shortInfos[i]).assertEqual('object');
expect(typeof shortInfos[i].id).assertEqual('string');
expect(shortInfos[i].id).assertEqual('id.thirdA1');
expect(typeof shortInfos[i].disableMessage).assertEqual('string');
expect(typeof shortInfos[i].isStatic).assertEqual('boolean');
expect(typeof shortInfos[i].isHomeShortcut).assertEqual('boolean');
expect(typeof shortInfos[i].isEnabled).assertEqual('boolean');
expect(typeof shortInfos[i].hostAbility).assertEqual('string');
expect(typeof shortInfos[i].wants).assertEqual('object')
if (typeof shortInfos[i].wants != 'undefined' && Object.keys(shortInfos[i].wants).length != 0) {
for (var j = 0; j < shortInfos[i].wants.length; j++) {
expect(shortInfos[i].wants[j].targetClass).assertEqual('com.example.third1.AMainAbility');
expect(shortInfos[i].wants[j].targetBundle).assertEqual('com.example.third1');
}
}
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
});
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0800==================end');
}, TIMEOUT)
})
/*
......@@ -262,15 +361,29 @@ describe('ActsBmsAllShortcutInfoTest', function () {
console.info('=====================bms_getAllShortcutInfo_0900==================');
var bundleName = 'com.example.third2';
var bundlePath = ['/data/test/bmsThirdBundleTest2.hap'];
await install(bundlePath);
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(0);
await uninstall('com.example.third2')
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0900==================end');
}, TIMEOUT)
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
var shortcutInfos = await bundle.getAllShortcutInfo(bundleName);
expect(typeof shortcutInfos).assertEqual('object');
expect(shortcutInfos.length).assertEqual(0);
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
})
/*
......@@ -282,16 +395,32 @@ describe('ActsBmsAllShortcutInfoTest', function () {
console.info('=====================bms_getAllShortcutInfo_1000==================');
var bundleName = 'com.example.third2';
var bundlePath = ['/data/test/bmsThirdBundleTest2.hap'];
await install(bundlePath);
bundle.getAllShortcutInfo(bundleName, async (result, data) => {
expect(result.code).assertEqual(0);
expect(data.length).assertEqual(0);
await uninstall('com.example.third2');
done();
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
bundle.getAllShortcutInfo(bundleName, async (result, shortcutInfos) => {
expect(result.code).assertEqual(0);
expect(shortcutInfos.length).assertEqual(0);
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1000==================end');
}, TIMEOUT)
})
/*
......@@ -307,9 +436,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.system1', 'system1');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1100==================end');
}, TIMEOUT)
})
/*
......@@ -326,9 +452,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.system1', 'system1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1200==================end');
}, TIMEOUT)
})
/*
......@@ -344,9 +467,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.vendor1', 'vendor1');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1300==================end');
}, TIMEOUT)
})
/*
......@@ -363,9 +483,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.vendor1', 'vendor1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1400==================end');
}, TIMEOUT)
})
/*
......@@ -378,19 +495,31 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_1500', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_1500==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
await install(bundlePath);
var bundleName = 'com.example.third1';
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.third1', 'third1');
await uninstall('com.example.third1');
var info = await bundle.getAllShortcutInfo(bundleName);
expect(info.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1500==================end');
}, TIMEOUT)
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
var shortcutInfos = await bundle.getAllShortcutInfo(bundleName);
checkShortcutIsExist(shortcutInfos, 'id.third1', 'third1');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
var shortcutInfos = await bundle.getAllShortcutInfo(bundleName);
expect(shortcutInfos.length).assertEqual(0);
done();
});
});
})
/*
......@@ -401,21 +530,35 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_1600', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_1600==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
await install(bundlePath);
var bundleName = 'com.example.third1';
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.third1', 'third1');
await uninstall('com.example.third1');
bundle.getAllShortcutInfo(bundleName, async(result, data) => {
expect(result.code).assertEqual(-1);
expect(data.length).assertEqual(0);
done();
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.third1', 'third1');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
bundle.getAllShortcutInfo(bundleName, async (result, data) => {
expect(result.code).assertEqual(-1);
expect(data.length).assertEqual(0);
done();
});
});
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1600==================end');
}, TIMEOUT)
})
/*
......@@ -427,17 +570,33 @@ describe('ActsBmsAllShortcutInfoTest', function () {
console.info('=====================bms_getAllShortcutInfo_1700==================');
var bundleName = 'com.example.third4';
var bundlePath = ['/data/test/bmsThirdBundleTest4.hap'];
await install(bundlePath);
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(2);
checkShortcutIsExist(data, 'id.third4A', 'third4A');
checkShortcutIsExist(data, 'id.third4B', 'third4B');
await uninstall('com.example.third4')
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1700==================end');
}, TIMEOUT)
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
var shortcutInfos = await bundle.getAllShortcutInfo(bundleName);
expect(typeof shortcutInfos).assertEqual('object');
expect(shortcutInfos.length).assertEqual(2);
checkShortcutIsExist(shortcutInfos, 'id.third4A', 'third4A');
checkShortcutIsExist(shortcutInfos, 'id.third4B', 'third4B');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
})
/*
......@@ -448,19 +607,31 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_1800', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_1800==================');
var bundleName = 'com.example.third4';
var bundlePath = ['/data/test/bmsThirdBundleTest4.hap'];
await install(bundlePath);
bundle.getAllShortcutInfo(bundleName, async (result, data) => {
expect(result.code).assertEqual(0);
expect(data.length).assertEqual(2);
checkShortcutIsExist(data, 'id.third4A', 'third4A');
checkShortcutIsExist(data, 'id.third4B', 'third4B');
await uninstall('com.example.third4');
done();
let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest4.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
bundle.getAllShortcutInfo(bundleName, async (result, shortcutInfos) => {
expect(result.code).assertEqual(0);
expect(shortcutInfos.length).assertEqual(2);
checkShortcutIsExist(shortcutInfos, 'id.third4A', 'third4A');
checkShortcutIsExist(shortcutInfos, 'id.third4B', 'third4B');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.statusMessage).assertEqual("SUCCESS");
done();
});
});
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1800==================end');
}, TIMEOUT)
})
/*
......@@ -475,9 +646,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1900==================end');
}, TIMEOUT)
})
/*
......@@ -493,9 +661,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_2000==================end');
}, TIMEOUT)
})
/*
......@@ -513,9 +678,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_2100==================end');
}, TIMEOUT)
})
/*
......@@ -534,9 +696,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_2200==================end');
}, TIMEOUT)
})
function checkShortcutInfo(dataInfo, name) {
......@@ -562,38 +721,6 @@ describe('ActsBmsAllShortcutInfoTest', function () {
}
}
}
async function install(bundlePath) {
let result = await bundle.getBundleInstaller();
result.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, OnReceiveInstallEvent);
function OnReceiveInstallEvent(err, data) {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
};
}
async function uninstall(bundleName) {
let result = await bundle.getBundleInstaller();
result.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, OnReceiveUninstallEvent);
function OnReceiveUninstallEvent(err, data) {
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
};
}
function checkShortcutIsExist(dataInfo, shortcutId, testName) {
let info = new Map();
for (var i = 0, len = dataInfo.length; i < len; i++) {
......
......@@ -19,7 +19,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
const BUNDLE_NAME = 'com.example.actsbmscheckpermissiontest';
const PERMISSION_ONE = 'com.permission.PERMISSION_A';
const PERMISSION_TWO = 'com.permission.PERMISSION_B';
const TIMEOUT = 1000;
const NAMECOUNT = 10000;
describe('ActsBmsCheckPermissionTest', function () {
......@@ -34,9 +33,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_ONE)
expect(data).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0100==================end');
}, TIMEOUT)
})
/*
......@@ -51,9 +47,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(0);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0200==================end');
}, TIMEOUT)
})
/*
......@@ -67,9 +60,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission('', PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0300==================end');
}, TIMEOUT)
})
/*
......@@ -85,9 +75,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0400==================end');
}, TIMEOUT)
})
/*
......@@ -101,9 +88,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, '')
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0500==================end');
}, TIMEOUT)
})
/*
......@@ -119,9 +103,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0600==================end');
}, TIMEOUT)
})
/*
......@@ -135,9 +116,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, '@\n,. 。测试@abc1^%12345')
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0700==================end');
}, TIMEOUT)
})
/*
......@@ -153,9 +131,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0800==================end');
}, TIMEOUT)
})
/*
......@@ -169,9 +144,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission('@\n,. 。测试@abc1^%12345', PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0900==================end');
}, TIMEOUT)
})
/*
......@@ -187,9 +159,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1000==================end');
}, TIMEOUT)
})
/*
......@@ -207,9 +176,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, permissionName)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1100==================end');
}, TIMEOUT)
})
/*
......@@ -229,9 +195,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1200==================end');
}, TIMEOUT)
})
/*
......@@ -249,9 +212,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(bundleName, PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1300==================end');
}, TIMEOUT)
})
/*
......@@ -271,9 +231,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1400==================end');
}, TIMEOUT)
})
/*
......@@ -287,9 +244,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO)
expect(data).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1500==================end');
}, TIMEOUT)
})
/*
......@@ -305,8 +259,5 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(0);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1600==================end');
}, TIMEOUT)
})
})
\ No newline at end of file
......@@ -16,8 +16,6 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 2000;
describe('ActsBmsHapModuleTest', function () {
/*
......@@ -27,52 +25,63 @@ describe('ActsBmsHapModuleTest', function () {
*/
it('bms_getHapModuleInfo_0100', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0100===========')
await install(['/data/test/bmsMainAbilityFirstScene.hap']);
var bundlePath = ['/data/test/bmsMainAbilityFirstScene.hap'];
let bundleName = 'com.example.bmsmainabilityfirstscene';
let ret = false
bundle.getBundleInfo(bundleName, 1, callback);
async function callback(err, data) {
console.debug('=======get bundle========' + JSON.stringify(data));
expect(data.hapModuleInfo.length).assertEqual(1);
if (data.hapModuleInfo.length > 0) {
let hapModuleInfo = data.hapModuleInfo[0];
console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo))
console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName)
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
expect(hapModuleInfo.name).assertEqual('com.example.bmsmainabilityfirstscene');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual('');
expect(hapModuleInfo.supportedModes).assertEqual(0);
console.info('===============hapModuleInfo.reqCapabilities==========' + JSON.stringify(hapModuleInfo.reqCapabilities))
expect(typeof hapModuleInfo.reqCapabilities).assertEqual('object');
expect(hapModuleInfo.deviceTypes).assertEqual('phone');
console.info('===============hapModuleInfo.abilityInfo==========' + JSON.stringify(hapModuleInfo.abilityInfo))
expect(typeof hapModuleInfo.abilityInfo).assertEqual('object');
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
expect(hapModuleInfo.installationFree).assertEqual(false);
for (let i = 0, len = hapModuleInfo.reqCapabilities.length; i < len; i++) {
console.debug('=======get reqCapabilities========' + JSON.stringify(hapModuleInfo.reqCapabilities[i]));
expect(hapModuleInfo.reqCapabilities[i]).assertEqual('');
}
for (let j = 0, len = hapModuleInfo.abilityInfo.length; j < len; j++) {
console.debug('=======get abilityInfo========' + JSON.stringify(hapModuleInfo.abilityInfo[j]))
expect(hapModuleInfo.abilityInfo[j].name).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, callback);
async function callback(err, result) {
expect(result.hapModuleInfo.length).assertEqual(1);
if (result.hapModuleInfo.length > 0) {
let hapModuleInfo = result.hapModuleInfo[0];
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
expect(hapModuleInfo.name).assertEqual('com.example.bmsmainabilityfirstscene');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual('');
expect(hapModuleInfo.supportedModes).assertEqual(0);
console.info('===============hapModuleInfo.reqCapabilities==========' + JSON.stringify(hapModuleInfo.reqCapabilities))
expect(typeof hapModuleInfo.reqCapabilities).assertEqual('object');
// expect(hapModuleInfo.deviceTypes).assertEqual('phone');
console.info('===============hapModuleInfo.abilityInfo==========' + JSON.stringify(hapModuleInfo.abilityInfo))
expect(typeof hapModuleInfo.abilityInfo).assertEqual('object');
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
expect(hapModuleInfo.installationFree).assertEqual(false);
for (let i = 0, len = hapModuleInfo.reqCapabilities.length; i < len; i++) {
expect(hapModuleInfo.reqCapabilities[i]).assertEqual('');
}
for (let j = 0, len = hapModuleInfo.abilityInfo.length; j < len; j++) {
expect(hapModuleInfo.abilityInfo[j].name).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
}
}
ret = true;
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
await uninstall(bundleName);
done();
}
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
});
/*
......@@ -82,33 +91,41 @@ describe('ActsBmsHapModuleTest', function () {
*/
it('bms_getHapModuleInfo_0200', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0200===========')
await install(['/data/test/bmsMainAbilityFirstScene.hap']);
await install(['/data/test/bmsMainAbilitySecondScene.hap']);
let ret = false
var bundlePath = ['/data/test/bmsMainAbilityFirstScene.hap', '/data/test/bmsMainAbilitySecondScene.hap'];
let bundleName = 'com.example.bmsmainabilityfirstscene';
let firstMainAbility = 'com.example.bmsmainabilityfirstscene.MainAbility';
let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility';
bundle.getBundleInfo(bundleName, 1, async (err, data) => {
console.debug('=======hapModule length========' + data.hapModuleInfo.length);
expect(data.hapModuleInfo.length).assertEqual(2);
for (let i = 0, len = data.hapModuleInfo.length; i < len; i++) {
console.debug('=======get hapModule========' + JSON.stringify(data.hapModuleInfo[i]))
console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[i].mainAbilityName);
checkHapModuleInfo(data.hapModuleInfo[i]);
}
if (data.hapModuleInfo.length == 2) {
expect(data.hapModuleInfo[0].mainAbilityName).assertEqual(firstMainAbility);
expect(data.hapModuleInfo[0].moduleName).assertEqual('entry');
expect(data.hapModuleInfo[1].mainAbilityName).assertEqual(secondMainAbility);
expect(data.hapModuleInfo[1].moduleName).assertEqual('bmsmainabilitysecondscene');
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
await uninstall(bundleName);
ret = true;
done();
})
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
}, async (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, async (err, result) => {
expect(result.hapModuleInfo.length).assertEqual(2);
if (result.hapModuleInfo.length == 2) {
expect(result.hapModuleInfo[0].mainAbilityName).assertEqual(firstMainAbility);
expect(result.hapModuleInfo[0].moduleName).assertEqual('entry');
checkHapModuleInfo(result.hapModuleInfo[0]);
expect(result.hapModuleInfo[1].mainAbilityName).assertEqual(secondMainAbility);
expect(result.hapModuleInfo[1].moduleName).assertEqual('bmsmainabilitysecondscene');
checkHapModuleInfo(result.hapModuleInfo[1]);
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
});
});
})
/*
......@@ -118,25 +135,52 @@ describe('ActsBmsHapModuleTest', function () {
*/
it('bms_getHapModuleInfo_0300', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0300===========')
await install(['/data/test/bmsThirdBundleTest2.hap']);
var bundlePath = ['/data/test/bmsThirdBundleTest2.hap'];
let bundleName = 'com.example.third2';
let ret = false;
bundle.getBundleInfo(bundleName, 1,).then(async (data) => {
console.debug('=======get hapModule========' + JSON.stringify(data))
expect(data.hapModuleInfo.length).assertEqual(1);
if (data.hapModuleInfo.length > 0) {
console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[0].mainAbilityName)
expect(data.hapModuleInfo[0].mainAbilityName).assertEqual('');
expect(data.hapModuleInfo[0].moduleName).assertEqual('entry');
checkHapModuleInfo(data.hapModuleInfo[0]);
ret = true;
var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer);
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
await uninstall(bundleName);
done();
})
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
}, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1,).then(async (result) => {
console.debug('=======get hapModule========' + JSON.stringify(result))
expect(result.hapModuleInfo.length).assertEqual(1);
if (result.hapModuleInfo.length > 0) {
console.debug('=======get hapModule mainAbilityName========' + result.hapModuleInfo[0].mainAbilityName)
expect(result.hapModuleInfo[0].mainAbilityName).assertEqual('');
expect(result.hapModuleInfo[0].moduleName).assertEqual('entry');
checkHapModuleInfo(result.hapModuleInfo[0]);
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) {
console.info('========uninstall Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
}
});
}
})
/*
......@@ -146,57 +190,99 @@ describe('ActsBmsHapModuleTest', function () {
*/
it('bms_getHapModuleInfo_0400', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0400===========')
await install(['/data/test/bmsThirdBundleTest5.hap']);
var bundlePath = ['/data/test/bmsThirdBundleTest5.hap'];
let bundleName = 'com.example.third5';
let ret = true;
bundle.getBundleInfo(bundleName, 1, async (err, data) => {
console.debug('=======get hapModule========' + JSON.stringify(data))
expect(data.hapModuleInfo.length).assertEqual(1);
if (data.hapModuleInfo.length == 1) {
console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[0].mainAbilityName)
expect(data.hapModuleInfo[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility');
expect(data.hapModuleInfo[0].moduleName).assertEqual('entry');
checkHapModuleInfo(data.hapModuleInfo[0]);
ret = true;
var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer);
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
await uninstall(bundleName);
done();
}, (err, data) => {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, async (err, result) => {
console.debug('=======get hapModule========' + JSON.stringify(result))
expect(result.hapModuleInfo.length).assertEqual(1);
if (result.hapModuleInfo.length == 1) {
expect(result.hapModuleInfo[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility');
expect(result.hapModuleInfo[0].moduleName).assertEqual('entry');
checkHapModuleInfo(result.hapModuleInfo[0]);
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) {
;
expect(data.statusMessage).assertEqual('SUCCESS');
done();
}
});
})
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
})
/*
/*
* @tc.number: bms_getHapModuleInfo_0500
* @tc.name: get the hapModuleInfo of the upgraded hap package from an application through getBundleInfo
* @tc.desc: get the module information of the mainAbility upgrade hap
*/
it('bms_getHapModuleInfo_0500', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0500===========')
await install(['/data/test/bmsThirdBundleTest1.hap']);
await install(['/data/test/bmsThirdBundleTestA1.hap']);
var bundlePath1 = ['/data/test/bmsThirdBundleTest1.hap'];
var bundlePath2 = ['/data/test/bmsThirdBundleTestA1.hap'];
let bundleName = 'com.example.third1';
let ret = false
bundle.getBundleInfo(bundleName, 1, callback);
async function callback(err, data) {
console.debug('=======get bundle========' + JSON.stringify(data));
expect(data.hapModuleInfo.length).assertEqual(1);
if (data.hapModuleInfo.length == 1) {
let hapModuleInfo = data.hapModuleInfo[0];
console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo))
console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName)
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, callback);
})
})
function callback(err, result) {
expect(result.hapModuleInfo.length).assertEqual(1);
if (result.hapModuleInfo.length == 1) {
let hapModuleInfo = result.hapModuleInfo[0];
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.third1.AMainAbility');
checkHapModuleInfo(hapModuleInfo);
}
await uninstall(bundleName);
ret = true;
done();
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
done();
})
}
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
});
/*
......@@ -207,11 +293,8 @@ describe('ActsBmsHapModuleTest', function () {
it('bms_getHapModuleInfo_0600', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0600===========')
let bundleName = 'com.example.system1';
let ret = false
bundle.getBundleInfo(bundleName, 1, callback);
function callback(err, data) {
console.debug('=======get bundle========' + JSON.stringify(data));
console.debug('=======data.hapModuleInfo.length========' + data.hapModuleInfo.length);
expect(data.hapModuleInfo.length).assertEqual(1);
if (data.hapModuleInfo.length == 1) {
let hapModuleInfo = data.hapModuleInfo[0];
......@@ -220,17 +303,12 @@ describe('ActsBmsHapModuleTest', function () {
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.system1.MainAbility');
checkHapModuleInfo(hapModuleInfo);
ret = true;
}
done();
}
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
});
function checkHapModuleInfo(dataInfo) {
console.debug('========begin check hapModuleInfo========')
expect(typeof dataInfo.name).assertEqual('string');
expect(typeof dataInfo.description).assertEqual('string');
expect(typeof dataInfo.descriptionId).assertEqual('number');
......@@ -247,44 +325,4 @@ describe('ActsBmsHapModuleTest', function () {
expect(typeof dataInfo.mainAbilityName).assertEqual('string');
expect(typeof dataInfo.installationFree).assertEqual('boolean');
}
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer);
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
}
async function uninstall(bundleName) {
var installer = await bundle.getBundleInstaller();
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) {
console.info('========uninstall Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
}
})
\ No newline at end of file
......@@ -14,11 +14,7 @@
*/
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 3000;
describe('ActsBmsJsTest', function () {
/*
* @tc.number: bms_getJsAbility_0100
* @tc.name: test the multi js ability
......@@ -29,20 +25,43 @@ describe('ActsBmsJsTest', function () {
console.info('=====================bms_getJsAbility_0100==================');
let bundleName = 'com.example.third2';
let abilityName = 'com.example.third2.MainAbility';
await install(['/data/test/bmsThirdBundleTest2.hap']);
let data = await bundle.getBundleInfo(bundleName, 1);
expect(data.abilityInfo.length).assertEqual(1);
if(data.abilityInfo.length == 1){
console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo));
expect(data.abilityInfo[0].name).assertEqual(abilityName);
expect(data.abilityInfo[0].srcLanguage).assertEqual('js');
expect(data.abilityInfo[0].srcPath).assertEqual('');
var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest2.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1);
expect(result.abilityInfo.length).assertEqual(1);
if (result.abilityInfo.length == 1) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo));
expect(result.abilityInfo[0].name).assertEqual(abilityName);
expect(result.abilityInfo[0].srcLanguage).assertEqual('js');
expect(result.abilityInfo[0].srcPath).assertEqual('');
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
console.info('========uninstall Finish========');
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0100==================end');
}, TIMEOUT)
})
/*
......@@ -56,24 +75,46 @@ describe('ActsBmsJsTest', function () {
var bundleName = 'com.example.third5';
let abilityName1 = 'com.example.third5.AMainAbility';
let abilityName2 = 'com.example.third5.BMainAbility';
await install(['/data/test/bmsThirdBundleTest5.hap']);
let data = await bundle.getBundleInfo(bundleName, 1)
console.debug('==========bundleInfo==========' + JSON.stringify(data))
expect(data.abilityInfo.length).assertEqual(2);
if(data.abilityInfo.length == 2){
console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo));
expect(data.abilityInfo[0].name).assertEqual(abilityName1);
expect(data.abilityInfo[0].srcLanguage).assertEqual('js');
expect(data.abilityInfo[0].srcPath).assertEqual('');
expect(data.abilityInfo[1].name).assertEqual(abilityName2);
expect(data.abilityInfo[1].srcLanguage).assertEqual('js');
expect(data.abilityInfo[1].srcPath).assertEqual('');
var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest5.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1)
console.debug('==========bundleInfo==========' + JSON.stringify(result))
expect(result.abilityInfo.length).assertEqual(2);
if (result.abilityInfo.length == 2) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo));
expect(result.abilityInfo[0].name).assertEqual(abilityName1);
expect(result.abilityInfo[0].srcLanguage).assertEqual('js');
expect(result.abilityInfo[0].srcPath).assertEqual('');
expect(result.abilityInfo[1].name).assertEqual(abilityName2);
expect(result.abilityInfo[1].srcLanguage).assertEqual('js');
expect(result.abilityInfo[1].srcPath).assertEqual('');
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0200==================end');
}, TIMEOUT)
})
/*
......@@ -86,20 +127,43 @@ describe('ActsBmsJsTest', function () {
console.info('=====================bms_getJsAbility_0300==================');
let bundleName = 'com.example.js';
let abilityName = 'com.example.js.MainAbility';
await install(['/data/test/bmsThirdBundleJs.hap']);
let data = await bundle.getBundleInfo(bundleName, 1);
expect(data.abilityInfo.length).assertEqual(1);
if(data.abilityInfo.length == 1){
console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo));
expect(data.abilityInfo[0].name).assertEqual(abilityName);
expect(data.abilityInfo[0].srcLanguage).assertEqual('js');
expect(data.abilityInfo[0].srcPath).assertEqual('default');
var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleJs.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1);
expect(result.abilityInfo.length).assertEqual(1);
if (result.abilityInfo.length == 1) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo));
expect(result.abilityInfo[0].name).assertEqual(abilityName);
expect(result.abilityInfo[0].srcLanguage).assertEqual('js');
expect(result.abilityInfo[0].srcPath).assertEqual('default');
}
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
console.info('========uninstall Finish========');
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0300==================end');
}, TIMEOUT)
})
/*
......@@ -112,25 +176,8 @@ describe('ActsBmsJsTest', function () {
console.info('=====================bms_getJsAbility_0400==================');
let bundleName = 'com.example.c';
let abilityName = '.MainAbility';
await install(['/data/test/bmsThirdBundleC.hap']);
let data = await bundle.getBundleInfo(bundleName, 1);
expect(data.abilityInfo.length).assertEqual(1);
if(data.abilityInfo.length == 1){
console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo));
expect(data.abilityInfo[0].name).assertEqual(abilityName);
expect(data.abilityInfo[0].srcLanguage).assertEqual('c++');
expect(data.abilityInfo[0].srcPath).assertEqual('default/c++/');
}
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0300==================end');
}, TIMEOUT)
})
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
installer.install(['/data/test/bmsThirdBundleC.hap'], {
param: {
userId: 0,
installFlag: 1,
......@@ -138,33 +185,33 @@ describe('ActsBmsJsTest', function () {
}
}, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) {
async function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
}
async function uninstall(bundleName)
{
var installer = await bundle.getBundleInstaller();
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
let result = await bundle.getBundleInfo(bundleName, 1);
expect(result.abilityInfo.length).assertEqual(1);
if (result.abilityInfo.length == 1) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo));
expect(result.abilityInfo[0].name).assertEqual(abilityName);
expect(result.abilityInfo[0].srcLanguage).assertEqual('c++');
expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/');
}
}, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) {
console.info('========uninstall Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
console.info('========uninstall Finish========');
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
}
})
})
\ No newline at end of file
......@@ -9,8 +9,8 @@
"kits": [
{
"test-file-name": [
"ActsBmsKitTest.hap",
"bmsThirdBundleTest1.hap"
"bmsThirdBundleTest1.hap",
"ActsBmsKitTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -18,7 +18,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
const TIMEOUT = 2000;
const STRESSLEVEL = 20;
const BUNDLE_NAME = 'com.example.actsbmskittest';
const PERMISSION_NAME = 'com.permission.PERMISSION_A';
......@@ -64,9 +63,6 @@ describe('ActsBmsKitTest', function () {
}
}
)
setTimeout(function () {
console.info('==================beforeAll==================end');
}, TIMEOUT)
})
/*
* @tc.number: ActsBmsKit_getAllShortcutInfo_0100
......@@ -85,9 +81,6 @@ describe('ActsBmsKitTest', function () {
break;
}
done();
setTimeout(function () {
console.info('==================ActsBmsKit_getAllShortcutInfo_0100==================end');
}, TIMEOUT)
});
/*
......@@ -112,9 +105,6 @@ describe('ActsBmsKitTest', function () {
}
})
}
setTimeout(function () {
console.info('=====================ActsBmsKit_getAllShortcutInfo_0200==================end');
}, TIMEOUT)
})
/*
......@@ -133,9 +123,6 @@ describe('ActsBmsKitTest', function () {
}
}
done();
setTimeout(function () {
console.info('=====================ActsBmsKit_checkPermission_0100==================end');
}, TIMEOUT)
})
/*
......@@ -159,9 +146,6 @@ describe('ActsBmsKitTest', function () {
}
})
}
setTimeout(function () {
console.info('=====================ActsBmsKit_checkPermission_0200==================end');
}, TIMEOUT)
})
/*
......@@ -213,9 +197,6 @@ describe('ActsBmsKitTest', function () {
count++;
});
}
setTimeout(function () {
console.debug('==========ActsBmsKit_getModuleUsageRecordTest_0200==================end');
}, TIMEOUT)
})
function checkModuleUsageRecord(data, caseName) {
console.debug('======================check ModuleUsageRecord begin==========================');
......@@ -226,21 +207,21 @@ describe('ActsBmsKitTest', function () {
console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName));
expect(data[i].bundleName.length).assertLarger(0);
console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId));
expect(data[i].appLabelId).assertLarger(0);
expect(data[i].appLabelId >= 0).assertTrue();
console.debug('=============name==============' + JSON.stringify(data[i].name));
expect(data[i].name.length).assertLarger(0);
console.debug('=============labelId==============' + JSON.stringify(data[i].labelId));
expect(data[i].labelId >=0 ).assertTrue();
expect(data[i].labelId >= 0).assertTrue();
console.debug('=============descriptionId==============' + JSON.stringify(data[i].descriptionId));
expect(data[i].descriptionId).assertEqual(0);
console.debug('=============abilityName==============' + JSON.stringify(data[i].abilityName));
expect(data[i].abilityName.length).assertLarger(0);
console.debug('=============abilityLabelId==============' + JSON.stringify(data[i].abilityLabelId));
expect(data[i].abilityLabelId).assertLarger(0);
expect(data[i].abilityLabelId >= 0).assertTrue();
console.debug('===========abilityDescriptionId===========' + JSON.stringify(data[i].abilityDescriptionId));
expect(data[i].abilityDescriptionId).assertLarger(0);
expect(data[i].abilityDescriptionId >= 0).assertTrue();
console.debug('=============abilityIconId==============' + JSON.stringify(data[i].abilityIconId));
expect(data[i].abilityIconId).assertLarger(0);
expect(data[i].abilityIconId >= 0).assertTrue();
console.debug('=============launchedCount==============' + JSON.stringify(data[i].launchedCount));
expect(data[i].launchedCount).assertLarger(0);
console.debug('=============lastLaunchTime==============' + JSON.stringify(data[i].lastLaunchTime));
......
......@@ -16,8 +16,6 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 1000;
describe('ActsBmsMetaDataTest', function () {
/*
......@@ -27,57 +25,51 @@ describe('ActsBmsMetaDataTest', function () {
*/
it('bms_getMetaData_0100', 0, async function (done) {
console.info('=====================bms_getMetaData_0100==================');
await install(['/data/test/bmsThirdBundleTest1.hap'])
await install(['/data/test/bmsThirdBundleTest3.hap'])
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap']
var installer = await bundle.getBundleInstaller();
let abilityName1 = 'com.example.third1.MainAbility';
let abilityName2 = 'com.example.third3.MainAbility';
let dataMap1 = new Map();
let dataMap2 = new Map();
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: abilityName1,
},
let dataMap = new Map();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap1.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap1.has(abilityName1)).assertTrue();
expect(dataMap1.has(abilityName2)).assertTrue();
if (dataMap1.has(abilityName1) && dataMap1.has(abilityName2)) {
checkMetaData(dataMap1.get(abilityName1), 'Data1');
checkMetaData(dataMap1.get(abilityName2), 'Data3');
}
dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: abilityName2,
},
}, async (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
},
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap2.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap2.has(abilityName1)).assertTrue();
expect(dataMap2.has(abilityName2)).assertTrue();
if (dataMap2.has(abilityName1) && dataMap2.has(abilityName2)) {
checkMetaData(dataMap2.get(abilityName1), 'Data1');
checkMetaData(dataMap2.get(abilityName2), 'Data3');
}
await uninstall('com.example.third1');
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0100===========')
}, TIMEOUT);
expect(dataMap.has(abilityName1)).assertTrue();
expect(dataMap.has(abilityName2)).assertTrue();
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data1');
checkMetaData(dataMap.get(abilityName2), 'Data3');
}
installer.uninstall('com.example.third1', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
});
})
/*
......@@ -87,37 +79,59 @@ describe('ActsBmsMetaDataTest', function () {
*/
it('bms_getMetaData_0200', 0, async function (done) {
console.info('=====================bms_getMetaData_0200==================');
await install(['/data/test/bmsThirdBundleTest1.hap'])
await install(['/data/test/bmsThirdBundleTest3.hap'])
await install(['/data/test/bmsThirdBundleTestA1.hap'])
var bundlePath1 = ['/data/test/bmsThirdBundleTest1.hap']
var bundlePath2 = ['/data/test/bmsThirdBundleTestA1.hap']
let dataMap = new Map();
let abilityName1 = 'com.example.third1.AMainAbility';
let abilityName2 = 'com.example.third3.MainAbility';
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.AMainAbility',
},
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
expect(dataMap.has(abilityName2)).assertTrue();
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'DataA1');
checkMetaData(dataMap.get(abilityName2), 'Data3');
}
await uninstall('com.example.third1');
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0200===========')
}, TIMEOUT);
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.AMainAbility',
},
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'DataA1');
}
installer.uninstall('com.example.third1', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
})
})
})
/*
......@@ -127,26 +141,42 @@ describe('ActsBmsMetaDataTest', function () {
*/
it('bms_getMetaData_0300', 0, async function (done) {
console.info('=====================bms_getMetaData_0300==================');
await install(['/data/test/bmsThirdBundleTest1.hap'])
await uninstall('com.example.third1');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
},
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
let bundleName = 'com.example.third1';
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, 0, 0)
console.info('==========abilityInfo is ==========' + dataInfos);
console.info('==========abilityInfo is ==========' + JSON.stringify(dataInfos));
expect(dataInfos.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0300===========')
}, TIMEOUT);
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
},
}
}, 0, 0);
expect(dataInfos.length).assertEqual(0);
done();
});
});
})
/*
......@@ -156,35 +186,53 @@ describe('ActsBmsMetaDataTest', function () {
*/
it('bms_getMetaData_0400', 0, async function (done) {
console.info('=====================bms_getMetaData_0400==================');
await install(['/data/test/bmsThirdBundleTest5.hap']);
var bundlePath = ['/data/test/bmsThirdBundleTest5.hap']
let dataMap = new Map();
let abilityName1 = 'com.example.third5.AMainAbility';
let abilityName2 = 'com.example.third5.BMainAbility';
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third5',
abilityName: 'com.example.third5.AMainAbility',
},
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
expect(dataMap.has(abilityName2)).assertTrue();
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data5A');
checkMetaData(dataMap.get(abilityName2), 'Data5B');
}, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) {
expect(err.code).assertEqual(0);;
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third5',
abilityName: 'com.example.third5.AMainAbility',
},
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
expect(dataMap.has(abilityName2)).assertTrue();
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data5A');
checkMetaData(dataMap.get(abilityName2), 'Data5B');
}
installer.uninstall('com.example.third5', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
})
}
await uninstall('com.example.third5');
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0400===========')
}, TIMEOUT);
})
/*
......@@ -205,13 +253,8 @@ describe('ActsBmsMetaDataTest', function () {
},
}
}, 0, 0)
console.info('==========abilityInfo is ==========' + dataInfos);
console.info('==========abilityInfo is ==========' + JSON.stringify(dataInfos));
expect(dataInfos.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0500===========')
}, TIMEOUT);
})
/*
......@@ -233,7 +276,7 @@ describe('ActsBmsMetaDataTest', function () {
abilityName: 'com.example.system1.MainAbility',
},
}
}, 0, 0)
}, 0, 0);
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
......@@ -242,9 +285,6 @@ describe('ActsBmsMetaDataTest', function () {
checkMetaData(dataMap.get(abilityName1), 'Data1S');
}
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0600===========')
}, TIMEOUT);
})
/*
......@@ -266,7 +306,7 @@ describe('ActsBmsMetaDataTest', function () {
abilityName: 'com.example.vendor1.MainAbility',
},
}
}, 0, 0)
}, 0, 0);
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
......@@ -282,7 +322,7 @@ describe('ActsBmsMetaDataTest', function () {
console.debug('=====customizeDatas length=====' + customizeDatas.length);
for (let i = 0; i < parameters.length; i++) {
expect(parameters[i].description).assertEqual('$string:mainability_description');
expect(parameters[i].name).assertEqual("Data1V"+i);
expect(parameters[i].name).assertEqual("Data1V" + i);
expect(parameters[i].type).assertEqual('float');
}
for (let i = 0; i < results.length; i++) {
......@@ -297,88 +337,35 @@ describe('ActsBmsMetaDataTest', function () {
}
}
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0700===========')
}, TIMEOUT);
})
function checkMetaData(data, name) {
console.info('==========MetaData is==========' + JSON.stringify(data));
var parameters = data.parameters;
var results = data.results;
var customizeDatas = data.customizeDatas;
expect(typeof parameters).assertEqual('object');
expect(typeof results).assertEqual('object');
expect(typeof customizeDatas).assertEqual('object');
console.info('==========parameters.length is==========' + parameters.length);
console.info('==========results.length is==========' + results.length);
console.info('==========customizeDatas.length is==========' + customizeDatas.length);
expect(parameters.length).assertLarger(0);
expect(results.length).assertLarger(0);
expect(customizeDatas.length).assertLarger(0);
for (let i = 0; i < parameters.length; i++) {
console.info('==========Parameter description is==========' + parameters[i].description);
expect(typeof parameters[i].description).assertEqual('string');
console.info('==========Parameter name is==========' + parameters[i].name);
expect(typeof parameters[i].name).assertEqual('string');
expect(parameters[i].name).assertEqual(name);
console.info('==========Parameter type is==========' + parameters[i].type);
expect(typeof parameters[i].type).assertEqual('string');
}
for (let i = 0; i < results.length; i++) {
console.info('==========Results description is==========' + results[i].description);
expect(typeof results[i].description).assertEqual('string');
console.info('==========Results name is==========' + results[i].name);
expect(typeof results[i].name).assertEqual('string');
expect(results[i].name).assertEqual(name);
console.info('==========Results type is==========' + results[i].type);
expect(typeof results[i].type).assertEqual('string');
}
for (let i = 0; i < customizeDatas.length; i++) {
console.info('==========CustomizeData name is==========' + customizeDatas[i].name);
expect(typeof customizeDatas[i].name).assertEqual('string');
console.info('==========CustomizeData value is==========' + customizeDatas[i].value);
expect(typeof customizeDatas[i].value).assertEqual('string');
expect(customizeDatas[i].name).assertEqual(name);
console.info('==========CustomizeData extra is==========' + customizeDatas[i].extra);
expect(typeof customizeDatas[i].extra).assertEqual('string');
}
}
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveinstallEvent);
function onReceiveinstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
}
async function uninstall(bundleName) {
var installer = await bundle.getBundleInstaller();
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveinstallEvent);
function onReceiveinstallEvent(err, data) {
console.info('========uninstall Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
}
})
\ No newline at end of file
......@@ -15,46 +15,74 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
var subscriberInfo_0100 = {
events: ['ACTS_Third1_Publish_CommonEvent'],
};
const BUNDLE_NAME = 'com.example.third1';
const NUM_TWO = 2;
const NUM_TEN = 10;
const INVALID_NUM = -1;
const TIMEOUT = 1000;
const EVENTTIMEOUT = 2000;
const START_ABILITY_TIMEOUT = 3000;
const START_RECORD = 900;
var START_COUNT = 1;
var RECORD_COUNT = 0;
describe('ActsBmsModuleUsageRecordTest', function () {
beforeAll(async (done) => {
console.debug('=======before all install========');
await install(['/data/test/bmsThirdBundleTest1.hap'])
console.debug('=======start ability========')
sleep(TIMEOUT);
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.third1",
abilityName: "com.example.third1.MainAbility"
},
},
);
sleep(TIMEOUT);
let records = await bundle.getModuleUsageRecords(1000);
RECORD_COUNT = records.length;
for (let i = 0, len = records.length; i < len; i++) {
if (records[i].bundleName == 'com.example.third1') {
START_COUNT = records[i].launchedCount;
var subscriber;
let id;
async function subscribeCallBack(err, data) {
clearTimeout(id);
console.debug('=====subscribeCallBack=====' + data.event);
let records = await bundle.getModuleUsageRecords(START_RECORD);
RECORD_COUNT = records.length;
for (let i = 0, len = records.length; i < len; i++) {
if (records[i].bundleName == 'com.example.third1') {
START_COUNT = records[i].launchedCount;
}
}
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
console.debug('=====subscribeCallBack end=====');
done();
}
done();
setTimeout(function () {
console.debug('=======before all install finish========');
}, TIMEOUT)
commonEvent.createSubscriber(subscriberInfo_0100).then((data) => {
console.debug('====>Create Subscriber====>');
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback(err, data) {
console.debug('====>UnSubscribe CallBack====>');
done();
}
function timeout() {
console.debug('=====timeout======');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
console.debug('=======start ability========')
let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
console.debug('========install Finish========');
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
await featureAbility.startAbility(
{
want:
{
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility'
}
}
)
});
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0100
* @tc.name: getModuleUsageRecord(maxNum)
......@@ -64,55 +92,29 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_0100', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0100==================');
let records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO);
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0100');
checkModuleUsageRecord(records);
let dataMap = new Map();
for (let i = 0, length = records.length; i < length; i++) {
console.debug('=============bundleName is=========' + JSON.stringify(records[i].bundleName));
dataMap.set(records[i].bundleName, records[i]);
}
let data = dataMap.get(BUNDLE_NAME);
console.debug('=============data is=========' + JSON.stringify(data));
console.debug('=============bundleName is=========' + JSON.stringify(data.bundleName));
expect(data.bundleName).assertEqual('com.example.third1');
console.debug('=============appLabelId==============' + JSON.stringify(data.appLabelId));
expect(data.appLabelId).assertLarger(0);
console.debug('=============name==============' + JSON.stringify(data.name));
expect(data.name).assertEqual('entry');
console.debug('=============labelId==============' + JSON.stringify(data.labelId));
expect(data.labelId >= 0).assertTrue();
console.debug('=============descriptionId==============' + JSON.stringify(data.descriptionId));
expect(data.descriptionId).assertEqual(0);
console.debug('=============abilityName==============' + JSON.stringify(data.abilityName));
expect(data.abilityName).assertEqual('com.example.third1.MainAbility');
console.debug('=============abilityLabelId==============' + JSON.stringify(data.abilityLabelId));
expect(data.abilityLabelId).assertLarger(0);
console.debug('===========abilityDescriptionId===========' + JSON.stringify(data.abilityDescriptionId));
expect(data.abilityDescriptionId).assertLarger(0);
console.debug('=============abilityIconId==============' + JSON.stringify(data.abilityIconId));
expect(data.abilityIconId).assertLarger(0);
console.debug('=============launchedCount==============' + JSON.stringify(data.launchedCount));
expect(data.launchedCount).assertLarger(0);
console.debug('=============lastLaunchTime==============' + JSON.stringify(data.lastLaunchTime));
expect(data.lastLaunchTime).assertLarger(0);
console.debug('=============isRemoved==============' + JSON.stringify(data.isRemoved));
expect(data.isRemoved).assertEqual(false);
expect(data.installationFreeSupported).assertEqual(false);
var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT);
for (let i = 0, length = records.length; i < length; i++) {
counts.set(records[i].bundleName, records[i].launchedCount);
console.debug('=============launchedCount is=========' + records[i].launchedCount);
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
if (dataMap.has(BUNDLE_NAME)) {
let data = dataMap.get(BUNDLE_NAME);
expect(data.bundleName).assertEqual('com.example.third1');
expect(data.appLabelId >= 0).assertTrue();
expect(data.name).assertEqual('entry');
expect(data.labelId >= 0).assertTrue();
expect(data.descriptionId).assertEqual(0);
expect(data.abilityName).assertEqual('com.example.third1.MainAbility');
expect(data.abilityLabelId >= 0).assertTrue();
expect(data.abilityDescriptionId >= 0).assertTrue();
expect(data.abilityIconId >= 0).assertTrue();
expect(data.launchedCount).assertEqual(START_COUNT);
expect(data.lastLaunchTime).assertLarger(0);
expect(data.isRemoved).assertEqual(false);
expect(data.installationFreeSupported).assertEqual(false);
}
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0100==================end');
}, EVENTTIMEOUT)
})
/*
......@@ -124,23 +126,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0200==================');
bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0200');
checkModuleUsageRecord(data);
var result = checkIsExist(data, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT);
for (let i = 0, length = data.length; i < length; i++) {
counts.set(data[i].bundleName, data[i].launchedCount);
console.debug('=============launchedCount is=========' + data[i].launchedCount);
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
}
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0200==================end');
}, TIMEOUT)
})
/*
......@@ -152,7 +142,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0300==================');
bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0300');
checkModuleUsageRecord(data);
var result = checkIsExist(data, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
......@@ -166,9 +156,6 @@ describe('ActsBmsModuleUsageRecordTest', function () {
}
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0300==================end');
}, TIMEOUT)
})
/*
......@@ -179,7 +166,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_0400', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0400==================');
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO);
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0400');
checkModuleUsageRecord(records);
var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
......@@ -193,9 +180,6 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
}
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0400==================end');
}, TIMEOUT)
})
/*
......@@ -206,18 +190,38 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/
it('bms_getModuleUsageRecordTest_0500', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0500==================');
await uninstall(BUNDLE_NAME);
sleep(TIMEOUT);
console.debug('===================uninstall third1====================');
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO)
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0500');
var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(false);
await install(['/data/test/bmsThirdBundleTest1.hap']);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0500==================end');
}, TIMEOUT)
var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) {
console.debug('========uninstall Finish========');
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
console.debug('========data.statusMessage========' + data.statusMessage);
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO)
checkModuleUsageRecord(records);
var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(false);
installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
console.debug('========install Finish========');
expect(err.code).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
})
/*
......@@ -228,19 +232,30 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/
it('bms_getModuleUsageRecordTest_0600', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0600==================');
await uninstall(BUNDLE_NAME);
sleep(TIMEOUT);
await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, async (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0600');
var result = checkIsExist(data, BUNDLE_NAME);
expect(result).assertEqual(false);
await install(['/data/test/bmsThirdBundleTest1.hap']);
done();
var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, async (funcErr, moduleUsageRecord) => {
expect(funcErr.code).assertEqual(0);
var result = checkIsExist(moduleUsageRecord, BUNDLE_NAME);
expect(result).assertEqual(false);
installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
done();
});
});
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0600==================end');
}, TIMEOUT)
})
/*
......@@ -252,13 +267,10 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0700==================');
await bundle.getModuleUsageRecords(INVALID_NUM, (err, data) => {
console.debug('============err.code==========' + err.code);
expect(err.code).assertEqual(0);
expect(err.code).assertEqual(-1);
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0700==================end');
}, TIMEOUT)
})
/*
......@@ -271,9 +283,6 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var data = await bundle.getModuleUsageRecords(INVALID_NUM);
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0800==================end');
}, TIMEOUT)
})
/*
......@@ -285,13 +294,10 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0900==================');
await bundle.getModuleUsageRecords(0, (err, data) => {
console.debug('============err.code==========' + err.code);
expect(err.code).assertEqual(0);
expect(err.code).assertEqual(-1);
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0900==================end');
}, TIMEOUT)
})
/*
......@@ -304,9 +310,6 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var data = await bundle.getModuleUsageRecords(0);
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1000==================end');
}, TIMEOUT)
})
/*
......@@ -317,29 +320,27 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/
it('bms_getModuleUsageRecordTest_1100', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1100==================');
await uninstall(BUNDLE_NAME);
sleep(TIMEOUT);
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
await install(bundlePath);
sleep(TIMEOUT);
console.debug('===================install third1====================');
var records = await bundle.getModuleUsageRecords(NUM_TEN)
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_1100');
var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT);
for (let i = 0, length = records.length; i < length; i++) {
counts.set(records[i].bundleName, records[i].launchedCount);
console.debug('=============launchedCount is=========' + records[i].launchedCount);
var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
}
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1100==================end');
}, TIMEOUT)
}, (err, data) => {
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN)
expect(checkLaunchCount(records, BUNDLE_NAME, START_COUNT)).assertEqual(true);
done();
});
});
})
/*
......@@ -350,30 +351,29 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/
it('bms_getModuleUsageRecordTest_1200', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1200==================');
await uninstall(BUNDLE_NAME);
sleep(TIMEOUT);
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
await install(bundlePath);
sleep(TIMEOUT);
await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_1200');
var result = checkIsExist(data, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT);
for (let i = 0, length = data.length; i < length; i++) {
counts.set(data[i].bundleName, data[i].launchedCount);
console.debug('=============launchedCount is=========' + data[i].launchedCount);
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
done();
})
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1200==================end');
}, TIMEOUT)
}, (err, data) => {
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN, (err, records) => {
expect(err.code).assertEqual(0);
expect(checkLaunchCount(records, BUNDLE_NAME, START_COUNT)).assertEqual(true);
done();
})
});
});
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1300
......@@ -383,42 +383,60 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/
it('bms_getModuleUsageRecordTest_1300', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1300==================');
await uninstall(BUNDLE_NAME);
sleep(TIMEOUT);
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
await install(bundlePath);
sleep(TIMEOUT);
console.debug('=======start ability========')
await featureAbility.startAbility(
{
want:
{
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility'
}
var subscriber;
let id;
async function subscribeCallBack(err, data) {
clearTimeout(id);
START_COUNT += 1;
expect(data.event).assertEqual('ACTS_Third1_Publish_CommonEvent');
await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN, (err, records) => {
expect(err.code).assertEqual(0);
var result = checkLaunchCount(records, BUNDLE_NAME, START_COUNT);
expect(result).assertEqual(true);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
done();
})
}
commonEvent.createSubscriber(subscriberInfo_0100).then((data) => {
console.debug('====>Create Subscriber====>');
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback(err, data) {
done();
}
function timeout() {
console.debug('=====timeout======');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
)
sleep(TIMEOUT);
START_COUNT += 1;
await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_1300');
var result = checkIsExist(data, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT);
for (let i = 0, length = data.length; i < length; i++) {
counts.set(data[i].bundleName, data[i].launchedCount);
console.debug('=============launchedCount is=========' + data[i].launchedCount);
}, (err, data) => {
installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
}
done();
})
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1300==================end');
}, TIMEOUT)
}, async (err, data) => {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
await featureAbility.startAbility(
{
want:
{
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility'
}
}
)
});
});
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1400
......@@ -428,52 +446,129 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/
it('bms_getModuleUsageRecordTest_1400', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1400==================');
await uninstall(BUNDLE_NAME);
sleep(TIMEOUT);
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
await install(bundlePath);
sleep(TIMEOUT);
console.debug('=======start ability========')
await featureAbility.startAbility(
{
want:
{
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility'
}
}
)
sleep(TIMEOUT);
START_COUNT += 1;
console.debug('=======start ability result========' + result);
var records = await bundle.getModuleUsageRecords(NUM_TEN)
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_1400');
var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(true);
if (result) {
let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT);
for (let i = 0, length = records.length; i < length; i++) {
counts.set(records[i].bundleName, records[i].launchedCount);
console.debug('=============launchedCount is=========' + records[i].launchedCount);
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
var subscriber;
let id;
async function subscribeCallBack(err, data) {
clearTimeout(id);
START_COUNT += 1;
expect(data.event).assertEqual('ACTS_Third1_Publish_CommonEvent');
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN)
expect(checkLaunchCount(records, BUNDLE_NAME, START_COUNT)).assertEqual(true);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
done();
}
commonEvent.createSubscriber(subscriberInfo_0100).then((data) => {
console.debug('====>Create Subscriber====>');
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback(err, data) {
done();
}
function timeout() {
console.debug('=====timeout======');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
console.debug('========install Finish========');
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
await featureAbility.startAbility(
{
want:
{
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility'
}
}
)
});
});
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1500
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
* @tc.desc: test getModuleUsageRecord with the critical value
*/
it('bms_getModuleUsageRecordTest_1500', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1500==================');
await bundle.getModuleUsageRecords(1000, (err, records) => {
expect(err.code).assertEqual(0);
console.info('============data length_1500===========' + records.length);
checkModuleUsageRecord(records);
expect(checkIsExist(records, BUNDLE_NAME)).assertTrue();
done();
});
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1600
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
* @tc.desc: test getModuleUsageRecord with the critical value
*/
it('bms_getModuleUsageRecordTest_1600', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1600==================');
var records = await bundle.getModuleUsageRecords(1000);
console.info('============data length_1600===========' + records.length);
checkModuleUsageRecord(records);
expect(checkIsExist(records, BUNDLE_NAME)).assertTrue();
done();
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1700
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
* @tc.desc: test getModuleUsageRecord with the invalid parameter
*/
it('bms_getModuleUsageRecordTest_1700', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1700==================');
await bundle.getModuleUsageRecords(1001, (err, data) => {
console.debug('============err.code==========' + err.code);
expect(err.code).assertEqual(-1);
console.info('============data length_1700===========' + data.length);
expect(data.length).assertEqual(0);
done();
});
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1800
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
* @tc.desc: test getModuleUsageRecord with the invalid parameter
*/
it('bms_getModuleUsageRecordTest_1800', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1800==================');
var data = await bundle.getModuleUsageRecords(1001);
console.info('============data length_1800===========' + data.length);
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1400==================end');
}, TIMEOUT)
})
function checkModuleUsageRecord(data, caseName) {
function checkModuleUsageRecord(data) {
console.debug('======================check ModuleUsageRecord begin==========================');
console.debug(caseName + ' ==========record length is ========== ' + data.length);
expect(data.length).assertLarger(0);
for (let i = 0, length = data.length; i < length; i++) {
console.debug('=======All Info========' + JSON.stringify(data[i]));
console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName));
expect(data[i].bundleName.length).assertLarger(0);
console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId));
expect(data[i].appLabelId).assertLarger(0);
expect(data[i].appLabelId >= 0).assertTrue();
console.debug('=============name==============' + JSON.stringify(data[i].name));
expect(data[i].name.length).assertLarger(0);
console.debug('=============labelId==============' + JSON.stringify(data[i].labelId));
......@@ -483,11 +578,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=============abilityName==============' + JSON.stringify(data[i].abilityName));
expect(data[i].abilityName.length).assertLarger(0);
console.debug('=============abilityLabelId==============' + JSON.stringify(data[i].abilityLabelId));
expect(data[i].abilityLabelId).assertLarger(0);
expect(data[i].abilityLabelId >= 0).assertTrue();
console.debug('===========abilityDescriptionId===========' + JSON.stringify(data[i].abilityDescriptionId));
expect(data[i].abilityDescriptionId).assertLarger(0);
expect(data[i].abilityDescriptionId >= 0).assertTrue();
console.debug('=============abilityIconId==============' + JSON.stringify(data[i].abilityIconId));
expect(data[i].abilityIconId).assertLarger(0);
expect(data[i].abilityIconId >= 0).assertTrue();
console.debug('=============launchedCount==============' + JSON.stringify(data[i].launchedCount));
expect(data[i].launchedCount).assertLarger(0);
console.debug('=============lastLaunchTime==============' + JSON.stringify(data[i].lastLaunchTime));
......@@ -500,66 +595,43 @@ describe('ActsBmsModuleUsageRecordTest', function () {
function checkIsExist(data, bundleName) {
let bundles = new Map();
for (let i = 0, length = data.length; i < length; i++) {
console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName));
bundles.set(data[i].bundleName, data[i]);
}
if (bundles.has(bundleName)) {
console.debug(bundleName + ' is exist');
return true;
}
else {
console.debug(bundleName + ' is not exist');
return false;
}
}
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveinstallEvent);
function onReceiveinstallEvent(err, data) {
console.debug('========install Finish========');
expect(typeof err).assertEqual('object');
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
function checkLaunchCount(data, bundleName, count) {
let i = 0;
for (let length = data.length; i < length; i++) {
if (data[i].bundleName == bundleName) {
expect(data[i].launchedCount).assertEqual(count);
return true;
}
}
if (i == data.length) {
return false;
}
}
async function uninstall(bundleName) {
var installer = await bundle.getBundleInstaller();
installer.uninstall(bundleName, {
afterAll(async (done) => {
console.debug('=======after all install========');
let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveinstallEvent);
function onReceiveinstallEvent(err, data) {
console.debug('========uninstall Finish========');
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(typeof data).assertEqual('object');
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
console.debug('========data.statusMessage========' + data.statusMessage);
}
}
afterAll(async (done) => {
console.debug('=======after all install========');
let bundleName = 'com.example.third1'
uninstall(bundleName);
});
done();
})
function sleep(delay) {
var start = (new Date()).getTime();
while ((new Date()).getTime() - start < delay) {
continue;
}
}
})
\ No newline at end of file
......@@ -20,7 +20,7 @@ group("publish_test") {
#"badgedisplayed:badgedisplayed",
#"enablenotification:enablenotification",
"getactive:getactive",
"getwantagentinfo:getwantagentinfo",
"getwantagentinfo:ActsAnsGetWantAgentInfoTest",
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
......
......@@ -16,7 +16,7 @@
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
var errorCode = 67108870
var ERR_ANS_INVALID_BUNDLE = 67108870
describe('ActsAnsBadgeDisplayTest', function () {
console.info("===ActsAnsBadgeDisplayTest start===>");
/*
......@@ -28,13 +28,10 @@ describe('ActsAnsBadgeDisplayTest', function () {
await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
},(err,data) => {
console.log("===>ActsGetDisplay_test_0100 success===>"+err+data)
console.log("===>ActsGetDisplay_test_0100 success===>"+JSON.stringify(err)+data)
expect(typeof(data)).assertEqual('boolean')
done();
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0100====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0200
......@@ -42,15 +39,15 @@ describe('ActsAnsBadgeDisplayTest', function () {
* @tc.desc: verify the function of isBadgeDisplayed
*/
it('ActsGetDisplay_test_0200', 0, async function (done) {
var promise = await notify.isBadgeDisplayed({
notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
})
console.log("===>ActsGetDisplay_test_0200 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0200====>");
}, time);
}).then((promise)=>{
console.log("===>ActsGetDisplay_test_0200 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
done()}
).catch((err)=>{
console.log("===>ActsGetDisplay_test_0200 err===>"+err.code)
})
})
/*
* @tc.number: ActsGetDisplay_test_0300
......@@ -66,9 +63,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(data).assertEqual(false)
done();
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0300====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0400
......@@ -76,14 +70,14 @@ describe('ActsAnsBadgeDisplayTest', function () {
* @tc.desc: verify the function of isBadgeDisplayed
*/
it('ActsGetDisplay_test_0400', 0, async function (done) {
var promise = await notify.isBadgeDisplayed({
notify.isBadgeDisplayed({
bundle:"wrong BundleName",
})
expect(promise).assertEqual(false)
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0400====>");
}, time);
}).then().catch((err)=>{
console.log("===>ActsGetDisplay_test_0400 success===>"+err.code)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
done();
})
})
/*
* @tc.number: ActsGetDisplay_test_0500
......@@ -96,9 +90,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0500====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0600
......@@ -109,9 +100,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
var promise = await notify.isBadgeDisplayed("#$#$%$%^")
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0600====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0700
......@@ -124,9 +112,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0700====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0800
......@@ -137,9 +122,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
var promise = await notify.isBadgeDisplayed({})
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0800====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0900
......@@ -160,9 +142,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
done();
})
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0900====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_1000
......@@ -182,9 +161,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsGetDisplay_test_1000===>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0100
......@@ -198,9 +174,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
console.log("===>ActsSetDisplay_test_0100 success===>"+err)
})
done();
setTimeout(function(){
console.debug("====>time out ActsSetDisplay_test_0100====>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0200
......@@ -213,9 +186,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
},100)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("===>time out ActsSetDisplay_test_0200===>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0300
......@@ -227,12 +197,9 @@ describe('ActsAnsBadgeDisplayTest', function () {
bundle:"Wrong BundleName"
},true,(err) => {
console.log("===>ActsSetDisplay_test_0300 success===>"+err.code)
expect(err.code).assertEqual(errorCode)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
})
done();
setTimeout(function(){
console.debug("====>time out ActsSetDisplay_test_0300====>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0400
......@@ -240,14 +207,13 @@ describe('ActsAnsBadgeDisplayTest', function () {
* @tc.desc: verify the function of displayBadge
*/
it('ActsSetDisplay_test_0400', 0, async function (done) {
var promise = await notify.displayBadge({
notify.displayBadge({
bundle:"Wrong BundleName"
},true)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("===>time out ActsSetDisplay_test_0400===>");
}, time);
},true).then().catch((err)=>{
console.log("===>ActsSetDisplay_test_0400 err===>"+err.code)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
done();
})
})
/*
* @tc.number: ActsSetDisplay_test_0500
......@@ -267,9 +233,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
done();
})
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0900====>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0600
......@@ -288,9 +251,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsSetDisplay_test_0600===>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0700
......@@ -310,9 +270,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
done();
})
})
setTimeout(function(){
console.debug("====>time out ActsSetDisplay_test_0700====>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0800
......@@ -331,9 +288,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(promise).assertEqual(false)
done();
})
setTimeout(function(){
console.debug("===>time out ActsSetDisplay_test_0800===>");
}, time);
})
/*
* @tc.number: ActsSetDisplay_test_0900
......@@ -359,9 +313,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsSetDisplay_test_0900===>");
}, time);
})
})
......
......@@ -13,18 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("localcandisplay") {
ohos_js_hap_suite("localcandisplay") {
hap_profile = "./entry/src/main/config.json"
hap_name = "localcandisplay"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "localcandisplay"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
......@@ -16,7 +16,7 @@
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
var errorCode = 67108870
var ERR_ANS_INVALID_BUNDLE = 67108870
describe('ActsAnsEnableNotificationTest', function () {
console.info("===========ActsAnsEnableNotificationTest start====================>");
/*
......@@ -78,14 +78,13 @@ describe('ActsAnsEnableNotificationTest', function () {
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_0400', 0, async function (done) {
var promise = await notify.isNotificationEnabled({
notify.isNotificationEnabled({
bundle:"wrong BundleName",
})
expect(promise).assertEqual(false)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0400====>");
}, time);
}).then().catch((err)=>{
console.debug("====>ActsGetEnable_test_0400 promsie====>"+err.code);
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
done();
})
})
/*
* @tc.number: ActsGetEnable_test_0500
......@@ -98,9 +97,6 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0500====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0600
......@@ -111,9 +107,6 @@ describe('ActsAnsEnableNotificationTest', function () {
var promise = await notify.isNotificationEnabled("#$#$%$%^")
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0600====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0700
......@@ -126,9 +119,6 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0700====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0800
......@@ -139,9 +129,6 @@ describe('ActsAnsEnableNotificationTest', function () {
var promise = await notify.isNotificationEnabled({})
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0800====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0900
......@@ -162,9 +149,6 @@ describe('ActsAnsEnableNotificationTest', function () {
done();
})
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0900====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_1000
......@@ -184,9 +168,6 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsGetDisplay_test_1000===>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0100
......@@ -200,9 +181,6 @@ describe('ActsAnsEnableNotificationTest', function () {
console.log("===>ActsSetEnable_test_0100 success===>"+err)
})
done();
setTimeout(function(){
console.debug("====>time out ActsSetEnable_test_0100====>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0200
......@@ -215,9 +193,6 @@ describe('ActsAnsEnableNotificationTest', function () {
},100)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0200===>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0300
......@@ -229,12 +204,9 @@ describe('ActsAnsEnableNotificationTest', function () {
bundle:"Wrong BundleName"
},true,(err) => {
console.log("===>ActsSetEnable_test_0300 success===>"+err.code)
expect(err.code).assertEqual(errorCode)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
})
done();
setTimeout(function(){
console.debug("====>time out ActsSetDisplay_test_0300====>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0400
......@@ -242,14 +214,13 @@ describe('ActsAnsEnableNotificationTest', function () {
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetEnable_test_0400', 0, async function (done) {
var promise = await notify.enableNotification({
notify.enableNotification({
bundle:"Wrong BundleName"
},true)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0400===>");
}, time);
},true).then().catch((err)=>{
console.log("===>ActsSetEnable_test_0400 err===>"+err.code)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
done();
})
})
/*
* @tc.number: ActsSetEnable_test_0500
......@@ -346,7 +317,7 @@ describe('ActsAnsEnableNotificationTest', function () {
await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
},(err,data) => {
console.log("===>ActsGetEnable_test_0100 success===>"+err+data)
console.log("===>ActsSetEnable_test_0900 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(false)
})
......
......@@ -17,9 +17,9 @@ group("getactive") {
testonly = true
if (is_standard_system) {
deps = [
#"actsansgetactive:ActsAnsActiveTest",
"actsansgetactive:ActsAnsActiveTest",
#"actsansgetallactive:ActsAnsAllActiveTestOne",
#"getactiveotherapp:ActsAnsAllActiveTestTwo"
#"getactiveotherapp:ActsAnsAllActiveTestOne"
]
}
}
......@@ -16,6 +16,7 @@
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
var ERR_ANS_NON_SYSTEM_APP = 67108877
describe('ActsAnsActiveTest', function () {
console.info("===========ActsAnsActiveTest start====================>");
function getCallback(err, data){
......@@ -1060,13 +1061,11 @@ describe('ActsAnsActiveTest', function () {
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_1000 publish CurrentApp notify end==================>");
var promiseData = await notify.getAllActiveNotifications();
expect(promiseData).assertEqual(undefined);
console.debug("===============Ans_GetAllActive_1000 getAllActiveNotifications end==================>");
done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_1000 done==================>");
}, time);
await notify.getAllActiveNotifications().then().catch((err)=>{
expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP);
console.debug("==Ans_GetAllActive_1000 err==>"+err.code);
done();
});
})
})
......@@ -13,18 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAnsAllActiveTestTwo") {
ohos_js_hap_suite("ActsAnsAllActiveTestOne") {
hap_profile = "./entry/src/main/config.json"
hap_name = "ActsAnsAllActiveTestTwo"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsAllActiveTestOne"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
{
"description": "Configuration for hjunit demo Tests",
}
\ No newline at end of file
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.activeotherapp",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsAllActiveTestOne.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
......@@ -13,14 +13,19 @@
import("//test/xts/tools/build/suite.gni")
group("getwantagentinfo") {
testonly = true
if (is_standard_system) {
deps = [
"getwantagentinfoone:ActsAnsGetWantAgentInfoOneTest",
"getwantagentinfoonepro:ActsAnsGetWantAgentInfoOneProTest",
"getwantagentinfotwo:ActsAnsGetWantAgentInfoTwoTest",
"getwantagentinfotwopro:ActsAnsGetWantAgentInfoTwoProTest",
]
}
ohos_js_hap_suite("ActsAnsGetWantAgentInfoTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetWantAgentInfoTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsansgetwantagentinfotwotest",
"package": "com.example.actsansgetwantagentinfotest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetWantAgentInfoTwoTest.hap"
"ActsAnsGetWantAgentInfoTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
{
"app": {
"bundleName": "com.example.actsansgetwantagentinfotwotest",
"bundleName": "com.example.actsansgetwantagentinfotest",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,7 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetwantagentinfotwotest",
"package": "com.example.actsansgetwantagentinfotest",
"name": ".MyApplication",
"deviceType": [
"phone"
......@@ -36,7 +36,7 @@
]
}
],
"name": "com.example.actsansgetwantagentinfotwotest.MainAbility",
"name": "com.example.actsansgetwantagentinfotest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
......@@ -59,4 +59,4 @@
}
]
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 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 wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgenta;
var WantAgentb;
var WantAgentc;
var WantAgentd;
var WantAgente;
var time = 1000
describe('ActsAnsGetWantAgentInfoTest', function () {
console.info('----ActsGetWantAgentInfoTest----');
/*
* @tc.number: ACTS_SetWantInfo_0100
* @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel()
* @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel()
*/
it('ACTS_SetWantInfo_0100', 0, async function (done) {
console.info('----ACTS_SetWantInfo_0100----');
var agentInfoa = {
wants: [
{
bundleName: "com.example.WantAgentTest",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoa,
(err, data) => {
if (err.code == 0) {
WantAgenta = data;
console.info('----getWantAgenta success!----'+data);
expect(typeof(data)).assertEqual("object");
wantAgent.getBundleName(data,
(err1, data1) => {
if (err1.code == 0) {
console.info('----getBundleNameA success!----'+err.code+data1);
expect(typeof(data1)).assertEqual('string')
} else {
console.info('----getBundleNameA failed!----');
}
}
);
wantAgent.getUid(data,
(err2, data2) => {
if (err2.code == 0) {
console.info('----getUidA success!----'+err.code+data2);
expect(typeof(data2)).assertEqual('number')
} else {
console.info('----getUidA failed!----');
}
}
);
wantAgent.getWant(data,(err3, data3) => {
if (err3.code == 0) {
console.info('----getWantA success!----'+err.code+data3);
expect(typeof(data3)).assertEqual('object')
} else {
console.info('----getWantA failed!----');
}
});
wantAgent.cancel(data,(err)=>{
console.info("========cancelA========"+err.code)
});
} else {
console.info('----getWantAgenta failed!----'+err.code+data);
expect(typeof(data)).assertEqual("object");
}
done();
}),
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0100====>");
}, time);
console.info('----getWantAgenta after----');
})
/*
* @tc.number: ACTS_SetWantInfo_0200
* @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel()
* @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() promise
*/
it('ACTS_SetWantInfo_0200', 0, async function (done) {
var agentInfod = {
wants: [
{
bundleName: "com.example.WantAgentTest",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfod).then(
(data) => {
console.info('----getWantAgent Promise success!----'+data);
expect(typeof(data)).assertEqual("object");
wantAgent.getBundleName(data).then(
(data1) => {
console.info('----getBcanundleName Promise success!----'+data1);
expect(typeof(data1)).assertEqual('string')
}
);
wantAgent.getUid(data).then(
(data2) => {
console.info('----getUid Promise success!----'+data2);
expect(typeof(data2)).assertEqual('number')
}
);
wantAgent.getWant(data).then(
(data3) => {
console.info('----getWant Promise success!----'+data3);
console.info('Want = ' + data3);
expect(typeof(data3)).assertEqual('object')
}
);
wantAgent.cancel(data).then(
console.info("========cancelPromise========")
);
})
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0200====>");
}, time)
})
/*
* @tc.number: ACTS_SetWantInfo_0300
* @tc.name: equal(normal)
* @tc.desc: verify the function of equal(normal)Callback
*/
it('ACTS_SetWantInfo_0300', 0, async function (done) {
var agentInfob = {
wants: [
{
bundleName: "bundleName",
abilityName: "abilityName",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfob,(err,data)=>{
WantAgentb = data
})
var agentInfoc = {
wants: [
{
bundleName: "com.example.WantAgentTest",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoc,
(err, data) => {
if (err.code == 0) {
WantAgentc = data;
console.log("=======WantAgentb======="+JSON.stringify(WantAgentb))
console.log("=======WantAgentc======="+JSON.stringify(WantAgentc))
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgentb,WantAgentc,
(error,data) => {
if(error.code == 0) {
console.info('----equala success!----'+data)
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(false);
}
else{
console.info('----equala failed!----')
}
}
)
wantAgent.equal(WantAgentb,WantAgentb,
(error,data) => {
if(error.code == 0) {
console.info('----equalb success!----'+data)
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(true);
}
else{
console.info('----equalb failed!----')
}
}
)
}
else{
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0300====>");
}, time);
});
})
/*
* @tc.number: ACTS_SetWantInfo_0400
* @tc.name: equal(normal)
* @tc.desc: verify the function of equal(normal) promise
*/
it('ACTS_SetWantInfo_0400', 0, async function (done) {
var agentInfoe = {
wants: [
{
bundleName: "bundleName",
abilityName: "abilityName",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoe,(err,data)=>{
console.log("=======agentInfoe======="+err.code+JSON.stringify(data))
WantAgentd = data
})
var agentInfof = {
wants: [
{
bundleName: "com.example.WantAgentTest",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfof,
(err, data) => {
console.log("=======agentInfof======="+err.code+JSON.stringify(data))
if (err.code == 0) {
WantAgente = data;
console.log("=======WantAgente======="+JSON.stringify(WantAgentd))
console.log("=======WantAgentf======="+JSON.stringify(WantAgente))
wantAgent.equal(WantAgentd,WantAgente).then(
(data) => {
console.info('----equalc success!----'+data)
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(false);
}
)
wantAgent.equal(WantAgentd,WantAgentd).then(
(data) => {
console.info('----equald success!----'+data)
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(true);
}
)
}
else{
console.info('----getWantAgent failed!----'+err.code+data);
}
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0400====>");
}, time);
});
})
/*
* @tc.number: ACTS_SetWantInfo_0500
* @tc.name: equal(),cancel()
* @tc.desc: verify the function of equal(),cancel() promise
*/
it('ACTS_SetWantInfo_0500', 0, async function (done) {
var agentInfoe = {
wants: [
{
bundleName: "$%^%^%&^%&",
abilityName: "$%^&%&*^&*^",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoe,(err,data)=>{
WantAgentd = data
})
var agentInfof = {
wants: [
{
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfof,
(err, data) => {
if (err.code == 0) {
WantAgente = data;
console.log("=======WantAgente======="+JSON.stringify(WantAgentd))
console.log("=======WantAgentf======="+JSON.stringify(WantAgente))
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgentd,WantAgente).then(
(data) => {
console.info('----equale success!----'+data)
expect(typeof(data)).assertEqual("boolean");
}
)
wantAgent.cancel(WantAgentd).then(
console.info("========cancelPromise========")
);
wantAgent.equal(WantAgentd,WantAgente).then(
(data) => {
console.info('----equalf success!----'+data)
expect(typeof(data)).assertEqual("boolean");
}
)
wantAgent.equal(WantAgentd,WantAgentd).then(
(data) => {
console.info('----equalg success!----'+data)
expect(typeof(data)).assertEqual("boolean");
}
)
}
else{
console.info('----getWantAgent failed!----'+err.code);
}
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0500====>");
}, time);
});
})
/*
* @tc.number: ACTS_SetWantInfo_0600
* @tc.name: equal()
* @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")callback
*/
it('ACTS_SetWantInfo_0600', 0, async function (done) {
wantAgent.equal("$%$%^$%^","$%$%^$%^",
(error,data) => {
if(error.code == 0) {
console.info('----equalh success!----'+data)
expect(typeof(data)).assertEqual("boolean");
}
else{
console.info('----equalh failed!----')
}
}
)
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0600====>");
}, time);
});
/*
* @tc.number: ACTS_SetWantInfo_0700
* @tc.name: equal()
* @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")promise
*/
it('ACTS_SetWantInfo_0700', 0, async function (done) {
var promise = await wantAgent.equal("$%$%^$%^","$%$%^$%^")
console.info('----equali success!----'+promise)
expect(promise).assertEqual(undefined);
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0700====>");
}, time);
});
/*
* @tc.number: ACTS_SetWantInfo_0800
* @tc.name: equal()
* @tc.desc: verify the function of equal({},{})callback
*/
it('ACTS_SetWantInfo_0800', 0, async function (done) {
wantAgent.equal({},{},
(err,data) => {
console.info('----equalj success!----'+err.code+data)
expect(typeof(data)).assertEqual("boolean");
}
)
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0800====>");
}, time);
});
/*
* @tc.number: ACTS_SetWantInfo_0900
* @tc.name: equal()
* @tc.desc: verify the function of equal({},{})promise
*/
it('ACTS_SetWantInfo_0900', 0, async function (done) {
var promise = wantAgent.equal({},{})
console.info('----equalk success!----'+promise)
expect(promise).assertEqual(null);
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0900====>");
}, time);
});
/*
* @tc.number: ACTS_SetWantInfo_1000
* @tc.name: equal()
* @tc.desc: verify the function of equal(100,100)callback
*/
it('ACTS_SetWantInfo_1000', 0, async function (done) {
wantAgent.equal(100,100,
(err,data) => {
console.info('----equalm success!----'+err.code+data)
expect(typeof(data)).assertEqual("boolean");
}
)
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1000====>");
}, time);
});
/*
* @tc.number: ACTS_SetWantInfo_2200
* @tc.name: equal()
* @tc.desc: verify the function of equal(100,100)promise
*/
it('ACTS_SetWantInfo_1100', 0, async function (done) {
var promise = await wantAgent.equal(100,100)
console.info('----equaln success!----'+promise)
expect(promise).assertEqual(undefined);
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1100====>");
}, time);
});
/*
* @tc.number: ACTS_SetWantInfo_1200
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent("")callback
*/
it('ACTS_SetWantInfo_1200', 0, async function (done) {
console.info('----ACTS_SetWantInfo_0300 begin----');
wantAgent.getWantAgent("",(err,data) => {
console.log("===getWantAgenta==="+err.code+data)})
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1200====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1300
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent("")promise
*/
it('ACTS_SetWantInfo_1300', 0, async function (done) {
console.info('----ACTS_SetWantInfo_0300 begin----');
var promise = wantAgent.getWantAgent("")
console.log("===getWantAgentb==="+promise)
expect(promise).assertEqual(null);
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1300====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1400
* @tc.name: getBundleName()
* @tc.desc: verify the function of getBundleName("")callback
*/
it('ACTS_SetWantInfo_1400', 0, async function (done) {
wantAgent.getBundleName("",(err,data) => {
console.info('----getBundleNamea success!----'+err.code+data);
expect(typeof(data)).assertEqual('string')});
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1400====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1500
* @tc.name: getBundleName()
* @tc.desc: verify the function of getBundleName("")promise
*/
it('ACTS_SetWantInfo_1500', 0, async function (done) {
var promise = await wantAgent.getBundleName("")
console.info('----getBundleNameb success!----'+promise);
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1500====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1600
* @tc.name: getUid()
* @tc.desc: verify the function of getUid("")callback
*/
it('ACTS_SetWantInfo_1600', 0, async function (done) {
wantAgent.getUid("",(err,data) => {
console.info('----getUida success!----'+err.code+data);
expect(typeof(data)).assertEqual('number')});
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1600====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1700
* @tc.name: getUid()
* @tc.desc: verify the function of getUid("")promise
*/
it('ACTS_SetWantInfo_1700', 0, async function (done) {
var promise =await wantAgent.getUid("")
console.info('----getUidb success!----'+promise);
expect(promise).assertEqual(undefined)
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1700====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1800
* @tc.name: getWant()
* @tc.desc: verify the function of getWant("")callback
*/
it('ACTS_SetWantInfo_1800', 0, async function (done) {
wantAgent.getWant("",(err,data) => {
console.info('----getWanta success!----'+err.code+data);
expect(typeof(data)).assertEqual('object')
});
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1800====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_1900
* @tc.name: getWant()
* @tc.desc: verify the function of getWant("")promise
*/
it('ACTS_SetWantInfo_1900', 0, async function (done) {
var promise = await wantAgent.getWant("")
console.info('----getWantb success!----'+promise);
expect(promise).assertEqual(undefined)
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_1900====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2000
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent(100)callback
*/
it('ACTS_SetWantInfo_2000', 0, async function (done) {
console.info('----ACTS_SetWantInfo_1000 begin----');
wantAgent.getWantAgent(100,(err,data) => {
console.log('----getWantAgenta success!----'+err.code+data)
})
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2000====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2100
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent(100)promises
*/
it('ACTS_SetWantInfo_2100', 0, async function (done) {
var promise = wantAgent.getWantAgent(100)
console.log("----getWantAgentb success!----"+promise)
expect(promise).assertEqual(null)
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2100====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2200
* @tc.name: getBundleName()
* @tc.desc: verify the function of getBundleName(100)callback
*/
it('ACTS_SetWantInfo_2200', 0, async function (done) {
wantAgent.getBundleName(100,(err,data) => {
console.info('----getBundleNamec success!----'+err.code+data);
expect(typeof(data)).assertEqual('string')
});
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2200====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2300
* @tc.name: getBundleName()
* @tc.desc: verify the function of getBundleName(100)promise
*/
it('ACTS_SetWantInfo_2300', 0, async function (done) {
var promise =await wantAgent.getBundleName(100)
console.info('----getBundleNamed success!----'+promise);
expect(promise).assertEqual(undefined)
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2300====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2400
* @tc.name: getUid()
* @tc.desc: verify the function of getUid(100)callback
*/
it('ACTS_SetWantInfo_2400', 0, async function (done) {
wantAgent.getUid(100,(err,data) => {
console.info('----getUidc success!----'+err.code+data);
});
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2400====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2500
* @tc.name: getUid()
* @tc.desc: verify the function of getUid(100)promise
*/
it('ACTS_SetWantInfo_2500', 0, async function (done) {
var promise =await wantAgent.getUid(100)
console.info('----getUidd success!----'+promise);
expect(promise).assertEqual(undefined)
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2500====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2600
* @tc.name: getWant()
* @tc.desc: verify the function of getWant(100)callback
*/
it('ACTS_SetWantInfo_2600', 0, async function (done) {
wantAgent.getWant(100,(err,data) => {
console.info('----getWantc success!----'+err.code+data);
expect(typeof(data)).assertEqual('object')
});
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2600====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2700
* @tc.name: getWant()
* @tc.desc: verify the function of getWant(100)promise
*/
it('ACTS_SetWantInfo_2700', 0, async function (done) {
var promise = await wantAgent.getWant(100)
console.info('----getWantd success!----'+promise);
expect(promise).assertEqual(undefined)
done()
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_2700====>");
}, time);
})
/*
* @tc.number: ACTS_SetWantInfo_2800
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent({})callback
*/
it('ACTS_SetWantInfo_2800', 0, async function (done) {
console.info('----ACTS_SetWantInfo_2800 begin----');
wantAgent.getWantAgent({},(err,data) => {
console.log("----getWantAgentc success!----"+err.code+data)
})
done();
})
/*
* @tc.number: ACTS_SetWantInfo_2900
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent({})promise
*/
it('ACTS_SetWantInfo_2900', 0, async function (done) {
console.info('----ACTS_SetWantInfo_2900 begin----');
wantAgent.getWantAgent({}).then((data)=>{
console.log("----getWantAgentd success!----"+data)
expect(data).assertEqual("object")
})
done();
})
/*
* @tc.number: ACTS_SetWantInfo_3000
* @tc.name: getBundleName()
* @tc.desc: verify the function of getBundleName({})callback
*/
it('ACTS_SetWantInfo_3000', 0, async function (done) {
wantAgent.getBundleName({},(err,data) => {
console.info('----getBundleNamee success!----'+err.code+data);
expect(typeof(data)).assertEqual('string')
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3100
* @tc.name: getBundleName()
* @tc.desc: verify the function of getBundleName({})promise
*/
it('ACTS_SetWantInfo_3100', 0, async function (done) {
var promise = wantAgent.getBundleName({})
console.info('----getBundleNamef success!----'+promise);
expect(promise).assertEqual(null)
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3200
* @tc.name: getUid()
* @tc.desc: verify the function of getUid({})callback
*/
it('ACTS_SetWantInfo_3200', 0, async function (done) {
wantAgent.getUid({},(err,data) => {
console.info('----getUide success!----'+err.code+data);
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3300
* @tc.name: getUid()
* @tc.desc: verify the function of getUid({})promise
*/
it('ACTS_SetWantInfo_3300', 0, async function (done) {
var promise = wantAgent.getUid({})
console.info('----getUidf success!----'+promise);
expect(promise).assertEqual(null)
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3400
* @tc.name: getWant()
* @tc.desc: verify the function of getWant({})callback
*/
it('ACTS_SetWantInfo_3400', 0, async function (done) {
wantAgent.getWant({},(err,data) => {
console.info('----getWante success!----'+err.code+data);
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3500
* @tc.name: getWant()
* @tc.desc: verify the function of getWant({})promise
*/
it('ACTS_SetWantInfo_3500', 0, async function (done) {
var promise = wantAgent.getWant({})
console.info('----getWantf success!----'+promise);
expect(promise).assertEqual(null)
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3600
* @tc.name: cancel()
* @tc.desc: verify the function of cancel({})callback
*/
it('ACTS_SetWantInfo_3600', 0, async function (done) {
wantAgent.cancel({},(err,data) => {
console.info('----cancela success!----'+err.code+data);
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3700
* @tc.name: cancel()
* @tc.desc: verify the function of cancel({})promise
*/
it('ACTS_SetWantInfo_3700', 0, async function (done) {
var promise = await wantAgent.cancel({})
console.info('----cancelb success!----'+promise);
expect(promise).assertEqual(null)
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3800
* @tc.name: cancel()
* @tc.desc: verify the function of cancel(100)callback
*/
it('ACTS_SetWantInfo_3800', 0, async function (done) {
wantAgent.cancel(100,(err) => {
console.info('----cancelc success!----'+err.code);
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_3900
* @tc.name: cancel()
* @tc.desc: verify the function of cancel(100)promise
*/
it('ACTS_SetWantInfo_3900', 0, async function (done) {
var promise =await wantAgent.cancel(100)
console.info('----canceld success!----'+promise);
expect(promise).assertEqual(undefined)
done()
})
/*
* @tc.number: ACTS_SetWantInfo_4000
* @tc.name: getWant()
* @tc.desc: verify the function of cancel("")callback
*/
it('ACTS_SetWantInfo_4000', 0, async function (done) {
wantAgent.cancel("",(err) => {
console.info('----cancele success!----'+err.code);
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_4100
* @tc.name: cancel()
* @tc.desc: verify the function of cancel("")promise
*/
it('ACTS_SetWantInfo_4100', 0, async function (done) {
var promise = await wantAgent.cancel("")
console.info('----cancelf success!----'+promise);
expect(promise).assertEqual(undefined)
done()
})
/*
* @tc.number: ACTS_SetWantInfo_4200
* @tc.name: cancel()
* @tc.desc: verify the function of cancel("%^%^%^")callback
*/
it('ACTS_SetWantInfo_4200', 0, async function (done) {
wantAgent.cancel("%^%^%^",(err) => {
console.info('----cancelg success!----'+err.code);
});
done()
})
/*
* @tc.number: ACTS_SetWantInfo_4300
* @tc.name: cancel()
* @tc.desc: verify the function of cancel("%^%^%^")promise
*/
it('ACTS_SetWantInfo_4300', 0, async function (done) {
var promise =await wantAgent.cancel("%^%^%^")
console.info('----cancelh success!----'+promise);
expect(promise).assertEqual(undefined)
done()
})
})
# Copyright (c) 2021 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsGetWantAgentInfoOneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetWantAgentInfoOneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsansgetwantagentinfoonetest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetWantAgentInfoOneTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansgetwantagentinfoonetest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetwantagentinfoonetest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansgetwantagentinfoonetest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
{
"string": [
{
"name": "app_name",
"value": "AgentInfo1"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 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 wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgent1;
var WantAgent2;
var time = 1000
describe('ActsAnsGetWantAgentInfoOneTest', function () {
console.info('----ActsGetWantAgentInfoTest----');
/*
* @tc.number: ACTS_SetWantInfo_0100
* @tc.name: getWantAgent(),getBundleName(),getUid(),getWant()
* @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant()
*/
it('ACTS_SetWantInfo_0100', 0, async function (done) {
console.info('----scene_test_callback_1----');
var agentInfo1 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent1 before----');
wantAgent.getWantAgent(agentInfo1,
(err, data) => {
if (err.code == 0) {
WantAgent1 = data;
console.info('----getWantAgent1 success!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.getBundleName(data,
(err1, data1) => {
if (err1.code == 0) {
console.info('----getBundleName success!----');
console.info('bundleName = ' + data1);
expect(typeof(data1)).assertEqual('string')
} else {
console.info('----getBundleName failed!----');
}
}
);
wantAgent.getUid(data,
(err2, data2) => {
if (err2.code == 0) {
console.info('----getUid success!----');
console.info('Uid = ' + data2);
expect(typeof(data2)).assertEqual('number')
} else {
console.info('----getUid failed!----');
}
}
);
wantAgent.getWant(data,(err3, data3) => {
if (err3.code == 0) {
console.info('----getWant success!----');
console.info('Want = ' + data3);
expect(typeof(data3)).assertEqual('object')
} else {
console.info('----getWant failed!----');
}
});
} else {
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
}),
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0100====>");
}, time);
console.info('----getWantAgent1 after----');
})
/*
* @tc.number: ACTS_SetWantInfo_0200
* @tc.name: getWantAgent(),equal()
* @tc.desc: verify the function of getWantAgent(),equal()
*/
it('ACTS_SetWantInfo_0200', 0, async function (done) {
var agentInfo2 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent2 before----');
wantAgent.getWantAgent(agentInfo2,
(err, data) => {
if (err.code == 0) {
WantAgent2 = data;
console.info('----getWantAgent2 success!----');
console.log("==WantAgent1=="+JSON.stringify(WantAgent1))
console.log("===WantAgent2=="+JSON.stringify(WantAgent2))
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgent1,WantAgent2,
(error,data) => {
if(error.code == 0) {
console.info('----equal1 success!----')
console.info(data);
expect(typeof(data)).assertEqual("boolean");
}
else{
console.info('----equal1 failed!----')
}
}
)
wantAgent.equal(WantAgent1,WantAgent1,
(error,data) => {
if(error.code == 0) {
console.info('----equal2 success!----')
console.info(data);
expect(typeof(data)).assertEqual("boolean");
}
else{
console.info('----equal2 failed!----')
}
}
)
}
else{
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
});
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0200====>");
}, time);
console.info('----getWantAgent2 after----');
})
})
# Copyright (c) 2021 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsGetWantAgentInfoOneProTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetWantAgentInfoOneProTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "160000",
"package": "com.example.actsansgetwantagentinfooneprotest",
"shell-timeout": "160000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetWantAgentInfoOneProTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansgetwantagentinfooneprotest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetwantagentinfooneprotest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansgetwantagentinfooneprotest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (c) 2021 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "AgentInfoPro"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 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.
*/
require('./WantAgent.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 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 wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgent1;
var WantAgent2;
var time = 5000
describe('ActsAnsGetWantAgentInfoOneProTest', function () {
console.info('----ActsGetWantAgentInfoTest----');
/*
* @tc.number: ACTS_SetWantInfo_0300
* @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel()
* @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() promise
*/
it('ACTS_SetWantInfo_0300', 0, async function (done) {
var agentInfo1 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent1 before----');
wantAgent.getWantAgent(agentInfo1,
(err, data) => {
if (err.code == 0) {
WantAgent1 = data;
console.info('----getWantAgent1 Promise success!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.getBundleName(data).then(
(data1) => {
console.info('----getBundleName Promise success!----');
console.info('bundleName = ' + data1);
expect(typeof(data1)).assertEqual('string')
}
);
wantAgent.getUid(data).then(
(data2) => {
console.info('----getUid Promise success!----');
console.info('Uid = ' + data2);
expect(typeof(data2)).assertEqual('number')
}
);
wantAgent.getWant(data).then(
(data3) => {
console.info('----getWant Promise success!----');
console.info('Want = ' + data3);
expect(typeof(data3)).assertEqual('object')
}
);
wantAgent.cancel(data).then(
console.info("========cancelPromise========")
);
} else {
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
}),
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0300====>");
}, time)
console.info('----getWantAgent1 after----');
})
/*
* @tc.number: ACTS_SetWantInfo_0400
* @tc.name: getWantAgent(),equal()
* @tc.desc: verify the function of getWantAgent(),equal() promise
*/
it('ACTS_SetWantInfo_0400', 0, async function (done) {
var agentInfo2 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent2 before----');
wantAgent.getWantAgent(agentInfo2,
(err, data) => {
if (err.code == 0) {
WantAgent2 = data;
console.info('----getWantAgent2 Promise success!----');
console.log("==WantAgent1=="+JSON.stringify(WantAgent1))
console.log("==WantAgent2=="+JSON.stringify(WantAgent2))
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgent1,WantAgent2).then(
(data) => {
console.info('----equalPromise1 success!----')
console.info(data);
expect(data).assertEqual(false);
}
)
wantAgent.equal(WantAgent1,WantAgent1).then(
(data) => {
console.info('----equalPromise2 success!----')
console.info(data);
expect(data).assertEqual(true);
}
)
}
else{
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
});
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0400====>");
}, time)
console.info('----getWantAgent2 after----');
})
})
# Copyright (c) 2021 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsGetWantAgentInfoTwoTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetWantAgentInfoTwoTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
/*
* Copyright (c) 2021 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
/*
* Copyright (c) 2021 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.
*/
require('./WantAgent.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 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 wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgent1;
var WantAgent2;
var time = 1000
describe('ActsAnsGetWantAgentInfoTwoTest', function () {
console.info('----ActsGetWantAgentInfoTest----');
function CancelWantCallback(){
console.log("=========CancelWantCallback===========")
}
/*
* @tc.number: ACTS_SetWantInfo_0500
* @tc.name: getWantAgent(),cancel()
* @tc.desc: verify the function of getWantAgent(),cancel()
*/
it('ACTS_SetWantInfo_0500', 0, async function (done) {
console.info('----scene_test_callback_1----');
var agentInfo1 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent1 before----');
wantAgent.getWantAgent(agentInfo1,
(err, data) => {
if (err.code == 0) {
WantAgent1 = data;
console.info('----getWantAgent1 success!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.cancel(data,CancelWantCallback);
} else {
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
}),
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0500====>");
}, time)
console.info('----getWantAgent1 after----');
})
/*
* @tc.number: ACTS_SetWantInfo_0600
* @tc.name: getWantAgent(),equal()
* @tc.desc: verify the function of getWantAgent(),equal()
*/
it('ACTS_SetWantInfo_0600', 0, async function (done) {
var agentInfo2 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent2 before----');
wantAgent.getWantAgent(agentInfo2,
(err, data) => {
if (err.code == 0) {
WantAgent2 = data;
console.info('----getWantAgent2 success!----');
console.log("==WantAgent1=="+JSON.stringify(WantAgent1))
console.log("==WantAgent2=="+JSON.stringify(WantAgent2))
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgent1,WantAgent2,
(error,data) => {
if(error.code == 0) {
console.info('----equal1 success!----')
console.info(data);
}
else{
console.info('----equal1 failed!----')
}
}
)
wantAgent.equal(WantAgent1,WantAgent1,
(error,data) => {
if(error.code == 0) {
console.info('----equal2 success!----')
console.info(data);
}
else{
console.info('----equal2 failed!----')
}
}
)
}
else{
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
});
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0600====>");
}, time)
console.info('----getWantAgent2 after----');
})
})
# Copyright (c) 2021 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsGetWantAgentInfoTwoProTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetWantAgentInfoTwoProTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsansgetwantagentinfotwoprotest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetWantAgentInfoTwoProTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansgetwantagentinfotwoprotest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetwantagentinfotwoprotest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansgetwantagentinfotwoprotest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (c) 2021 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "AgentInfoPro2"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 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.
*/
require('./WantAgent.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 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 wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgent1;
var WantAgent2;
var time = 1000
describe('ActsAnsGetWantAgentInfoTwoProTest', function () {
console.info('----ActsGetWantAgentInfoTest----');
/*
* @tc.number: ACTS_SetWantInfo_0700
* @tc.name: getWantAgent()
* @tc.desc: verify the function of getWantAgent()
*/
it('ACTS_SetWantInfo_0700', 0, async function (done) {
var agentInfo1 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent1 before----');
wantAgent.getWantAgent(agentInfo1,
(err, data) => {
if (err.code == 0) {
WantAgent1 = data;
console.info('----getWantAgent1 Promise success!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
} else {
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0700====>");
}, time)
}),
console.info('----getWantAgent1 after----');
})
/*
* @tc.number: ACTS_SetWantInfo_0800
* @tc.name: getWantAgent(),equal()
* @tc.desc: verify the function of getWantAgent(),equal() promise
*/
it('ACTS_SetWantInfo_0800', 0, async function (done) {
var agentInfo2 = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
},
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent2 before----');
wantAgent.getWantAgent(agentInfo2,
(err, data) => {
if (err.code == 0) {
WantAgent2 = data;
console.info('----getWantAgent2 Promise success!----');
console.log("==WantAgent1=="+JSON.stringify(WantAgent1))
console.log("==WantAgent2=="+JSON.stringify(WantAgent2))
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgent1,WantAgent2).then(
(data) => {
console.info('----equalPromise1 success!----')
console.info(data);
expect(data).assertEqual(false);
}
)
wantAgent.equal(WantAgent1,WantAgent1).then(
(data) => {
console.info('----equalPromise2 success!----')
console.info(data);
expect(data).assertEqual(true);
}
)
}
else{
console.info('----getWantAgent failed!----');
console.info(data);
expect(typeof(data)).assertEqual("object");
}
done();
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0800====>");
}, time)
});
console.info('----getWantAgent2 after----');
})
})
......@@ -554,9 +554,8 @@ describe('ActsAnsCommonEventTest', function () {
}
}
//subscribeOn
function subscribeOnCallback(err) {
console.debug("===>subscribeOnCallback===>"+err.code);
expect(err.code).assertEqual(0);
function subscribeOnCallback() {
console.debug("===>subscribeOnCallback===>");
}
//subscribe
function subscribeCallback(err) {
......
......@@ -21,6 +21,7 @@ describe('ActsAnsSubscriberTest', function () {
var subInfoa ={
onConsume:consumeCallbackc,
onConnect:connectCallbacka,
onDisconnect:disconnectCallbacka,
}
function consumeCallbackc(err,data) {
console.debug("==>consumeCallbackc data : ==>" +err+ JSON.stringify(data));
......@@ -28,8 +29,7 @@ describe('ActsAnsSubscriberTest', function () {
notify.unsubscribe(subInfoa, unSubscribeCallbacka);
}
function connectCallbacka(err) {
console.debug("==>connectCallbacka code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbacka code==>");
}
function subscribeCallbacka(err) {
console.debug("==>subscribeCallbacka code==>" +err.code);
......@@ -39,10 +39,12 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbacka code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbacka(err){
console.debug("==>disconnectCallbacka code==>");
}
//ActsSubscriber_test_0200
function connectCallbackb(err) {
console.debug("==>connectCallbackb code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackb code==>");
}
function subscribeCallbackb(err) {
console.debug("==>subscribeCallbackb code==>" +err.code);
......@@ -56,14 +58,15 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbackb code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackb(err){
console.debug("==>disconnectCallbackb code==>");
}
//ActsSubscriber_test_0300
function connectCallbackc(err) {
console.debug("==>connectCallbackc code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackc code==>");
}
function connectCallbackd(err) {
console.debug("==>connectCallbackd code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackd code==>");
}
function subscribeCallbackd(err) {
console.debug("==>subscribeCallbackd code==>" +err.code);
......@@ -81,31 +84,18 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbackd code==>" +err.code);
expect(err.code).assertEqual(0);
}
//ActsSubscriber_test_0400
function connectCallbacke(err) {
console.debug("==>connectCallbacke code==>" +err.code);
expect(err.code).assertEqual(0);
function disconnectCallbackc(err){
console.debug("==>disconnectCallbackc code==>");
}
function subscribeCallbackf(err) {
console.debug("==>subscribeCallbackf code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbacke(err){
console.debug("==>unSubscribeCallbacke code==>" +err.code);
expect(err.code).assertEqual(0);
function disconnectCallbackd(err){
console.debug("==>disconnectCallbackd code==>");
}
//ActsSubscriber_test_0500
function connectCallbackf(err) {
console.debug("==>connectCallbackf code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackf code==>");
}
function connectCallbackg(err) {
console.debug("==>connectCallbackg code==>" +err.code);
expect(err.code).assertEqual(0);
}
function connectCallbackh(err) {
console.debug("==>connectCallbackh code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackg code==>");
}
function subscribeCallbackg(err) {
console.debug("==>subscribeCallbackg code==>" +err.code);
......@@ -119,10 +109,6 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>subscribeCallbacki code==>" +err.code);
expect(err.code).assertEqual(0);
}
function subscribeCallbackj(err) {
console.debug("==>subscribeCallbackj code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackf(err){
console.debug("==>unSubscribeCallbackf code==>" +err.code);
expect(err.code).assertEqual(0);
......@@ -131,14 +117,17 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbackg code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackh(err){
console.debug("==>unSubscribeCallbackh code==>" +err.code);
expect(err.code).assertEqual(0);
function disconnectCallbackf(err){
console.debug("==>disconnectCallbackf code==>");
}
function disconnectCallbackg(err){
console.debug("==>disconnectCallbackg code==>");
}
//ActsSubscriber_test_0600
var subInfob = {
onConsume:consumeCallbacka,
onConnect:connectCallbacki,
onDisconnect:disconnectCallbacki,
}
function consumeCallbacka(err,data) {
console.debug("==>consumeCallbacka data : ==>" +err+ JSON.stringify(data));
......@@ -146,8 +135,7 @@ describe('ActsAnsSubscriberTest', function () {
notify.unsubscribe(subInfob, unSubscribeCallbacki);
}
function connectCallbacki(err) {
console.debug("==>connectCallbacki code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbacki code==>");
}
function subscribeCallbackl(err) {
console.debug("==>subscribeCallbackl code==>" +err.code);
......@@ -157,10 +145,14 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbacki code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbacki(err){
console.debug("==>disconnectCallbacki code==>");
}
//ActsSubscriber_test_0700
var subInfoc ={
onConsume:consumeCallbackb,
onConnect:connectCallbackj,
onConnecte:connectCallbackj,
onDisconnect:disconnectCallbackj,
}
function consumeCallbackb(err,data) {
console.debug("==>consumeCallbackb data : ==>" +err+ JSON.stringify(data));
......@@ -168,17 +160,20 @@ describe('ActsAnsSubscriberTest', function () {
notify.unsubscribe(subInfoc, unSubscribeCallbackj);
}
function connectCallbackj(err) {
console.debug("==>connectCallbackj code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackj code==>");
}
function unSubscribeCallbackj(err){
console.debug("==>unSubscribeCallbackj code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackj(err){
console.debug("==>disconnectCallbackj code==>");
}
//ActsSubscriber_test_0800
var subInfod ={
onConsume:consumeCallbackd,
onConnect:connectCallbackm,
onDisconnect:disconnectCallbackl,
}
function consumeCallbackd(err,data) {
console.debug("==>consumeCallbackd data : ==>" +err+ JSON.stringify(data));
......@@ -186,8 +181,7 @@ describe('ActsAnsSubscriberTest', function () {
notify.unsubscribe(subInfod, unSubscribeCallbackl);
}
function connectCallbackm(err) {
console.debug("==>connectCallbackm code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackm code==>");
}
function subscribeCallbackn(err) {
console.debug("==>subscribeCallbackn code==>" +err.code);
......@@ -197,10 +191,14 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbackl code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackl(err){
console.debug("==>disconnectCallbackl code==>");
}
//ActsSubscriber_test_0900
var subInfoe ={
onConsume:consumeCallbacke,
onConnect:connectCallbackn,
onDisconnect:disconnectCallbackm,
}
function consumeCallbacke(err,data) {
console.debug("==>consumeCallbacke data : ==>" +err+ JSON.stringify(data));
......@@ -208,17 +206,18 @@ describe('ActsAnsSubscriberTest', function () {
notify.unsubscribe(subInfoe, unSubscribeCallbackm);
}
function connectCallbackn(err) {
console.debug("==>connectCallbackn code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackn code==>");
}
function unSubscribeCallbackm(err){
console.debug("==>unSubscribeCallbackm code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackm(err){
console.debug("==>disconnectCallbackm code==>");
}
//ActsSubscriber_test_1400
function connectCallbackl(err){
console.debug("==>connectCallbackl code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbackl code==>");
}
function subscribeCallbacko(err){
console.debug("==>subscribeCallbacko code==>" +err.code);
......@@ -228,10 +227,12 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbackn code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackn(err){
console.debug("==>disconnectCallbackn code==>");
}
//ActsSubscriber_test_1500
function connectCallbacko(err){
console.debug("==>connectCallbacko code==>" +err.code);
expect(err.code).assertEqual(0);
console.debug("==>connectCallbacko code==>");
}
function subscribeCallbackp(err){
console.debug("==>subscribeCallbackp code==>" +err.code);
......@@ -241,6 +242,9 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==>unSubscribeCallbacko code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbacko(err){
console.debug("==>disconnectCallbacko code==>");
}
function checkConsumeData(data){
expect(data.request.id).assertEqual(1);
expect(data.request.content.contentType).assertEqual(0);
......@@ -278,9 +282,6 @@ describe('ActsAnsSubscriberTest', function () {
await notify.subscribe(subInfoa, subscribeCallbacka);
console.debug("==ActsSubscriber_test_0100==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0100====>");
}, time);
})
/*
......@@ -292,15 +293,13 @@ describe('ActsAnsSubscriberTest', function () {
console.debug("==ActsSubscriber_test_0200==begin==>");
var subInfo ={
onConnect:connectCallbackb,
onDisconnect:disconnectCallbackb,
}
await notify.subscribe(subInfo,subscribeCallbackb);
await notify.subscribe(subInfo,subscribeCallbackc);
await notify.unsubscribe(subInfo, unSubscribeCallbackb);
console.debug("==ActsSubscriber_test_0200==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0200====>");
}, time);
})
/*
......@@ -313,9 +312,11 @@ describe('ActsAnsSubscriberTest', function () {
var subInfo ={
onConnect:connectCallbackc,
onDisconnect:disconnectCallbackc,
}
var subInfo2 ={
onConnect:connectCallbackd,
onDisconnect:disconnectCallbackd,
}
await notify.subscribe(subInfo,subscribeCallbackd);
await notify.subscribe(subInfo2,subscribeCallbacke);
......@@ -323,77 +324,43 @@ describe('ActsAnsSubscriberTest', function () {
await notify.unsubscribe(subInfo2, unSubscribeCallbackd);
console.debug("==ActsSubscriber_test_0300==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0300====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_0400', 0, async function (done) {
console.debug("==ActsSubscriber_test_0400==begin==>");
await notify.subscribe({
onConnect:connectCallbacke,
},subscribeCallbackf);
await notify.unsubscribe({
onConnect:connectCallbacke,
}, unSubscribeCallbacke);
console.debug("==ActsSubscriber_test_0400==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0400====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_0500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_0500', 0, async function (done) {
console.debug("==ActsSubscriber_test_0500==begin==>");
var subInfo ={
onConnect:connectCallbackf,
onDisconnect:disconnectCallbackf,
}
var subInfo2 ={
onConnect:connectCallbackg,
onDisconnect:disconnectCallbackg,
}
await notify.subscribe(subInfo,subscribeCallbackg);
await notify.subscribe(subInfo,subscribeCallbackh);
await notify.subscribe(subInfo2,subscribeCallbacki);
await notify.subscribe({
onConnect:connectCallbackh,
},subscribeCallbackj);
await notify.subscribe(subInfo,subscribeCallbackg);
await notify.subscribe(subInfo,subscribeCallbackh);
await notify.subscribe(subInfo2,subscribeCallbacki);
await notify.unsubscribe(subInfo, unSubscribeCallbackf);
await notify.unsubscribe(subInfo2, unSubscribeCallbackg);
await notify.unsubscribe({
onConnect:connectCallbackh,
}, unSubscribeCallbackh);
console.debug("==ActsSubscriber_test_0500==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0500====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_0600
* @tc.number: ActsSubscriber_test_0500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_0600', 0, async function (done) {
console.debug("==ActsSubscriber_test_0600==begin==>");
it('ActsSubscriber_test_0500', 0, async function (done) {
console.debug("==ActsSubscriber_test_0500==begin==>");
await notify.subscribe(subInfob, {bundleNames:["com.example.actsanspublishtest"]},subscribeCallbackl);
console.debug("==ActsSubscriber_test_0600==end3==>");
console.debug("==ActsSubscriber_test_0500==end3==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0600====>");
}, time);
})
/*
......@@ -401,147 +368,122 @@ describe('ActsAnsSubscriberTest', function () {
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_0700', 0, async function (done) {
console.debug("==ActsSubscriber_test_0700==begin==>");
it('ActsSubscriber_test_0600', 0, async function (done) {
console.debug("==ActsSubscriber_test_0600==begin==>");
await notify.subscribe(subInfoc, {bundleNames:["com.example.actsanspublishtest"]}).then(
console.log("ActsSubscriber_test_0700=======promise")
console.log("ActsSubscriber_test_0600=======promise")
);
console.debug("==ActsSubscriber_test_0700==end==>");
console.debug("==ActsSubscriber_test_0600==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0700====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_0800
* @tc.number: ActsSubscriber_test_0700
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_0800', 0, async function (done) {
console.debug("==ActsSubscriber_test_0800==begin==>");
it('ActsSubscriber_test_0700', 0, async function (done) {
console.debug("==ActsSubscriber_test_0700==begin==>");
await notify.subscribe(subInfod, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]},subscribeCallbackn);
console.debug("==ActsSubscriber_test_0800==end==>");
console.debug("==ActsSubscriber_test_0700==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0800====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_0900
* @tc.number: ActsSubscriber_test_0800
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_0900', 0, async function (done) {
it('ActsSubscriber_test_0800', 0, async function (done) {
console.debug("==ActsSubscriber_test_0900==begin==>");
await notify.subscribe(subInfoe, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]}).then(
console.log("ActsSubscriber_test_0900=======promise")
);
console.debug("==ActsSubscriber_test_0900==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_0900====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_1000
* @tc.number: ActsSubscriber_test_0900
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1000', 0, async function (done) {
it('ActsSubscriber_test_0900', 0, async function (done) {
console.debug("==ActsSubscriber_test_1000==begin==>");
var promise = notify.subscribe(100,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1000==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1000====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_1100
* @tc.number: ActsSubscriber_test_1000
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1100', 0, async function (done) {
console.debug("==ActsSubscriber_test_1100==begin==>");
it('ActsSubscriber_test_1000', 0, async function (done) {
console.debug("==ActsSubscriber_test_1000==begin==>");
var subInfo = null
var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1100==end==>");
console.debug("==ActsSubscriber_test_1000==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1100====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_1200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1200', 0, async function (done) {
it('ActsSubscriber_test_1100', 0, async function (done) {
console.debug("==ActsSubscriber_test_1200==begin==>");
var subInfo = "#$#%$%$^&%^%"
var promise = notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1200==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1200====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_1300
* @tc.number: ActsSubscriber_test_1200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1300', 0, async function (done) {
console.debug("==ActsSubscriber_test_1300==begin==>");
it('ActsSubscriber_test_1200', 0, async function (done) {
console.debug("==ActsSubscriber_test_1200==begin==>");
var subInfo = ""
var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1300==end==>");
console.debug("==ActsSubscriber_test_1200==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1300====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_1400
* @tc.number: ActsSubscriber_test_1300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1400', 0, async function (done) {
console.debug("==ActsSubscriber_test_1100==begin==>");
it('ActsSubscriber_test_1300', 0, async function (done) {
console.debug("==ActsSubscriber_test_1300==begin==>");
var subInfo ={
onConnect:connectCallbackl,
onDisconnect:disconnectCallbackn,
}
await notify.subscribe(subInfo,{bundleNames:["wrongBudleName"]},subscribeCallbacko);
await notify.unsubscribe(subInfo, unSubscribeCallbackn);
console.debug("==ActsSubscriber_test_1400==end==>");
console.debug("==ActsSubscriber_test_1300==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1400====>");
}, time);
})
/*
* @tc.number: ActsSubscriber_test_1500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1500', 0, async function (done) {
console.debug("==ActsSubscriber_test_1500==begin==>");
it('ActsSubscriber_test_1400', 0, async function (done) {
console.debug("==ActsSubscriber_test_1400==begin==>");
var subInfo ={
onConnect:connectCallbacko,
onDisconnect:disconnectCallbacko,
}
await notify.subscribe(subInfo,{bundleNames:[]},subscribeCallbackp);
await notify.unsubscribe(subInfo, unSubscribeCallbacko);
console.debug("==ActsSubscriber_test_1500==end==>");
console.debug("==ActsSubscriber_test_1400==end==>");
done();
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1500====>");
}, time);
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册