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

!6388 【上传下载】FA模型用例优化

Merge pull request !6388 from 何海涛/cherry-pick-1667588113
...@@ -19,34 +19,34 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " ...@@ -19,34 +19,34 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
export default function requestDownloadJSUnit() { export default function requestDownloadJSUnit() {
describe('requestDownloadTest', function () { describe('requestDownloadTest', function () {
console.info('################################request download Test start'); console.info('====>################################request download Test start');
/** /**
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/ */
beforeAll(function () { beforeAll(function () {
console.info('beforeAll: Prerequisites are executed.'); console.info('====>beforeAll: Prerequisites are executed.');
}); });
/** /**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/ */
beforeEach(function () { beforeEach(function () {
console.info('beforeEach: Prerequisites is executed.'); console.info('====>beforeEach: Prerequisites is executed.');
}); });
/** /**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed. * afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/ */
afterEach(function () { afterEach(function () {
console.info('afterEach: Test case-level clearance conditions is executed.'); console.info('====>afterEach: Test case-level clearance conditions is executed.');
}); });
/** /**
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/ */
afterAll(function () { afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition is executed'); console.info('====>afterAll: Test suite-level cleanup condition is executed');
}); });
let downloadTask; let downloadTask;
...@@ -72,18 +72,18 @@ export default function requestDownloadJSUnit() { ...@@ -72,18 +72,18 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 is starting-----------------------");
try { try {
request.download(downloadConfig, (data)=>{ request.download(downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
}); });
} catch (err) { } catch (err) {
console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 error: " + err);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 end-----------------------");
done(); done();
}); });
...@@ -95,16 +95,16 @@ export default function requestDownloadJSUnit() { ...@@ -95,16 +95,16 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_PROMISE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 is starting-----------------------");
request.download(downloadConfig).then(data => { request.download(downloadConfig).then(data => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
}).catch(err => { }).catch(err => {
console.error("SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 error: " + err);
expect().assertFail(); expect().assertFail();
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 end-----------------------");
done(); done();
}); });
...@@ -116,20 +116,20 @@ export default function requestDownloadJSUnit() { ...@@ -116,20 +116,20 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined); expect(true).assertEqual(downloadTask != undefined);
downloadTask.on('progress', (data1, data2) => { downloadTask.on('progress', (data1, data2) => {
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data1 =" + data1); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data1 =" + data1);
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data2 =" + data2); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data2 =" + data2);
expect(true).assertEqual(data1 != undefined); expect(true).assertEqual(data1 != undefined);
expect(true).assertEqual(data2 != undefined); expect(true).assertEqual(data2 != undefined);
}); });
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 end-----------------------");
done(); done();
}); });
...@@ -141,21 +141,21 @@ export default function requestDownloadJSUnit() { ...@@ -141,21 +141,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined);
try{ try{
expect(true).assertEqual(downloadTask != undefined);
downloadTask.on('complete', () => { downloadTask.on('complete', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 task completed.') console.info('====>SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 task completed.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 end-----------------------");
done(); done();
}); });
...@@ -167,21 +167,21 @@ export default function requestDownloadJSUnit() { ...@@ -167,21 +167,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined);
try{ try{
expect(true).assertEqual(downloadTask != undefined);
downloadTask.on('pause', () => { downloadTask.on('pause', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 task pause.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 task pause.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 end-----------------------");
done(); done();
}); });
...@@ -193,21 +193,22 @@ export default function requestDownloadJSUnit() { ...@@ -193,21 +193,22 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
try{ try{
expect(downloadTask != undefined).assertEqual(true);
downloadTask.on('remove', () => { downloadTask.on('remove', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 task remove.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 task remove.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 end-----------------------");
done(); done();
}); });
...@@ -219,21 +220,21 @@ export default function requestDownloadJSUnit() { ...@@ -219,21 +220,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.on('remove', () => { downloadTask.on('remove', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 task remove.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 task remove.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 end-----------------------");
done(); done();
}); });
...@@ -245,19 +246,19 @@ export default function requestDownloadJSUnit() { ...@@ -245,19 +246,19 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.off('progress', (data1, data2) => { downloadTask.off('progress', (data1, data2) => {
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 on data1 =" + data1); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 on data1 =" + data1);
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 on data2 =" + data2); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 on data2 =" + data2);
expect(data1 != undefined).assertEqual(true); expect(data1 != undefined).assertEqual(true);
expect(data2 != undefined).assertEqual(true); expect(data2 != undefined).assertEqual(true);
}); });
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 end-----------------------");
done(); done();
}); });
...@@ -269,21 +270,21 @@ export default function requestDownloadJSUnit() { ...@@ -269,21 +270,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.off('complete', () => { downloadTask.off('complete', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 task complete.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 task complete.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------");
done(); done();
}); });
...@@ -295,21 +296,21 @@ export default function requestDownloadJSUnit() { ...@@ -295,21 +296,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.off('pause', () => { downloadTask.off('pause', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 task pause.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 task pause.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------");
done(); done();
}); });
...@@ -321,21 +322,21 @@ export default function requestDownloadJSUnit() { ...@@ -321,21 +322,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.off('remove', () => { downloadTask.off('remove', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 task remove.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 task remove.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 end-----------------------");
done(); done();
}); });
...@@ -347,21 +348,21 @@ export default function requestDownloadJSUnit() { ...@@ -347,21 +348,21 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.off('pause', () => { downloadTask.off('pause', () => {
console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 task complete.') console.info('====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 task complete.')
}); });
}catch(err){ }catch(err){
console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 error: " + err); console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 error: " + err);
expect().assertFail(); expect().assertFail();
} }
}); });
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------");
done(); done();
}); });
...@@ -373,10 +374,10 @@ export default function requestDownloadJSUnit() { ...@@ -373,10 +374,10 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.remove((err, data)=>{ downloadTask.remove((err, data)=>{
if(err) { if(err) {
...@@ -384,7 +385,7 @@ export default function requestDownloadJSUnit() { ...@@ -384,7 +385,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
} }
if (data) { if (data) {
console.info('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Download task removed.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Download task removed.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
} else { } else {
console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Failed to remove the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Failed to remove the download task.');
...@@ -392,7 +393,7 @@ export default function requestDownloadJSUnit() { ...@@ -392,7 +393,7 @@ export default function requestDownloadJSUnit() {
} }
}); });
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 end-----------------------");
done(); done();
}); });
...@@ -404,14 +405,14 @@ export default function requestDownloadJSUnit() { ...@@ -404,14 +405,14 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.remove().then(data => { downloadTask.remove().then(data => {
if (data) { if (data) {
console.info('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Download task removed.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Download task removed.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
} else { } else {
console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Failed to remove the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Failed to remove the download task.');
...@@ -422,7 +423,7 @@ export default function requestDownloadJSUnit() { ...@@ -422,7 +423,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
}) })
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 end-----------------------");
done(); done();
}); });
...@@ -434,14 +435,14 @@ export default function requestDownloadJSUnit() { ...@@ -434,14 +435,14 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_PAUSE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_PAUSE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.pause(()=>{ downloadTask.pause(()=>{
console.info('SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 Download task pause success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 Download task pause success.');
expect(true).assertTrue(); expect(true).assertTrue();
}) })
}catch(err){ }catch(err){
...@@ -449,7 +450,7 @@ export default function requestDownloadJSUnit() { ...@@ -449,7 +450,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
} }
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 end-----------------------");
done(); done();
}); });
...@@ -461,20 +462,20 @@ export default function requestDownloadJSUnit() { ...@@ -461,20 +462,20 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_PAUSE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_PAUSE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.pause().then(() => { downloadTask.pause().then(() => {
console.info('SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 Download task pause success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 Download task pause success.');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.error('Failed to pause the download task pause. because: ' + JSON.stringify(err)); console.error('Failed to pause the download task pause. because: ' + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
}) })
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 end-----------------------");
done(); done();
}); });
...@@ -486,14 +487,14 @@ export default function requestDownloadJSUnit() { ...@@ -486,14 +487,14 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_REMUSE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_REMUSE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.resume(()=>{ downloadTask.resume(()=>{
console.info('SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 Download task resume success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 Download task resume success.');
expect(true).assertTrue(); expect(true).assertTrue();
}) })
}catch(err){ }catch(err){
...@@ -501,7 +502,7 @@ export default function requestDownloadJSUnit() { ...@@ -501,7 +502,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
} }
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 end-----------------------");
done(); done();
}); });
...@@ -513,20 +514,20 @@ export default function requestDownloadJSUnit() { ...@@ -513,20 +514,20 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_REMUSE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_REMUSE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.resume().then(() => { downloadTask.resume().then(() => {
console.info('SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 Download task resume success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 Download task resume success.');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.error('Failed to pause the download task resume. because: ' + JSON.stringify(err)); console.error('Failed to pause the download task resume. because: ' + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
}) })
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 end-----------------------");
done(); done();
}); });
...@@ -538,10 +539,10 @@ export default function requestDownloadJSUnit() { ...@@ -538,10 +539,10 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_QUERY_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_QUERY_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0001 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
try{ try{
downloadTask.query((err, downloadInfo)=>{ downloadTask.query((err, downloadInfo)=>{
...@@ -549,17 +550,17 @@ export default function requestDownloadJSUnit() { ...@@ -549,17 +550,17 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 Failed to query: ' + JSON.stringify(err)); console.error('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 Failed to query: ' + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
} else { } else {
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.description); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.description);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadedBytes); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadedBytes);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadId); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadId);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.failedReason); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.failedReason);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.fileName); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.fileName);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.filePath); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.filePath);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.pausedReason); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.pausedReason);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.status); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.status);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.targetURI); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.targetURI);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTitle); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTitle);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTotalBytes); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTotalBytes);
expect(true).assertTrue(); expect(true).assertTrue();
} }
}) })
...@@ -568,7 +569,7 @@ export default function requestDownloadJSUnit() { ...@@ -568,7 +569,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
} }
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0001 end-----------------------");
done(); done();
}); });
...@@ -580,27 +581,27 @@ export default function requestDownloadJSUnit() { ...@@ -580,27 +581,27 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_QUERY_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_QUERY_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0002 is starting-----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.query().then((err, downloadInfo)=>{ downloadTask.query().then((err, downloadInfo)=>{
if(err) { if(err) {
console.error('SUB_REQUEST_DOWNLOAD_API_QUERY_0002 Failed to query: ' + JSON.stringify(err)); console.error('SUB_REQUEST_DOWNLOAD_API_QUERY_0002 Failed to query: ' + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
} else { } else {
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.description); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.description);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadedBytes); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadedBytes);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadId); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadId);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.failedReason); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.failedReason);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.fileName); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.fileName);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.filePath); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.filePath);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.pausedReason); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.pausedReason);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.status); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.status);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.targetURI); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.targetURI);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTitle); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTitle);
console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTotalBytes); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTotalBytes);
expect(true).assertTrue(); expect(true).assertTrue();
} }
}).catch(err => { }).catch(err => {
...@@ -608,7 +609,7 @@ export default function requestDownloadJSUnit() { ...@@ -608,7 +609,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
}) })
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0002 end-----------------------");
done(); done();
}); });
...@@ -620,10 +621,10 @@ export default function requestDownloadJSUnit() { ...@@ -620,10 +621,10 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001', 0, async function (done) {
console.info("---------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 is starting---------------------"); console.info("====>---------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 is starting---------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.queryMimeType((err, data)=>{ downloadTask.queryMimeType((err, data)=>{
if(err) { if(err) {
...@@ -631,7 +632,7 @@ export default function requestDownloadJSUnit() { ...@@ -631,7 +632,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
} }
if (data) { if (data) {
console.info('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Download task queryMimeType.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Download task queryMimeType.');
expect(typeof data == "string").assertTrue(); expect(typeof data == "string").assertTrue();
} else { } else {
console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Failed to queryMimeType the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Failed to queryMimeType the download task.');
...@@ -639,7 +640,7 @@ export default function requestDownloadJSUnit() { ...@@ -639,7 +640,7 @@ export default function requestDownloadJSUnit() {
} }
}); });
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 end-----------------------");
done(); done();
}); });
...@@ -651,14 +652,14 @@ export default function requestDownloadJSUnit() { ...@@ -651,14 +652,14 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002', 0, async function (done) {
console.info("-------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 is starting----------------------"); console.info("====>-------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 is starting----------------------");
request.download( downloadConfig, (data)=>{ request.download( downloadConfig, (data)=>{
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.queryMimeType().then(data => { downloadTask.queryMimeType().then(data => {
if (data) { if (data) {
console.info('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Download task queryMimeType.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Download task queryMimeType.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
} else { } else {
console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Failed to queryMimeType the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Failed to queryMimeType the download task.');
...@@ -669,7 +670,7 @@ export default function requestDownloadJSUnit() { ...@@ -669,7 +670,7 @@ export default function requestDownloadJSUnit() {
expect().assertFail(); expect().assertFail();
}) })
}) })
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 end-----------------------");
done(); done();
}); });
...@@ -681,18 +682,18 @@ export default function requestDownloadJSUnit() { ...@@ -681,18 +682,18 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DELETE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DELETE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_delete_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_delete_0001 is starting-----------------------");
try { try {
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DELETE_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DELETE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.delete((err, data) => { downloadTask.delete((err, data) => {
if (err) { if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 Failed to delete the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 Failed to delete the download task.');
expect().assertFail(); expect().assertFail();
} }
console.info('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 Download task delete success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_DELETE_0001 Download task delete success.');
expect(typeof data == "boolean").assertTrue(); expect(typeof data == "boolean").assertTrue();
}); });
}) })
...@@ -700,7 +701,7 @@ export default function requestDownloadJSUnit() { ...@@ -700,7 +701,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 delete catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 delete catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0001 end-----------------------");
done(); done();
}); });
...@@ -712,17 +713,17 @@ export default function requestDownloadJSUnit() { ...@@ -712,17 +713,17 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_DELETE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_DELETE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0002 is starting-----------------------");
try { try {
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DELETE_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_DELETE_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.delete().then(data => { downloadTask.delete().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 Download task delete success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_DELETE_0002 Download task delete success.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 Failed to delete the download task.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_DELETE_0002 Failed to delete the download task.');
expect().assertFail(); expect().assertFail();
}) })
}) })
...@@ -730,7 +731,7 @@ export default function requestDownloadJSUnit() { ...@@ -730,7 +731,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 delete catch error'); console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 delete catch error');
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0002 end-----------------------");
done(); done();
}); });
...@@ -742,18 +743,18 @@ export default function requestDownloadJSUnit() { ...@@ -742,18 +743,18 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 is starting-----------------------");
try { try {
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.suspend((err, data) => { downloadTask.suspend((err, data) => {
if (err) { if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Failed to suspend the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Failed to suspend the download task.');
expect().assertFail(); expect().assertFail();
} }
console.info('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Download task suspend success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Download task suspend success.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}); });
}) })
...@@ -762,7 +763,7 @@ export default function requestDownloadJSUnit() { ...@@ -762,7 +763,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 suspend catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 suspend catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 end-----------------------");
done(); done();
}); });
...@@ -774,17 +775,17 @@ export default function requestDownloadJSUnit() { ...@@ -774,17 +775,17 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 is starting-----------------------");
try { try {
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.suspend().then(data => { downloadTask.suspend().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Download task suspend success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Download task suspend success.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 Failed to suspend the download task.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 Failed to suspend the download task.');
expect().assertFail(); expect().assertFail();
}) })
}) })
...@@ -793,7 +794,7 @@ export default function requestDownloadJSUnit() { ...@@ -793,7 +794,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 suspend catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 suspend catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 end-----------------------");
done(); done();
}); });
...@@ -805,18 +806,18 @@ export default function requestDownloadJSUnit() { ...@@ -805,18 +806,18 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 is starting-----------------------");
try{ try{
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.restore((err, data) => { downloadTask.restore((err, data) => {
if (err) { if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 Failed to restore the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 Failed to restore the download task.');
expect().assertFail(); expect().assertFail();
} }
console.info('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 Download restore success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 Download restore success.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}); });
}); });
...@@ -824,7 +825,7 @@ export default function requestDownloadJSUnit() { ...@@ -824,7 +825,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 restore catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 restore catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 end-----------------------");
done(); done();
}); });
...@@ -836,17 +837,17 @@ export default function requestDownloadJSUnit() { ...@@ -836,17 +837,17 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 is starting-----------------------");
try{ try{
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.restore().then(data => { downloadTask.restore().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 Download task restore.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 Download task restore.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 Failed to restore the download task.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 Failed to restore the download task.');
expect().assertFail(); expect().assertFail();
}); });
}); });
...@@ -854,7 +855,7 @@ export default function requestDownloadJSUnit() { ...@@ -854,7 +855,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 restore catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 restore catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 end-----------------------");
done(); done();
}); });
...@@ -866,18 +867,18 @@ export default function requestDownloadJSUnit() { ...@@ -866,18 +867,18 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001', 0, async function (done) {
console.info("---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 is starting---------------------"); console.info("====>---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 is starting---------------------");
try{ try{
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskInfo((err, data) => { downloadTask.getTaskInfo((err, data) => {
if (err) { if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 Failed to getTaskInfo the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 Failed to getTaskInfo the download task.');
expect().assertFail(); expect().assertFail();
} }
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 Download getTaskInfo success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 Download getTaskInfo success.');
expect(typeof data == "object").assertTrue(); expect(typeof data == "object").assertTrue();
}); });
}); });
...@@ -885,7 +886,7 @@ export default function requestDownloadJSUnit() { ...@@ -885,7 +886,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 getTaskInfo catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 getTaskInfo catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 end-----------------------");
done(); done();
}); });
...@@ -897,14 +898,14 @@ export default function requestDownloadJSUnit() { ...@@ -897,14 +898,14 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002', 0, async function (done) {
console.info("-------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 is starting----------------------"); console.info("====>-------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 is starting----------------------");
try{ try{
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskInfo().then(data => { downloadTask.getTaskInfo().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 Download task getTaskInfo success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 Download task getTaskInfo success.');
expect(typeof data == "object").assertTrue(); expect(typeof data == "object").assertTrue();
}).catch((err) => { }).catch((err) => {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 Failed to getTaskInfo the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 Failed to getTaskInfo the download task.');
...@@ -915,7 +916,7 @@ export default function requestDownloadJSUnit() { ...@@ -915,7 +916,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 getTaskInfo catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 getTaskInfo catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 end-----------------------");
done(); done();
}); });
...@@ -927,18 +928,18 @@ export default function requestDownloadJSUnit() { ...@@ -927,18 +928,18 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001', 0, async function (done) {
console.info("---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 is starting---------------------"); console.info("====>---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 is starting---------------------");
try{ try{
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskMimeType((err, data) => { downloadTask.getTaskMimeType((err, data) => {
if (err) { if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 Failed to getTaskMimeType the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 Failed to getTaskMimeType the download task.');
expect().assertFail(); expect().assertFail();
} }
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 Download task getTaskMimeType success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 Download task getTaskMimeType success.');
expect(typeof data == "string").assertTrue(); expect(typeof data == "string").assertTrue();
}); });
}); });
...@@ -946,7 +947,7 @@ export default function requestDownloadJSUnit() { ...@@ -946,7 +947,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 getTaskMimeType catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 getTaskMimeType catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 end-----------------------");
done(); done();
}); });
...@@ -958,14 +959,14 @@ export default function requestDownloadJSUnit() { ...@@ -958,14 +959,14 @@ export default function requestDownloadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002', 0, async function (done) { it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002', 0, async function (done) {
console.info("-------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 is starting----------------------"); console.info("====>-------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 is starting----------------------");
try{ try{
request.download(downloadConfig, (data) => { request.download(downloadConfig, (data) => {
downloadTask = data; downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 downloadTask: " + downloadTask); console.info("====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true); expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskMimeType().then(data => { downloadTask.getTaskMimeType().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 Download getTaskMimeType success.'); console.info('====>SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 Download getTaskMimeType success.');
expect(typeof data == "string").assertTrue(); expect(typeof data == "string").assertTrue();
}).catch((err) => { }).catch((err) => {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 Failed to getTaskMimeType the download task.'); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 Failed to getTaskMimeType the download task.');
...@@ -976,7 +977,7 @@ export default function requestDownloadJSUnit() { ...@@ -976,7 +977,7 @@ export default function requestDownloadJSUnit() {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 getTaskMimeType catch error' + error); console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 getTaskMimeType catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 end-----------------------");
done(); done();
}); });
......
...@@ -18,7 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " ...@@ -18,7 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
export default function requestSystemJSUnit() { export default function requestSystemJSUnit() {
describe('requestSystemJSUnit', function () { describe('requestSystemJSUnit', function () {
console.info('****************start requestSystemTest*****************') console.info('====>****************start requestSystemTest*****************')
/** /**
* @tc.name: ohos.SUB_REQUESTSYSTEM_UPLOAD_API_0001 * @tc.name: ohos.SUB_REQUESTSYSTEM_UPLOAD_API_0001
...@@ -28,7 +28,7 @@ export default function requestSystemJSUnit() { ...@@ -28,7 +28,7 @@ export default function requestSystemJSUnit() {
* @tc.level: Level 1 * @tc.level: Level 1
*/ */
it('SUB_REQUESTSYSTEM_UPLOAD_API_0001', 0, async function (done) { it('SUB_REQUESTSYSTEM_UPLOAD_API_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 start-----------------------"); console.info("====>-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 start-----------------------");
let UploadResponse = { let UploadResponse = {
code: 200, code: 200,
data: '', data: '',
...@@ -52,23 +52,23 @@ export default function requestSystemJSUnit() { ...@@ -52,23 +52,23 @@ export default function requestSystemJSUnit() {
}, },
], ],
success: function(UploadResponse) { success: function(UploadResponse) {
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload success, code:' + UploadResponse.code); console.info('====>SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload success, code:' + UploadResponse.code);
}, },
fail: function(data, code) { fail: function(data, code) {
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload fail'); console.info('====>SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload fail');
}, },
complete: function (){ complete: function (){
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload complete'); console.info('====>SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload complete');
} }
} }
try{ try{
let result = request.upload(UploadRequestOptions); let result = request.upload(UploadRequestOptions);
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + result); console.info('====>SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + result);
expect(true).assertEqual(true); expect(true).assertEqual(true);
}catch(err){ }catch(err){
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + err); console.info('====>SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + err);
} }
console.info("-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 end-----------------------");
done(); done();
}); });
...@@ -80,7 +80,7 @@ export default function requestSystemJSUnit() { ...@@ -80,7 +80,7 @@ export default function requestSystemJSUnit() {
* @tc.level: Level 1 * @tc.level: Level 1
*/ */
it('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001', 0, async function (done) { it('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 start-----------------------"); console.info("====>-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 start-----------------------");
let DownloadResponse = { let DownloadResponse = {
token: "Hm_lpvt_1d6c34c1bc067f5746a5fca18d1c24ab" token: "Hm_lpvt_1d6c34c1bc067f5746a5fca18d1c24ab"
} }
...@@ -91,23 +91,23 @@ export default function requestSystemJSUnit() { ...@@ -91,23 +91,23 @@ export default function requestSystemJSUnit() {
header: '', header: '',
description: 'this is requeSystem download response', description: 'this is requeSystem download response',
success: function(DownloadResponse) { success: function(DownloadResponse) {
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001call success callback success: ' + DownloadResponse.token); console.info('====>SUB_REQUESTSYSTEM_DOWNLOAD_API_0001call success callback success: ' + DownloadResponse.token);
}, },
fail: function(data, code) { fail: function(data, code) {
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 handling fail'); console.info('====>SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 handling fail');
}, },
complete: function (){ complete: function (){
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete'); console.info('====>SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete');
} }
} }
try{ try{
let result = request.download(DownloadRequestOptions); let result = request.download(DownloadRequestOptions);
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 upload err:' + result); console.info('====>SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 upload err:' + result);
expect(result == null).assertEqual(true); expect(result == null).assertEqual(true);
}catch(err){ }catch(err){
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete' + err); console.info('====>SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete' + err);
} }
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 end-----------------------");
done(); done();
}); });
...@@ -119,27 +119,27 @@ export default function requestSystemJSUnit() { ...@@ -119,27 +119,27 @@ export default function requestSystemJSUnit() {
* @tc.level: Level 1 * @tc.level: Level 1
*/ */
it('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001', 0, async function (done) { it('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 start-----------------------"); console.info("====>-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 start-----------------------");
let OnDownloadCompleteResponse = { let OnDownloadCompleteResponse = {
uri: "http://www.path.com" uri: "http://www.path.com"
} }
let OnDownloadCompleteOptions = { let OnDownloadCompleteOptions = {
token: 'token-index', token: 'token-index',
success: function(OnDownloadCompleteResponse) { success: function(OnDownloadCompleteResponse) {
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download success,uri:' console.info('====>SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download success,uri:'
+ OnDownloadCompleteResponse.uri); + OnDownloadCompleteResponse.uri);
}, },
fail: function(data, code) { fail: function(data, code) {
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download fail'); console.info('====>SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download fail');
}, },
complete: function (){ complete: function (){
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download complete'); console.info('====>SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download complete');
} }
} }
let result = request.onDownloadComplete(OnDownloadCompleteOptions); let result = request.onDownloadComplete(OnDownloadCompleteOptions);
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 upload err:' + result); console.info('====>SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 upload err:' + result);
expect(result == null).assertEqual(true); expect(result == null).assertEqual(true);
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 end-----------------------");
done(); done();
}); });
}) })
......
...@@ -19,34 +19,34 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " ...@@ -19,34 +19,34 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
export default function requestUploadJSUnit() { export default function requestUploadJSUnit() {
describe('requestUploadTest', function () { describe('requestUploadTest', function () {
console.info('################################request upload Test start'); console.info('====>################################request upload Test start');
/** /**
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/ */
beforeAll(function () { beforeAll(function () {
console.info('beforeAll: Prerequisites are executed.'); console.info('====>beforeAll: Prerequisites are executed.');
}); });
/** /**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/ */
beforeEach(function () { beforeEach(function () {
console.info('beforeEach: Prerequisites is executed.'); console.info('====>beforeEach: Prerequisites is executed.');
}); });
/** /**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed. * afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/ */
afterEach(function () { afterEach(function () {
console.info('afterEach: Test case-level clearance conditions is executed.'); console.info('====>afterEach: Test case-level clearance conditions is executed.');
}); });
/** /**
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/ */
afterAll(function () { afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition is executed'); console.info('====>afterAll: Test suite-level cleanup condition is executed');
}); });
/** /**
...@@ -88,21 +88,21 @@ export default function requestUploadJSUnit() { ...@@ -88,21 +88,21 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_REQUEST_UPLOAD_API_0001', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0001 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_0001 request.NETWORK_MOBILE:" + request.NETWORK_MOBILE); console.info("====>SUB_REQUEST_UPLOAD_API_0001 request.NETWORK_MOBILE:" + request.NETWORK_MOBILE);
expect(request.NETWORK_MOBILE).assertEqual(1); expect(request.NETWORK_MOBILE).assertEqual(1);
console.info("SUB_REQUEST_UPLOAD_API_0001 request.NETWORK_WIFI:" + request.NETWORK_WIFI); console.info("====>SUB_REQUEST_UPLOAD_API_0001 request.NETWORK_WIFI:" + request.NETWORK_WIFI);
expect(request.NETWORK_WIFI).assertEqual(65536); expect(request.NETWORK_WIFI).assertEqual(65536);
console.info("SUB_REQUEST_UPLOAD_API_0001 request.ERROR_CANNOT_RESUME:" + request.ERROR_CANNOT_RESUME); console.info("====>SUB_REQUEST_UPLOAD_API_0001 request.ERROR_CANNOT_RESUME:" + request.ERROR_CANNOT_RESUME);
expect(request.ERROR_CANNOT_RESUME).assertEqual(0); expect(request.ERROR_CANNOT_RESUME).assertEqual(0);
console.info("SUB_REQUEST_UPLOAD_API_0001 request.ERROR_DEVICE_NOT_FOUND:" + request.ERROR_DEVICE_NOT_FOUND); console.info("====>SUB_REQUEST_UPLOAD_API_0001 request.ERROR_DEVICE_NOT_FOUND:" + request.ERROR_DEVICE_NOT_FOUND);
expect(request.ERROR_DEVICE_NOT_FOUND).assertEqual(1); expect(request.ERROR_DEVICE_NOT_FOUND).assertEqual(1);
} catch (err) { } catch (err) {
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0001 error: " + err); console.error("SUB_REQUEST_UPLOAD_API_0001 error: " + err);
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0001 end-----------------------");
done(); done();
}); });
...@@ -115,21 +115,21 @@ export default function requestUploadJSUnit() { ...@@ -115,21 +115,21 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_REQUEST_UPLOAD_API_0002', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0002 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_FILE_ALREADY_EXISTS:" + request.ERROR_FILE_ALREADY_EXISTS); console.info("====>SUB_REQUEST_UPLOAD_API_0002 request.ERROR_FILE_ALREADY_EXISTS:" + request.ERROR_FILE_ALREADY_EXISTS);
expect(request.ERROR_FILE_ALREADY_EXISTS).assertEqual(2); expect(request.ERROR_FILE_ALREADY_EXISTS).assertEqual(2);
console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_FILE_ERROR:" + request.ERROR_FILE_ERROR); console.info("====>SUB_REQUEST_UPLOAD_API_0002 request.ERROR_FILE_ERROR:" + request.ERROR_FILE_ERROR);
expect(request.ERROR_FILE_ERROR).assertEqual(3); expect(request.ERROR_FILE_ERROR).assertEqual(3);
console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_HTTP_DATA_ERROR:" + request.ERROR_HTTP_DATA_ERROR); console.info("====>SUB_REQUEST_UPLOAD_API_0002 request.ERROR_HTTP_DATA_ERROR:" + request.ERROR_HTTP_DATA_ERROR);
expect(request.ERROR_HTTP_DATA_ERROR).assertEqual(4); expect(request.ERROR_HTTP_DATA_ERROR).assertEqual(4);
console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_INSUFFICIENT_SPACE:" + request.ERROR_INSUFFICIENT_SPACE); console.info("====>SUB_REQUEST_UPLOAD_API_0002 request.ERROR_INSUFFICIENT_SPACE:" + request.ERROR_INSUFFICIENT_SPACE);
expect(request.ERROR_INSUFFICIENT_SPACE).assertEqual(5); expect(request.ERROR_INSUFFICIENT_SPACE).assertEqual(5);
} catch (err) { } catch (err) {
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0002 error: " + err); console.error("SUB_REQUEST_UPLOAD_API_0002 error: " + err);
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0002 end-----------------------");
done(); done();
}); });
...@@ -142,21 +142,21 @@ export default function requestUploadJSUnit() { ...@@ -142,21 +142,21 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_REQUEST_UPLOAD_API_0003', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_0003', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0003 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0003 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_0003 request.ERROR_TOO_MANY_REDIRECTS:" + request.ERROR_TOO_MANY_REDIRECTS); console.info("====>SUB_REQUEST_UPLOAD_API_0003 request.ERROR_TOO_MANY_REDIRECTS:" + request.ERROR_TOO_MANY_REDIRECTS);
expect(request.ERROR_TOO_MANY_REDIRECTS).assertEqual(6); expect(request.ERROR_TOO_MANY_REDIRECTS).assertEqual(6);
console.info("SUB_REQUEST_UPLOAD_API_0003 request.ERROR_UNHANDLED_HTTP_CODE:" + request.ERROR_UNHANDLED_HTTP_CODE); console.info("====>SUB_REQUEST_UPLOAD_API_0003 request.ERROR_UNHANDLED_HTTP_CODE:" + request.ERROR_UNHANDLED_HTTP_CODE);
expect(request.ERROR_UNHANDLED_HTTP_CODE).assertEqual(7); expect(request.ERROR_UNHANDLED_HTTP_CODE).assertEqual(7);
console.info("SUB_REQUEST_UPLOAD_API_0003 request.ERROR_UNKNOWN:" + request.ERROR_UNKNOWN); console.info("====>SUB_REQUEST_UPLOAD_API_0003 request.ERROR_UNKNOWN:" + request.ERROR_UNKNOWN);
expect(request.ERROR_UNKNOWN).assertEqual(8); expect(request.ERROR_UNKNOWN).assertEqual(8);
console.info("SUB_REQUEST_UPLOAD_API_0003 request.PAUSED_QUEUED_FOR_WIFI:" + request.PAUSED_QUEUED_FOR_WIFI); console.info("====>SUB_REQUEST_UPLOAD_API_0003 request.PAUSED_QUEUED_FOR_WIFI:" + request.PAUSED_QUEUED_FOR_WIFI);
expect(request.PAUSED_QUEUED_FOR_WIFI).assertEqual(0); expect(request.PAUSED_QUEUED_FOR_WIFI).assertEqual(0);
} catch (err) { } catch (err) {
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0003 error: " + err); console.error("SUB_REQUEST_UPLOAD_API_0003 error: " + err);
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0003 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0003 end-----------------------");
done(); done();
}); });
...@@ -169,21 +169,21 @@ export default function requestUploadJSUnit() { ...@@ -169,21 +169,21 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_REQUEST_UPLOAD_API_0004', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_0004', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0004 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0004 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_UNKNOWN:" + request.PAUSED_UNKNOWN); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_UNKNOWN:" + request.PAUSED_UNKNOWN);
expect(request.PAUSED_UNKNOWN).assertEqual(4); expect(request.PAUSED_UNKNOWN).assertEqual(4);
console.info("SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_WAITING_FOR_NETWORK:" + request.PAUSED_WAITING_FOR_NETWORK); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_WAITING_FOR_NETWORK:" + request.PAUSED_WAITING_FOR_NETWORK);
expect(request.PAUSED_WAITING_FOR_NETWORK).assertEqual(1); expect(request.PAUSED_WAITING_FOR_NETWORK).assertEqual(1);
console.info("SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_WAITING_TO_RETRY:" + request.PAUSED_WAITING_TO_RETRY); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_WAITING_TO_RETRY:" + request.PAUSED_WAITING_TO_RETRY);
expect(request.PAUSED_WAITING_TO_RETRY).assertEqual(2); expect(request.PAUSED_WAITING_TO_RETRY).assertEqual(2);
console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_FAILED:" + request.SESSION_FAILED); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.SESSION_FAILED:" + request.SESSION_FAILED);
expect(request.SESSION_FAILED).assertEqual(4); expect(request.SESSION_FAILED).assertEqual(4);
} catch (err) { } catch (err) {
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0004 error: " + err); console.error("SUB_REQUEST_UPLOAD_API_0004 error: " + err);
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0004 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0004 end-----------------------");
done(); done();
}); });
...@@ -196,21 +196,21 @@ export default function requestUploadJSUnit() { ...@@ -196,21 +196,21 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_REQUEST_UPLOAD_API_0005', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_0005', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0005 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_PAUSED:" + request.SESSION_PAUSED); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.SESSION_PAUSED:" + request.SESSION_PAUSED);
expect(request.SESSION_PAUSED).assertEqual(3); expect(request.SESSION_PAUSED).assertEqual(3);
console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_PENDING:" + request.SESSION_PENDING); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.SESSION_PENDING:" + request.SESSION_PENDING);
expect(request.SESSION_PENDING).assertEqual(2); expect(request.SESSION_PENDING).assertEqual(2);
console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_RUNNING:" + request.SESSION_RUNNING); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.SESSION_RUNNING:" + request.SESSION_RUNNING);
expect(request.SESSION_RUNNING).assertEqual(1); expect(request.SESSION_RUNNING).assertEqual(1);
console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_SUCCESSFUL:" + request.SESSION_SUCCESSFUL); console.info("====>SUB_REQUEST_UPLOAD_API_0004 request.SESSION_SUCCESSFUL:" + request.SESSION_SUCCESSFUL);
expect(request.SESSION_SUCCESSFUL).assertEqual(0); expect(request.SESSION_SUCCESSFUL).assertEqual(0);
} catch (err) { } catch (err) {
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0005 error: " + err); console.error("SUB_REQUEST_UPLOAD_API_0005 error: " + err);
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------");
done(); done();
}); });
...@@ -223,31 +223,31 @@ export default function requestUploadJSUnit() { ...@@ -223,31 +223,31 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_REQUEST_UPLOAD_API_0006', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_0006', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0006 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0006 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_PERMISSION:" + request.EXCEPTION_PERMISSION); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_PERMISSION:" + request.EXCEPTION_PERMISSION);
expect(request.EXCEPTION_PERMISSION).assertEqual(201); expect(request.EXCEPTION_PERMISSION).assertEqual(201);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_PARAMCHECK:" + request.EXCEPTION_PARAMCHECK); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_PARAMCHECK:" + request.EXCEPTION_PARAMCHECK);
expect(request.EXCEPTION_PARAMCHECK).assertEqual(401); expect(request.EXCEPTION_PARAMCHECK).assertEqual(401);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_UNSUPPORTED:" + request.EXCEPTION_UNSUPPORTED); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_UNSUPPORTED:" + request.EXCEPTION_UNSUPPORTED);
expect(request.EXCEPTION_UNSUPPORTED).assertEqual(801); expect(request.EXCEPTION_UNSUPPORTED).assertEqual(801);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_FILEIO:" + request.EXCEPTION_FILEIO); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_FILEIO:" + request.EXCEPTION_FILEIO);
expect(request.EXCEPTION_FILEIO).assertEqual(13400001); expect(request.EXCEPTION_FILEIO).assertEqual(13400001);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_FILEPATH:" + request.EXCEPTION_FILEPATH); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_FILEPATH:" + request.EXCEPTION_FILEPATH);
expect(request.EXCEPTION_FILEPATH).assertEqual(13400002); expect(request.EXCEPTION_FILEPATH).assertEqual(13400002);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_SERVICE:" + request.EXCEPTION_SERVICE); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_SERVICE:" + request.EXCEPTION_SERVICE);
expect(request.EXCEPTION_SERVICE).assertEqual(13400003); expect(request.EXCEPTION_SERVICE).assertEqual(13400003);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_OTHERS:" + request.EXCEPTION_OTHERS); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_OTHERS:" + request.EXCEPTION_OTHERS);
expect(request.EXCEPTION_OTHERS).assertEqual(13499999); expect(request.EXCEPTION_OTHERS).assertEqual(13499999);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.ERROR_OFFLINE:" + request.ERROR_OFFLINE); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.ERROR_OFFLINE:" + request.ERROR_OFFLINE);
expect(request.ERROR_OFFLINE).assertEqual(9); expect(request.ERROR_OFFLINE).assertEqual(9);
console.info("SUB_REQUEST_UPLOAD_API_0006 request.ERROR_UNSUPPORTED_NETWORK_TYPE:" + request.ERROR_UNSUPPORTED_NETWORK_TYPE); console.info("====>SUB_REQUEST_UPLOAD_API_0006 request.ERROR_UNSUPPORTED_NETWORK_TYPE:" + request.ERROR_UNSUPPORTED_NETWORK_TYPE);
expect(request.ERROR_UNSUPPORTED_NETWORK_TYPE).assertEqual(10); expect(request.ERROR_UNSUPPORTED_NETWORK_TYPE).assertEqual(10);
} catch (err) { } catch (err) {
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0006 error: " + err); console.error("SUB_REQUEST_UPLOAD_API_0006 error: " + err);
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_0006 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0006 end-----------------------");
done(); done();
}); });
...@@ -260,26 +260,26 @@ export default function requestUploadJSUnit() { ...@@ -260,26 +260,26 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_REQUEST_UPLOAD_API_CALLBACK_0001', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig)); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig, (data) => { request.upload(uploadConfig, (data) => {
uploadTask = data; uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask)); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
expect(uploadTask != undefined).assertEqual(true); expect(uploadTask != undefined).assertEqual(true);
uploadTask.on('progress', function (data1, data2) { uploadTask.on('progress', function (data1, data2) {
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1);
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2);
}); });
uploadTask.off('progress', function (data1, data2) { uploadTask.off('progress', function (data1, data2) {
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1);
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data2 =" + data2); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data2 =" + data2);
}); });
uploadTask.remove((err, data) => { uploadTask.remove((err, data) => {
console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data);
}); });
}); });
} catch (err) { } catch (err) {
...@@ -287,7 +287,7 @@ export default function requestUploadJSUnit() { ...@@ -287,7 +287,7 @@ export default function requestUploadJSUnit() {
expect().assertFail(); expect().assertFail();
} }
sleep(Date.now(), 20000); sleep(Date.now(), 20000);
console.info("-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 end-----------------------");
done(); done();
}); });
...@@ -300,26 +300,26 @@ export default function requestUploadJSUnit() { ...@@ -300,26 +300,26 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------");
try { try {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig)); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig).then((data) => { request.upload(uploadConfig).then((data) => {
uploadTask = data; uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {})); expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.on('headerReceive', (header) => { uploadTask.on('headerReceive', (header) => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); expect(true).assertEqual((header != undefined) || (header != "") || (header != {}));
}); });
uploadTask.off('headerReceive', (header) => { uploadTask.off('headerReceive', (header) => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); expect(true).assertEqual((header != undefined) || (header != "") || (header != {}));
}); });
uploadTask.remove().then((result)=>{ uploadTask.remove().then((result)=>{
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result);
expect(result).assertEqual(true); expect(result).assertEqual(true);
}); });
}); });
...@@ -328,90 +328,11 @@ export default function requestUploadJSUnit() { ...@@ -328,90 +328,11 @@ export default function requestUploadJSUnit() {
expect(true).assertFail(true); expect(true).assertFail(true);
} }
sleep(Date.now(), 20000); sleep(Date.now(), 20000);
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
done(); done();
}); });
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0002
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Called when the current upload session complete or fail.
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0002 is starting-----------------------");
try {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig).then((data) => {
uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.on('complete', (TaskState) => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.path = " + TaskState.path);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.responseCode" + TaskState.responseCode);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.TaskState.message" + TaskState.message);
expect(typeof(TaskState.path) == "string").assertEqual(true);
expect(typeof(TaskState.responseCode) == "number").assertEqual(true);
expect(typeof(TaskState.message) == "string").assertEqual(true);
});
uploadTask.on('fail', (TaskState) => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.path = " + TaskState.path);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.responseCode" + TaskState.responseCode);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.TaskState.message" + TaskState.message);
expect(typeof(TaskState.path) == "string").assertEqual(true);
expect(typeof(TaskState.responseCode) == "number").assertEqual(true);
expect(typeof(TaskState.message) == "string").assertEqual(true);
expect(true).assertEqual(true);
});
});
} catch (e) {
console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e));
expect(true).assertFail(true);
}
sleep(Date.now(), 20000);
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
done();
});
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0003
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Called when the current upload session complete or fail.
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0003', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 is starting-----------------------");
try {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig).then((data) => {
uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.off('complete', () => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
});
uploadTask.off('fail', () => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
});
});
} catch (e) {
console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0003 error: " + JSON.stringify(e));
expect(true).assertFail(true);
}
sleep(Date.now(), 20000);
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 end-----------------------");
done();
});
/** /**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0001 * @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0001
...@@ -421,18 +342,18 @@ export default function requestUploadJSUnit() { ...@@ -421,18 +342,18 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------");
try { try {
request.upload(uploadConfig, (data) => { request.upload(uploadConfig, (data) => {
uploadTask = data; uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask); console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true); expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete((err, data) => { uploadTask.delete((err, data) => {
if (err) { if (err) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 Failed to delete the uploadTask task.'); console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 Failed to delete the uploadTask task.');
expect().assertFail(); expect().assertFail();
} }
console.info('SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask task delete success.'); console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask task delete success.');
expect(typeof data == "boolean").assertTrue(); expect(typeof data == "boolean").assertTrue();
}); });
}) })
...@@ -440,7 +361,7 @@ export default function requestUploadJSUnit() { ...@@ -440,7 +361,7 @@ export default function requestUploadJSUnit() {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 delete catch error' + error); console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 delete catch error' + error);
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 end-----------------------");
done(); done();
}); });
...@@ -452,17 +373,17 @@ export default function requestUploadJSUnit() { ...@@ -452,17 +373,17 @@ export default function requestUploadJSUnit() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------");
try { try {
request.upload(uploadConfig, (data) => { request.upload(uploadConfig, (data) => {
uploadTask = data; uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask); console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true); expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete().then(data => { uploadTask.delete().then(data => {
console.info('SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask task delete success.'); console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask task delete success.');
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info('SUB_REQUEST_UPLOAD_API_DELETE_0002 Failed to delete the uploadTask task.'); console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 Failed to delete the uploadTask task.');
expect().assertFail(); expect().assertFail();
}) })
}) })
...@@ -470,7 +391,7 @@ export default function requestUploadJSUnit() { ...@@ -470,7 +391,7 @@ export default function requestUploadJSUnit() {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0002 delete catch error'); console.error('SUB_REQUEST_UPLOAD_API_DELETE_0002 delete catch error');
expect().assertFail(); expect().assertFail();
} }
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 end-----------------------");
done(); done();
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册