提交 7a8078da 编写于 作者: L lixiaofeng_154b

适配用例

Signed-off-by: Nlixiaofeng_154b <lixiaofeng54@huawei.com>
上级 82483e69
...@@ -32,6 +32,10 @@ describe('UsbCoreJsFunctionsTest', function () { ...@@ -32,6 +32,10 @@ describe('UsbCoreJsFunctionsTest', function () {
console.info('begin test getversion :' + Version) console.info('begin test getversion :' + Version)
// version > 17 host currentMode = 2 device currentMode = 1 // version > 17 host currentMode = 2 device currentMode = 1
var usbPortList = usb.getPorts() var usbPortList = usb.getPorts()
if (usbPortList == undefined) {
portCurrentMode = 1;
return
}
gDeviceList = usb.getDevices(); gDeviceList = usb.getDevices();
if (usbPortList.length > 0) { if (usbPortList.length > 0) {
console.info('usb case gDeviceList.length return: ' + gDeviceList.length); console.info('usb case gDeviceList.length return: ' + gDeviceList.length);
......
/* /*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -32,6 +32,10 @@ describe('UsbCoreJsFunctionsTestEx', function () { ...@@ -32,6 +32,10 @@ describe('UsbCoreJsFunctionsTestEx', function () {
console.info('begin test getversion :' + Version) console.info('begin test getversion :' + Version)
// version > 17 host currentMode = 2 device currentMode = 1 // version > 17 host currentMode = 2 device currentMode = 1
var usbPortList = usb.getPorts() var usbPortList = usb.getPorts()
if (usbPortList == undefined) {
portCurrentMode = 1;
return
}
gDeviceList = usb.getDevices(); gDeviceList = usb.getDevices();
if (usbPortList.length > 0) { if (usbPortList.length > 0) {
if (gDeviceList.length > 0) { if (gDeviceList.length > 0) {
......
...@@ -33,6 +33,10 @@ describe('UsbDevicePipeJsFunctionsTest', function () { ...@@ -33,6 +33,10 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
console.info('usb unit begin test getversion :' + Version) console.info('usb unit begin test getversion :' + Version)
// version > 17 host currentMode = 2 device currentMode = 1 // version > 17 host currentMode = 2 device currentMode = 1
var usbPortList = usb.getPorts() var usbPortList = usb.getPorts()
if (usbPortList == undefined) {
portCurrentMode = 1;
return
}
gDeviceList = usb.getDevices(); gDeviceList = usb.getDevices();
if (usbPortList.length > 0) { if (usbPortList.length > 0) {
if (gDeviceList.length > 0) { if (gDeviceList.length > 0) {
......
...@@ -33,6 +33,10 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { ...@@ -33,6 +33,10 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
// version > 17 host currentMode = 2 device currentMode = 1 // version > 17 host currentMode = 2 device currentMode = 1
var usbPortList = usb.getPorts() var usbPortList = usb.getPorts()
if (usbPortList == undefined) {
portCurrentMode = 1;
return
}
gDeviceList = usb.getDevices(); gDeviceList = usb.getDevices();
if (usbPortList.length > 0) { if (usbPortList.length > 0) {
if (gDeviceList.length > 0) { if (gDeviceList.length > 0) {
......
/* /*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册