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

!9222 【杂散】【上传下载】requestAP10场景用例覆盖

Merge pull request !9222 from 张育帅/master
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"power-shell wakeup", "power-shell wakeup",
"power-shell setmode 602", "power-shell setmode 602",
"uinput -T -m 300 720 300 360 200", "uinput -T -m 300 720 300 360 200",
"uinput -T -m 650 2760 650 1380 200" "uinput -T -m 650 2760 650 1380 200",
"pidof download_server | xargs kill -9"
] ]
}, },
{ {
......
...@@ -14,9 +14,16 @@ ...@@ -14,9 +14,16 @@
*/ */
import requestUploadJSUnit from './requestUpload.test'; import requestUploadJSUnit from './requestUpload.test';
import requestUploadOneJSUnit from './requestUpload001.test';
import requestDownloadJSUnit from './requestDownload.test'; import requestDownloadJSUnit from './requestDownload.test';
import requestDownloadOneJSUnit from './requestDownload001.test';
import requestDownloadTwoJSUnit from './requestDownload002.test';
export default function testsuite() { export default function testsuite() {
requestDownloadJSUnit() requestDownloadJSUnit();
requestUploadJSUnit() requestDownloadOneJSUnit();
requestDownloadTwoJSUnit();
requestUploadJSUnit();
requestUploadOneJSUnit();
} }
\ No newline at end of file
...@@ -58,7 +58,7 @@ export default function requestUploadJSUnit() { ...@@ -58,7 +58,7 @@ export default function requestUploadJSUnit() {
} }
}]; }];
let conf = { let config = {
action: request.agent.Action.UPLOAD, action: request.agent.Action.UPLOAD,
url: 'http://127.0.0.1', url: 'http://127.0.0.1',
title: 'uploadTest', title: 'uploadTest',
...@@ -84,6 +84,7 @@ export default function requestUploadJSUnit() { ...@@ -84,6 +84,7 @@ export default function requestUploadJSUnit() {
let sleep = function (timeout) { let sleep = function (timeout) {
return new Promise(resolve => { return new Promise(resolve => {
const st = setTimeout(() => { const st = setTimeout(() => {
clearTimeout(st);
resolve(null); resolve(null);
}, timeout); }, timeout);
}); });
...@@ -98,7 +99,7 @@ export default function requestUploadJSUnit() { ...@@ -98,7 +99,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Create_Upload_Callback_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Create_Upload_Callback_0010', 0, async function (done) {
console.info("-----------------------SUB_Misc_REQUEST_Create_Upload_Callback_0010 is starting-----------------------"); console.info("-----------------------SUB_Misc_REQUEST_Create_Upload_Callback_0010 is starting-----------------------");
request.agent.create(globalThis.abilityContext, conf, async (err, task)=>{ request.agent.create(globalThis.abilityContext, config, async (err, task)=>{
console.info("====>SUB_Misc_REQUEST_Create_Upload_Callback_0010 uploadTask: " + task); console.info("====>SUB_Misc_REQUEST_Create_Upload_Callback_0010 uploadTask: " + task);
try{ try{
if(err){ if(err){
...@@ -127,7 +128,7 @@ export default function requestUploadJSUnit() { ...@@ -127,7 +128,7 @@ export default function requestUploadJSUnit() {
it('SUB_Misc_REQUEST_Create_Upload_Promise_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Create_Upload_Promise_0010', 0, async function (done) {
console.info("-----------------------SUB_Misc_REQUEST_Create_Upload_Promise_0010 is starting-----------------------"); console.info("-----------------------SUB_Misc_REQUEST_Create_Upload_Promise_0010 is starting-----------------------");
try { try {
var task = await request.agent.create(globalThis.abilityContext, conf); var task = await request.agent.create(globalThis.abilityContext, config);
expect(task !== undefined).assertEqual(true); expect(task !== undefined).assertEqual(true);
await request.agent.remove(task.tid); await request.agent.remove(task.tid);
console.info("====>SUB_Misc_REQUEST_Create_Upload_Promise_0010 create success: " + task); console.info("====>SUB_Misc_REQUEST_Create_Upload_Promise_0010 create success: " + task);
...@@ -150,7 +151,7 @@ export default function requestUploadJSUnit() { ...@@ -150,7 +151,7 @@ export default function requestUploadJSUnit() {
it('SUB_Misc_REQUEST_Remove_Upload_Callback_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Remove_Upload_Callback_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Remove_Upload_Callback_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Remove_Upload_Callback_0010 is starting-----------------------");
try { try {
let task = await request.agent.create(globalThis.abilityContext, conf); let task = await request.agent.create(globalThis.abilityContext, config);
request.agent.remove(task.tid, err => { request.agent.remove(task.tid, err => {
try { try {
if(err){ if(err){
...@@ -181,7 +182,7 @@ export default function requestUploadJSUnit() { ...@@ -181,7 +182,7 @@ export default function requestUploadJSUnit() {
it('SUB_Misc_REQUEST_Remove_Upload_Promise_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Remove_Upload_Promise_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Remove_Upload_Promise_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Remove_Upload_Promise_0010 is starting-----------------------");
try { try {
let task = await request.agent.create(globalThis.abilityContext, conf); let task = await request.agent.create(globalThis.abilityContext, config);
await request.agent.remove(task.tid); await request.agent.remove(task.tid);
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.info("====>SUB_Misc_REQUEST_Remove_Upload_Promise_0010 remove success: " + task); console.info("====>SUB_Misc_REQUEST_Remove_Upload_Promise_0010 remove success: " + task);
...@@ -202,7 +203,7 @@ export default function requestUploadJSUnit() { ...@@ -202,7 +203,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Start_Upload_Callback_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Start_Upload_Callback_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Start_Upload_Callback_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Start_Upload_Callback_0010 is starting-----------------------");
request.agent.create(globalThis.abilityContext, conf, async (err, task)=>{ request.agent.create(globalThis.abilityContext, config, async (err, task)=>{
console.info("====>SUB_Misc_REQUEST_Start_Upload_Callback_0010 uploadTask: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Start_Upload_Callback_0010 uploadTask: " + JSON.stringify(task));
task.start(async err => { task.start(async err => {
try{ try{
...@@ -232,7 +233,7 @@ export default function requestUploadJSUnit() { ...@@ -232,7 +233,7 @@ export default function requestUploadJSUnit() {
it('SUB_Misc_REQUEST_Start_Upload_Promise_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Start_Upload_Promise_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Start_Upload_Promise_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Start_Upload_Promise_0010 is starting-----------------------");
try { try {
var task = await request.agent.create(globalThis.abilityContext, conf); var task = await request.agent.create(globalThis.abilityContext, config);
await task.start(); await task.start();
expect(true).assertEqual(true); expect(true).assertEqual(true);
console.info("====>SUB_Misc_REQUEST_Start_Upload_Promise_0010 upload start success: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Start_Upload_Promise_0010 upload start success: " + JSON.stringify(task));
...@@ -254,7 +255,7 @@ export default function requestUploadJSUnit() { ...@@ -254,7 +255,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Pause_Upload_Callback_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Pause_Upload_Callback_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Pause_Upload_Callback_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Pause_Upload_Callback_0010 is starting-----------------------");
request.agent.create(globalThis.abilityContext, conf, async (err, task)=>{ request.agent.create(globalThis.abilityContext, config, async (err, task)=>{
console.info("====>SUB_Misc_REQUEST_Pause_Upload_Callback_0010 uploadTask: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Pause_Upload_Callback_0010 uploadTask: " + JSON.stringify(task));
task.start(err => { task.start(err => {
console.info("====>SUB_Misc_REQUEST_Pause_Upload_Callback_0010 upload start: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Pause_Upload_Callback_0010 upload start: " + JSON.stringify(err));
...@@ -286,7 +287,7 @@ export default function requestUploadJSUnit() { ...@@ -286,7 +287,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Pause_Upload_Promise_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Pause_Upload_Promise_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Pause_Upload_Promise_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Pause_Upload_Promise_0010 is starting-----------------------");
let task = await request.agent.create(globalThis.abilityContext, conf); let task = await request.agent.create(globalThis.abilityContext, config);
console.info("====>SUB_Misc_REQUEST_Pause_Upload_Promise_0010 create task: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Pause_Upload_Promise_0010 create task: " + JSON.stringify(task));
task.start(async err => { task.start(async err => {
try { try {
...@@ -314,7 +315,7 @@ export default function requestUploadJSUnit() { ...@@ -314,7 +315,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Resume_Upload_Callback_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Resume_Upload_Callback_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Resume_Upload_Callback_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Resume_Upload_Callback_0010 is starting-----------------------");
request.agent.create(globalThis.abilityContext, conf, async (err, task)=>{ request.agent.create(globalThis.abilityContext, config, async (err, task)=>{
console.info("====>SUB_Misc_REQUEST_Resume_Upload_Callback_0010 uploadTask: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Resume_Upload_Callback_0010 uploadTask: " + JSON.stringify(task));
task.start(err => { task.start(err => {
console.info("====>SUB_Misc_REQUEST_Resume_Upload_Callback_0010 start: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Resume_Upload_Callback_0010 start: " + JSON.stringify(err));
...@@ -349,7 +350,7 @@ export default function requestUploadJSUnit() { ...@@ -349,7 +350,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Resume_Upload_Promise_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Resume_Upload_Promise_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Resume_Upload_Promise_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Resume_Upload_Promise_0010 is starting-----------------------");
let task = await request.agent.create(globalThis.abilityContext, conf); let task = await request.agent.create(globalThis.abilityContext, config);
console.info("====>SUB_Misc_REQUEST_Resume_Upload_Promise_0010 create task: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Resume_Upload_Promise_0010 create task: " + JSON.stringify(task));
task.start(err => { task.start(err => {
console.info("====>SUB_Misc_REQUEST_Resume_Upload_Promise_0010 start: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Resume_Upload_Promise_0010 start: " + JSON.stringify(err));
...@@ -380,7 +381,7 @@ export default function requestUploadJSUnit() { ...@@ -380,7 +381,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Stop_Upload_Callback_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Stop_Upload_Callback_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Stop_Upload_Callback_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Stop_Upload_Callback_0010 is starting-----------------------");
request.agent.create(globalThis.abilityContext, conf, async (err, task)=>{ request.agent.create(globalThis.abilityContext, config, async (err, task)=>{
console.info("====>SUB_Misc_REQUEST_Stop_Upload_Callback_0010 uploadTask: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Stop_Upload_Callback_0010 uploadTask: " + JSON.stringify(task));
task.start(err => { task.start(err => {
console.info("====>SUB_Misc_REQUEST_Stop_Upload_Callback_0010 start: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Stop_Upload_Callback_0010 start: " + JSON.stringify(err));
...@@ -412,7 +413,7 @@ export default function requestUploadJSUnit() { ...@@ -412,7 +413,7 @@ export default function requestUploadJSUnit() {
*/ */
it('SUB_Misc_REQUEST_Stop_Upload_Promise_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Stop_Upload_Promise_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Stop_Upload_Promise_0010 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Stop_Upload_Promise_0010 is starting-----------------------");
let task = await request.agent.create(globalThis.abilityContext, conf); let task = await request.agent.create(globalThis.abilityContext, config);
console.info("====>SUB_Misc_REQUEST_Stop_Upload_Promise_0010 create task: " + JSON.stringify(task)); console.info("====>SUB_Misc_REQUEST_Stop_Upload_Promise_0010 create task: " + JSON.stringify(task));
task.start(async err => { task.start(async err => {
console.info("====>SUB_Misc_REQUEST_Stop_Upload_Promise_0010 start: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Stop_Upload_Promise_0010 start: " + JSON.stringify(err));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册