diff --git a/usb/usb_standard/BUILD.gn b/usb/usb_standard/BUILD.gn index 94a648949c4a191e320848b10bd04af5fe4ca637..3504dfa6e337e882ec37742c48176695abf57aec 100644 --- a/usb/usb_standard/BUILD.gn +++ b/usb/usb_standard/BUILD.gn @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -21,6 +21,8 @@ ohos_js_hap_suite("usb_js_test") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsUsbJSApiTest" + subsystem_name = "usb" + part_name = "usb_manager" } ohos_js_assets("usb_js_assets") { js2abc = true diff --git a/usb/usb_standard/src/main/js/test/List.test.js b/usb/usb_standard/src/main/js/test/List.test.js index 06e5026b78304558e84f05d928ce7a89ae37487e..a2bab8571ca492dc39e825e56e83b0cc79d0d2d0 100644 --- a/usb/usb_standard/src/main/js/test/List.test.js +++ b/usb/usb_standard/src/main/js/test/List.test.js @@ -19,6 +19,7 @@ import UsbPortJsFunctionsTestEx from './UsbPortJsunitEx.test.js' import UsbFunctionsJsFunctionsTestEx from './UsbFunctionsJsunitEx.test.js' import UsbFunctionsJsFunctionsTest from './UsbFunctionsJsunit.test.js' import UsbDevicePipeJsFunctionsTest from './UsbDevicePipeJsunit.test.js' +import UsbDevicePipeJsFunctionsTestA from './UsbDevicePipeJsunit_A.test.js' import UsbDevicePipeJsFunctionsTestEx from './UsbDevicePipeJsunitEx.test.js' import UsbCoreJsFunctionsTest from './UsbCoreJsunit.test.js' import UsbCoreJsFunctionsTestEx from './UsbCoreJsunitEx.test.js' @@ -28,6 +29,7 @@ UsbAutoJsunit() UsbCoreJsFunctionsTest() UsbCoreJsFunctionsTestEx() UsbDevicePipeJsFunctionsTest() +UsbDevicePipeJsFunctionsTestA() UsbDevicePipeJsFunctionsTestEx() UsbFunctionsJsFunctionsTest() UsbFunctionsJsFunctionsTestEx() diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js index eac2f59f5cc9cd50e94a7841432fa43e59ba4fb6..c5e9776e87e29e7b7c566bbb623636e616f95076 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js @@ -20,14 +20,14 @@ import parameter from '@ohos.systemparameter'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' /* usb device pipe test */ -export default function UsbDevicePipeJsFunctionsTest() { -describe('UsbDevicePipeJsFunctionsTest', function () { +export default function UsbDevicePipeJsFunctionsTestA() { +describe('UsbDevicePipeJsFunctionsTestA', function () { var gDeviceList var gPipe var portCurrentMode 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 @@ -151,6 +151,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0630', 0, function () { console.info('usb SUB_USB_JS_0630 begin'); + console.info('usb SUB_USB_JS_0630 portcurrentMode ret : ' + portCurrentMode) + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.interface == null || testParam.inEndpoint == null) { expect(false).assertTrue(); @@ -180,6 +186,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0640', 0, function () { console.info('usb SUB_USB_JS_0640 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -217,6 +228,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0420', 0, function () { console.info('usb SUB_USB_JS_0420 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } if (gDeviceList.length == 0) { console.info('usb 01 case get_device_list is null') expect(gDeviceList.length).assertEqual(-1); @@ -278,6 +294,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0740', 0, function () { console.info('usb SUB_USB_JS_0740 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } if (gDeviceList.length == 0) { console.info('usb case get_device_list is null') expect(false).assertTrue(); @@ -308,6 +329,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0750', 0, function () { console.info('usb SUB_USB_JS_0750 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } if (gDeviceList.length == 0) { console.info('usb case get_device_list is null') expect(false).assertTrue(); @@ -332,6 +358,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0800', 0, function () { console.info('usb SUB_USB_JS_0800 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } if (gDeviceList.length == 0) { console.info('usb case get_device_list is null') expect(false).assertTrue(); @@ -359,6 +390,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0810', 0, function () { console.info('usb SUB_USB_JS_0810 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } if (gDeviceList.length == 0) { console.info('usb case get_device_list is null') expect(false).assertTrue() @@ -401,6 +437,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0540', 0, function () { console.info('usb SUB_USB_JS_0540 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -420,6 +461,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0550', 0, function () { console.info('usb SUB_USB_JS_0550 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -439,6 +485,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0560', 0, function () { console.info('usb SUB_USB_JS_0560 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -458,6 +509,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0570', 0, function () { console.info('usb SUB_USB_JS_0570 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -477,6 +533,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0580', 0, function () { console.info('usb SUB_USB_JS_0580 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -496,6 +557,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0590', 0, function () { console.info('usb SUB_USB_JS_0590 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -515,6 +581,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0600', 0, function () { console.info('usb SUB_USB_JS_0600 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -534,6 +605,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0610', 0, function () { console.info('usb SUB_USB_JS_0610 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); @@ -553,6 +629,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () { */ it('SUB_USB_JS_0620', 0, function () { console.info('usb SUB_USB_JS_0620 begin'); + if (portCurrentMode == 1) { + console.info('usb case get_device port is device') + expect(false).assertFalse(); + return + } var testParam = getTransferTestParam() if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) { expect(false).assertTrue(); diff --git a/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js index bf9aec12484f511cebbc3cffc86a9e37962ffe44..bf82bcf6639c76d8f2cea61bf839b9eb8473f491 100644 --- a/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js @@ -77,11 +77,11 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { callSetCurFunction('SUB_USB_JS_0350 ACM 1', usb.ACM) }) - // /** - // * @tc.number : SUB_USB_JS_0360 - // * @tc.name : functions_test - // * @tc.desc : 在设备模式下设置当前的USB功能列表 Set 2 设置为ECM功能 - // */ + /** + * @tc.number : SUB_USB_JS_0360 + * @tc.name : functions_test + * @tc.desc : 在设备模式下设置当前的USB功能列表 Set 2 设置为ECM功能 + */ it('SUB_USB_JS_0360', 0, function () { CheckEmptyUtils.sleep(3000) console.info('usb SUB_USB_JS_0360 set ECM begin'); @@ -92,11 +92,11 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { callSetCurFunction('SUB_USB_JS_0360 ECM 2', usb.ECM) }) - // /** - // * @tc.number : SUB_USB_JS_0370 - // * @tc.name : functions_test - // * @tc.desc : 在设备模式下设置当前的USB功能列表 Set 3 设置为ACM、ECM功能 - // */ + /** + * @tc.number : SUB_USB_JS_0370 + * @tc.name : functions_test + * @tc.desc : 在设备模式下设置当前的USB功能列表 Set 3 设置为ACM、ECM功能 + */ it('SUB_USB_JS_0370', 0, function () { CheckEmptyUtils.sleep(3000) console.info('usb SUB_USB_JS_0370 set ACM ECM begin');