From d892eee443d397f5a40f46ef4a1840997064e256 Mon Sep 17 00:00:00 2001 From: lixiaofeng_154b Date: Wed, 6 Jul 2022 17:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90xts=5Facts=E3=80=91=E3=80=90OpenHarmon?= =?UTF-8?q?y-3.1-Release=E3=80=91=E5=8F=82=E6=95=B0target=E8=A6=86?= =?UTF-8?q?=E7=9B=96=EF=BC=8C=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixiaofeng_154b Change-Id: Ic5cc0928b4999f61c7a3f8c81a74e2ac362c1438 --- .../src/main/js/default/test/ListUsb.test.js | 17 +++++----- .../default/test/UsbDevicePipeJsunit.test.js | 32 ++++++++++--------- .../test/UsbDevicePipeJsunit_A.test.js | 16 +++++----- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/usb/usb_standard/src/main/js/default/test/ListUsb.test.js b/usb/usb_standard/src/main/js/default/test/ListUsb.test.js index 140438ea3..1f06b0760 100755 --- a/usb/usb_standard/src/main/js/default/test/ListUsb.test.js +++ b/usb/usb_standard/src/main/js/default/test/ListUsb.test.js @@ -15,17 +15,18 @@ /* host test case */ -//require('./UsbCoreJsunit.test.js') -//require('./UsbCoreJsunitEx.test.js') -//require('./UsbDevicePipeJsunit.test.js') -//require('./UsbDevicePipeJsunitEx.test.js') +// require('./UsbCoreJsunit.test.js') +// require('./UsbCoreJsunitEx.test.js') +// require('./UsbDevicePipeJsunit.test.js') +// require('./UsbDevicePipeJsunitEx.test.js') +// require('./UsbDevicePipeJsunit_A.test.js') /* device test case */ -//require('./UsbFunctionsJsunit.test.js') -//require('./UsbFunctionsJsunitEx.test.js') +// require('./UsbFunctionsJsunit.test.js') +// require('./UsbFunctionsJsunitEx.test.js') /* device and host test case */ -//require('./UsbPortJsunit.test.js') -//require('./UsbPortJsunitEx.test.js') +// require('./UsbPortJsunit.test.js') +// require('./UsbPortJsunitEx.test.js') require('./UsbAutoJsunit.test.js') diff --git a/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js b/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js index 201fb865b..88a16860a 100755 --- a/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js +++ b/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js @@ -236,14 +236,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () { expect(true).assertTrue(); }) - function getTransferParam(iCmd, iReqType, iValue, iIndex) { + function getTransferParam(iCmd, iReqTarType, iReqType, iValue, iIndex) { var tmpUint8Array = new Uint8Array(512); var requestCmd = iCmd + var requestTargetType = iReqTarType var requestType = iReqType var value = iValue; var index = iIndex; var controlParam = { request: requestCmd, + target: requestTargetType, reqType: requestType, value: value, index: index, @@ -383,7 +385,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(6, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_01 GetDescriptor') }) @@ -402,7 +404,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(0, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_02 GetStatus') }) @@ -421,7 +423,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(8, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_03 GetConfiguration') }) @@ -429,7 +431,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_04 * @tc.name : controlTransfer - * @tc.desc : 控制传输 GetInterface: cmd 10 reqType 129 value 0 index 1 + * @tc.desc : 控制传输 GetInterface: cmd 8 reqType 129 value 0 index 1 */ it('SUB_USB_control_transfer_test_04', 0, function () { console.info('usb control_transfer_test_04 begin'); @@ -440,7 +442,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(10, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_04 GetInterface') }) @@ -459,7 +461,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(1, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_05 ClearFeature') }) @@ -467,7 +469,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_06 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 129 value 512 index 0 */ it('SUB_USB_control_transfer_test_06', 0, function () { console.info('usb control_transfer_test_06 begin'); @@ -478,7 +480,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_06 ClearFeature') }) @@ -486,7 +488,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_07 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 3 value 512 index 0 */ it('SUB_USB_control_transfer_test_07', 0, function () { console.info('usb control_transfer_test_07 begin'); @@ -497,7 +499,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_ENDPOINT, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_07 ClearFeature') }) @@ -505,7 +507,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_08 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 5 value 512 index 0 */ it('SUB_USB_control_transfer_test_08', 0, function () { console.info('usb control_transfer_test_08 begin'); @@ -516,7 +518,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_08 ClearFeature') }) @@ -524,7 +526,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_09 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 4 value 0 index 0 */ it('SUB_USB_control_transfer_test_09', 0, function () { console.info('usb control_transfer_test_09 begin'); @@ -535,7 +537,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_09 ClearFeature') }) diff --git a/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js b/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js index ea38bacb6..00b50d630 100644 --- a/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js +++ b/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js @@ -20,12 +20,12 @@ import parameter from '@ohos.systemparameter'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' /* usb device pipe test */ -describe('UsbDevicePipeJsFunctionsTest', function () { +describe('UsbDevicePipeJsFunctionsTestA', function () { var gDeviceList var gPipe beforeAll(function () { - console.log('*************Usb Unit UsbDevicePipeJsFunctionsTest Begin*************'); + console.log('*************Usb Unit UsbDevicePipeJsFunctionsTestA Begin*************'); var Version = usb.getVersion() console.info('usb unit begin test getversion :' + Version) // version > 17 host currentMode = 2 device currentMode = 1 @@ -59,7 +59,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { afterAll(function () { var isPipClose = usb.closePipe(gPipe) console.info('usb unit close gPipe ret : ' + isPipClose); - console.log('*************Usb Unit UsbDevicePipeJsFunctionsTest End*************'); + console.log('*************Usb Unit UsbDevicePipeJsFunctionsTestA End*************'); }) function findInitPoint(testParam, j) { @@ -445,7 +445,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_04 * @tc.name : controlTransfer - * @tc.desc : 控制传输 GetInterface: cmd 10 reqType 129 value 0 index 1 + * @tc.desc : 控制传输 GetInterface: cmd 8 reqType 129 value 0 index 1 */ it('SUB_USB_control_transfer_test_04', 0, function () { console.info('usb control_transfer_test_04 begin'); @@ -483,7 +483,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_06 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 129 value 512 index 0 */ it('SUB_USB_control_transfer_test_06', 0, function () { console.info('usb control_transfer_test_06 begin'); @@ -502,7 +502,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_07 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 3 value 512 index 0 */ it('SUB_USB_control_transfer_test_07', 0, function () { console.info('usb control_transfer_test_07 begin'); @@ -521,7 +521,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_08 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 5 value 512 index 0 */ it('SUB_USB_control_transfer_test_08', 0, function () { console.info('usb control_transfer_test_08 begin'); @@ -540,7 +540,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_control_transfer_test_09 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 4 value 0 index 0 */ it('SUB_USB_control_transfer_test_09', 0, function () { console.info('usb control_transfer_test_09 begin'); -- GitLab