diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets index 9962f797495d7d9da8140c8a46404aa8b18fa071..98a7b39924e66025df7429082a3a844ed9599075 100644 --- a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets @@ -40,7 +40,7 @@ export default function inputMethodStageJSUnit() { }catch(error){ console.info("inputMethod_test_getController_001 getController error" + JSON.stringify(error)); expect().assertFail(); - } + }; console.info("-----------------inputMethod_test_getController_001 end---------------------"); done(); @@ -82,7 +82,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listInputMethodSubtype_001 listInputMethodSubtype catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_listInputMethodSubtype_001 end---------------------"); }); @@ -103,7 +103,7 @@ export default function inputMethodStageJSUnit() { icon: "", iconId: 124, extra:{} - } + }; try{ let inputMethodSetting = inputMethod.getSetting(); @@ -113,7 +113,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listInputMethodSubtype_002 failed" + JSON.stringify(err)); expect().assertFail(); done() - } + }; console.info("inputMethod_test_listInputMethodSubtype_002 listInputMethodSubtype:" + JSON.stringify(data)); if(data.length >= 1){ let inputMethodSubtype = data[0] @@ -125,13 +125,13 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listInputMethodSubtype_002 listInputMethodSubtype length less 1"); expect().assertFail(); done(); - } + }; }); }catch(error){ console.info("inputMethod_test_listInputMethodSubtype_002 listInputMethodSubtype catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_listInputMethodSubtype_002 end---------------------"); }); @@ -170,7 +170,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listInputMethodSubtype_003 listInputMethodSubtype catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_listInputMethodSubtype_003 end---------------------"); }); @@ -191,7 +191,7 @@ export default function inputMethodStageJSUnit() { icon: "", iconId: 124, extra:{} - } + }; try{ let inputMethodSetting = inputMethod.getSetting(); @@ -212,7 +212,7 @@ export default function inputMethodStageJSUnit() { }).catch(err => { console.info("inputMethod_test_listInputMethodSubtype_004 failed" + JSON.stringify(err)); expect().assertFail(); - done() + done(); }); }catch(error){ console.info("inputMethod_test_listInputMethodSubtype_004 listInputMethodSubtype catch error" + JSON.stringify(error)); @@ -238,7 +238,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listCurrentInputMethodSubtype_001 failed" + JSON.stringify(err)); expect().assertFail(); done(); - } + }; console.info("inputMethod_test_listCurrentInputMethodSubtype_001 listCurrentInputMethodSubtype: " + JSON.stringify(data)); expect(true).assertTrue(); done(); @@ -247,7 +247,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listCurrentInputMethodSubtype_001 listCurrentInputMethodSubtype catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_listCurrentInputMethodSubtype_001 end---------------------"); }); @@ -275,7 +275,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_listCurrentInputMethodSubtype_002 listCurrentInputMethodSubtype catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_listCurrentInputMethodSubtype_002 end---------------------"); }); @@ -319,7 +319,7 @@ export default function inputMethodStageJSUnit() { name:"com.example.kikakeyboard", id:"ServiceExtAbility", extra:{} - } + }; let inputMethodSubProperty : subtype = { id: "com.example.kikakeyboard", label: "ServiceExtAbility", @@ -330,7 +330,7 @@ export default function inputMethodStageJSUnit() { icon: "", iconId: 0, extra: {} - } + }; try { inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, inputMethodSubProperty, (err,data) => { if (err) { @@ -346,7 +346,7 @@ export default function inputMethodStageJSUnit() { console.error('inputMethod_test_switchCurrentInputMethodAndSubtype_001 catch error: ' + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("************* inputMethod_test_switchCurrentInputMethodAndSubtype_001 Test end*************"); }); @@ -364,7 +364,7 @@ export default function inputMethodStageJSUnit() { name:"com.example.kikakeyboard", id:"ServiceExtAbility", extra:{} - } + }; let inputMethodSubProperty : subtype = { id: "com.example.kikakeyboard", label: "ServiceExtAbility", @@ -375,7 +375,7 @@ export default function inputMethodStageJSUnit() { icon: "", iconId: 0, extra: {} - } + }; try { inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, inputMethodSubProperty).then((data) => { console.info("inputMethod_test_switchCurrentInputMethodAndSubtype_002 data: " + JSON.stringify(data)); @@ -390,7 +390,7 @@ export default function inputMethodStageJSUnit() { console.error('inputMethod_test_switchCurrentInputMethodAndSubtype_002 catch error: ' + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("************* inputMethod_test_switchCurrentInputMethodAndSubtype_002 Test end*************"); }); @@ -412,14 +412,14 @@ export default function inputMethodStageJSUnit() { icon: "", iconId: 0, extra: {} - } + }; try { inputMethod.switchCurrentInputMethodSubtype(inputMethodSubProperty, (err,data) => { if (err) { console.error('inputMethod_test_switchCurrentInputMethodSubtype_001 err: ' + JSON.stringify(err)); expect().assertFail(); done(); - } + }; console.info("inputMethod_test_switchCurrentInputMethodSubtype_001 data: " + JSON.stringify(data)); expect(data != null).assertTrue(); done(); @@ -428,7 +428,7 @@ export default function inputMethodStageJSUnit() { console.error('inputMethod_test_switchCurrentInputMethodSubtype_001 catch error: ' + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("************* inputMethod_test_switchCurrentInputMethodSubtype_001 Test end*************"); }); @@ -450,7 +450,7 @@ export default function inputMethodStageJSUnit() { icon: "", iconId: 0, extra: {} - } + }; try { inputMethod.switchCurrentInputMethodSubtype(inputMethodSubProperty).then((data) => { console.info("inputMethod_test_switchCurrentInputMethodSubtype_002 data: " + JSON.stringify(data)); @@ -465,7 +465,7 @@ export default function inputMethodStageJSUnit() { console.error('inputMethod_test_switchCurrentInputMethodSubtype_002 catch error: ' + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("************* inputMethod_test_switchCurrentInputMethodSubtype_002 Test end*************"); done(); }); @@ -486,16 +486,18 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_showOptionalInputMethods_001 showOptionalInputMethods faild: " + JSON.stringify(err)); expect().assertFail(); done(); - } + }; console.info("inputMethod_test_showOptionalInputMethods_001 showOptionalInputMethods success data is : " + data); expect(true).assertTrue(); - done(); + setTimeout(() => { + done(); + }, 1000); }); }catch(error){ console.info("inputMethod_test_showOptionalInputMethods_001 showOptionalInputMethods catch error: " + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_showOptionalInputMethods_001 end---------------------"); }); @@ -523,7 +525,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_showOptionalInputMethods_002 showOptionalInputMethods catch error: " + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_showOptionalInputMethods_002 end---------------------"); }); @@ -551,7 +553,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_stopInputSession_002 catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_stopInputSession_002 end---------------------"); }); @@ -571,7 +573,7 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_stopInputSession_001 faild: " + JSON.stringify(err)); expect().assertFail(); done(); - } + }; console.info("inputMethod_test_stopInputSession_001 stopInputSession data: " + data); expect(data == true).assertTrue(); done(); @@ -580,9 +582,164 @@ export default function inputMethodStageJSUnit() { console.info("inputMethod_test_stopInputSession_001 catch error" + JSON.stringify(error)); expect().assertFail(); done(); - } + }; console.info("-----------------inputMethod_test_stopInputSession_001 end---------------------"); }); + + /* + * @tc.number inputMethod_test_EXCEPTION_PERMISSION_001 + * @tc.name Errorcode 201. The permissions check fails. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_PERMISSION_001', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_PERMISSION; + console.info("inputMethod_test_EXCEPTION_PERMISSION_001 result:" + keyType); + expect(keyType).assertEqual(201); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_PARAMCHECK_002 + * @tc.name Errorcode 401. The parameters check fails. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_PARAMCHECK_002', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_PARAMCHECK; + console.info("inputMethod_test_EXCEPTION_PARAMCHECK_002 result:" + keyType); + expect(keyType).assertEqual(401); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_UNSUPPORTED_003 + * @tc.name Errorcode 801. Call unsupported api. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_UNSUPPORTED_003', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_UNSUPPORTED; + console.info("inputMethod_test_EXCEPTION_UNSUPPORTED_003 result:" + keyType); + expect(keyType).assertEqual(801); + done(); + }); + /* + * @tc.number inputMethod_test_EXCEPTION_PACKAGEMANAGER_004 + * @tc.name Errorcode 12800001. Package manager error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_PACKAGEMANAGER_004', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_PACKAGEMANAGER; + console.info("inputMethod_test_EXCEPTION_PACKAGEMANAGER_004 result:" + keyType); + expect(keyType).assertEqual(12800001); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_IMENGINE_005 + * @tc.name Errorcode 12800002. Input method engine error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_IMENGINE_005', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_IMENGINE; + console.info("inputMethod_test_EXCEPTION_IMENGINE_005 result:" + keyType); + expect(keyType).assertEqual(12800002); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_IMCLIENT_006 + * @tc.name Errorcode 12800003. Input method client error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_IMCLIENT_006', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_IMCLIENT; + console.info("inputMethod_test_EXCEPTION_IMCLIENT_006 result:" + keyType); + expect(keyType).assertEqual(12800003); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_KEYEVENT_007 + * @tc.name Errorcode 12800004. Key event processing error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_KEYEVENT_007', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_KEYEVENT; + console.info("inputMethod_test_EXCEPTION_KEYEVENT_007 result:" + keyType); + expect(keyType).assertEqual(12800004); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_CONFPERSIST_008 + * @tc.name Errorcode 12800005. Configuration persisting error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_CONFPERSIST_008', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_CONFPERSIST; + console.info("inputMethod_test_EXCEPTION_CONFPERSIST_008 result:" + keyType); + expect(keyType).assertEqual(12800005); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_CONTROLLER_009 + * @tc.name Errorcode 12800006. Input method controller error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_CONTROLLER_009', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_CONTROLLER; + console.info("inputMethod_test_EXCEPTION_CONTROLLER_009 result:" + keyType); + expect(keyType).assertEqual(12800006); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_SETTINGS_010 + * @tc.name Errorcode 12800007. Input method settings extension error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_SETTINGS_010', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_SETTINGS; + console.info("inputMethod_test_EXCEPTION_SETTINGS_010 result:" + keyType); + expect(keyType).assertEqual(12800007); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_IMMS_011 + * @tc.name Errorcode 12800008. Input method manager service error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_IMMS_011', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_IMMS; + console.info("inputMethod_test_EXCEPTION_IMMS_011 result:" + keyType); + expect(keyType).assertEqual(12800008); + done(); + }); + + /* + * @tc.number inputMethod_test_EXCEPTION_OTHERS_012 + * @tc.name Errorcode 12899999. Others error. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputMethod_test_EXCEPTION_OTHERS_012', 0, async function (done) { + let keyType = inputMethod.EXCEPTION_OTHERS; + console.info("inputMethod_test_EXCEPTION_OTHERS_012 result:" + keyType); + expect(keyType).assertEqual(12899999); + done(); + }); }); }; diff --git a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets index 7ea249536b5f9ff269111b390023d06113d04388..804a98e002c099022e11d73c090e40a7cd4dd96a 100644 --- a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets +++ b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets @@ -213,6 +213,43 @@ export default function requestUploadJSUnit() { console.info("-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------"); done(); }); + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_0006 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_REQUEST_UPLOAD_API_0006', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0006 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_PERMISSION:" + request.EXCEPTION_PERMISSION); + expect(request.EXCEPTION_PERMISSION).assertEqual(201); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_PARAMCHECK:" + request.EXCEPTION_PARAMCHECK); + expect(request.EXCEPTION_PARAMCHECK).assertEqual(401); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_UNSUPPORTED:" + request.EXCEPTION_UNSUPPORTED); + expect(request.EXCEPTION_UNSUPPORTED).assertEqual(801); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_FILEIO:" + request.EXCEPTION_FILEIO); + expect(request.EXCEPTION_FILEIO).assertEqual(13400001); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_FILEPATH:" + request.EXCEPTION_FILEPATH); + expect(request.EXCEPTION_FILEPATH).assertEqual(13400002); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_SERVICE:" + request.EXCEPTION_SERVICE); + expect(request.EXCEPTION_SERVICE).assertEqual(13400003); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.EXCEPTION_OTHERS:" + request.EXCEPTION_OTHERS); + expect(request.EXCEPTION_OTHERS).assertEqual(13499999); + console.info("SUB_REQUEST_UPLOAD_API_0006 request.ERROR_OFFLINE:" + request.ERROR_OFFLINE); + expect(request.ERROR_OFFLINE).assertEqual(9); + 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); + } catch (err) { + expect(true).assertEqual(true); + console.error("SUB_REQUEST_UPLOAD_API_0006 error: " + err); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0006 end-----------------------"); + done(); + }); /** * @tc.number SUB_REQUEST_UPLOAD_API_CALLBACK_0001