1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import usbManager from '@ohos.usbManager'; 17//import CheckEmptyUtils from './CheckEmptyUtils.js'; 18import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' 19 20 21export default function UsbManagerJsTest() { 22describe('UsbManagerJsTest', function () { 23 24 const TAG = "[UsbManagerJsTest]"; 25 const PARAM_NULL = null; 26 const PARAM_UNDEFINED = undefined; 27 const PARAM_NULLSTRING = ""; 28 const PARAM_NUMBEREX = 123; 29 let gDeviceList; 30 let devices; 31 let usbPortList; 32 let gPipe; 33 let isDeviceConnected; 34 let tmpPipe = { 35 busNum: null, 36 devAddress: null 37 }; 38 function deviceConnected() { 39 if (usbPortList == undefined) { 40 console.info(TAG, "Test USB device is not supported"); 41 return false; 42 } 43 if (gDeviceList.length > 0) { 44 console.info(TAG, "Test USB device is connected"); 45 return true; 46 } 47 console.info(TAG, "Test USB device is not connected"); 48 return false; 49 } 50 51 beforeAll(async function () { 52 console.log(TAG, '*************Usb Unit UsbManagerJsTest Begin*************'); 53 const Version = usbManager.getVersion(); 54 console.info(TAG, 'usb unit begin test getversion :' + Version); 55 56 // version > 17 host currentMode = 2 device currentMode = 1 57 usbPortList = usbManager.getPortList(); 58 59 gDeviceList = usbManager.getDevices(); 60 isDeviceConnected = deviceConnected(); 61 if (isDeviceConnected) { 62 if (usbPortList.length > 0) { 63 if (usbPortList[0].status.currentMode == 1) { 64 try { 65 let data = await usbManager.setPortRoleTypes(usbPortList[0].id, 66 usbManager.SOURCE, usbManager.HOST); 67 console.info(TAG, 'usb case setPortRoleTypesEx return: ' + data); 68 } catch (error) { 69 console.info(TAG, 'usb case setPortRoleTypesEx error : ' + error); 70 } 71 CheckEmptyUtils.sleep(4000); 72 console.log(TAG, '*************Usb Unit Begin switch to host*************'); 73 } 74 } 75 tmpPipe.busNum = gDeviceList[0].busNum; 76 tmpPipe.devAddress = gDeviceList[0].devAddress; 77 } 78 }) 79 80 beforeEach(function () { 81 console.info(TAG, 'beforeEach: *************Usb Unit Test CaseEx*************'); 82 gDeviceList = usbManager.getDevices(); 83 if (isDeviceConnected) { 84 devices = gDeviceList[0]; 85 console.info(TAG, 'beforeEach return devices : ' + JSON.stringify(devices)); 86 } 87 }) 88 89 afterEach(function () { 90 console.info(TAG, 'afterEach: *************Usb Unit Test CaseEx*************'); 91 devices = null; 92 gPipe = null; 93 console.info(TAG, 'afterEach return devices : ' + JSON.stringify(devices)); 94 }) 95 96 afterAll(function () { 97 console.log(TAG, '*************Usb Unit UsbManagerJsTest End*************'); 98 }) 99 100 function getPipe(testCaseName) { 101 gPipe = usbManager.connectDevice(devices); 102 console.info(TAG, `usb ${testCaseName} connectDevice getPipe ret: ${JSON.stringify(gPipe)}`); 103 expect(gPipe !== null).assertTrue(); 104 } 105 106 function toReleaseInterface(testCaseName, tInterface) { 107 let ret = usbManager.releaseInterface(tmpPipe, tInterface); 108 console.info(TAG, `usb ${testCaseName} releaseInterface ret: ${ret}`); 109 expect(ret).assertEqual(0); 110 } 111 112 function toClosePipe(testCaseName) { 113 let isPipClose = usbManager.closePipe(tmpPipe); 114 console.info(TAG, `usb ${testCaseName} closePipe ret: ${isPipClose}`); 115 expect(isPipClose).assertEqual(0); 116 } 117 118 /** 119 * @tc.number : USB_HostManager_JS_0100 120 * @tc.name : testHasRight001 121 * @tc.desc : Negative test: Param is null string 122 * @tc.size : MediumTest 123 * @tc.type : Function 124 * @tc.level : Level 3 125 */ 126 it('testHasRight001', 0, function () { 127 console.info(TAG, 'usb testHasRight001 begin'); 128 if (!isDeviceConnected) { 129 expect(isDeviceConnected).assertFalse(); 130 return 131 } 132 try { 133 let isHasRight = usbManager.hasRight(PARAM_NULLSTRING); 134 console.info(TAG, 'usb case hasRight ret : ' + isHasRight); 135 expect(isHasRight).assertFalse(); 136 } catch (err) { 137 console.info(TAG, 'testHasRight001 catch err code: ', err.code, ', message: ', err.message); 138 expect(err !== null).assertFalse(); 139 } 140 }) 141 142 /** 143 * @tc.number : USB_HostManager_JS_0200 144 * @tc.name : testHasRight002 145 * @tc.desc : Negative test: Param add number '123' 146 * @tc.size : MediumTest 147 * @tc.type : Function 148 * @tc.level : Level 3 149 */ 150 it('testHasRight002', 0, function () { 151 console.info(TAG, 'usb testHasRight002 begin'); 152 if (!isDeviceConnected) { 153 expect(isDeviceConnected).assertFalse(); 154 return 155 } 156 try { 157 for (var i = 0; i < gDeviceList.length; i++) { 158 let deviceName = gDeviceList[i].name; 159 deviceName = deviceName + "123"; 160 let isHasRight = usbManager.hasRight(deviceName); 161 console.info(TAG, 'usb [', deviceName, '] hasRight ret : ' + isHasRight); 162 expect(isHasRight).assertFalse(); 163 } 164 } catch (err) { 165 console.info(TAG, 'testHasRight002 catch err code: ', err.code, ', message: ', err.message); 166 expect(err !== null).assertFalse(); 167 } 168 }) 169 170 /** 171 * @tc.number : USB_HostManager_JS__0300 172 * @tc.name : testRequestRight001 173 * @tc.desc : Negative test: Param is null string 174 * @tc.size : MediumTest 175 * @tc.type : Function 176 * @tc.level : Level 3 177 */ 178 it('testRequestRight001', 0, async function () { 179 console.info(TAG, 'usb testRequestRight001 begin'); 180 if (!isDeviceConnected) { 181 expect(isDeviceConnected).assertFalse(); 182 return 183 } 184 try { 185 let isHasRight = await usbManager.requestRight(PARAM_NULLSTRING); 186 console.info(TAG, 'usb case requestRight ret : ' + isHasRight); 187 expect(isHasRight).assertFalse(); 188 } catch (err) { 189 console.info(TAG, 'testRequestRight001 catch err code: ', err.code, ', message: ', err.message); 190 expect(err !== null).assertFalse(); 191 } 192 }) 193 194 /** 195 * @tc.number : USB_HostManager_JS__0400 196 * @tc.name : testRequestRight002 197 * @tc.desc : Negative test: Param add number 'abc' 198 * @tc.size : MediumTest 199 * @tc.type : Function 200 * @tc.level : Level 3 201 */ 202 it('testRequestRight002', 0, async function () { 203 console.info(TAG, 'usb testRequestRight002 begin'); 204 if (!isDeviceConnected) { 205 expect(isDeviceConnected).assertFalse(); 206 return 207 } 208 try { 209 for (var i = 0; i < gDeviceList.length; i++) { 210 let deviceName = gDeviceList[i].name; 211 deviceName = deviceName + "abc"; 212 let isHasRight = await usbManager.requestRight(deviceName); 213 console.info(TAG, 'usb [', deviceName, '] requestRight ret : ' + isHasRight); 214 expect(isHasRight).assertFalse(); 215 } 216 } catch (err) { 217 console.info(TAG, 'testRequestRight002 catch err code: ', err.code, ', message: ', err.message); 218 expect(err !== null).assertFalse(); 219 } 220 }) 221 222 /** 223 * @tc.number : USB_HostManager_JS__0500 224 * @tc.name : testRemoveRight001 225 * @tc.desc : Negative test: Param is null string 226 * @tc.size : MediumTest 227 * @tc.type : Function 228 * @tc.level : Level 3 229 */ 230 it('testRemoveRight001', 0, function () { 231 console.info(TAG, 'usb testRemoveRight001 begin'); 232 if (!isDeviceConnected) { 233 expect(isDeviceConnected).assertFalse(); 234 return 235 } 236 try { 237 let remRight = usbManager.removeRight(PARAM_NULLSTRING); 238 console.info(TAG, 'usb case removeRight ret : ' + remRight); 239 expect(remRight).assertFalse(); 240 } catch (err) { 241 console.info(TAG, 'testRemoveRight001 catch err code: ', err.code, ', message: ', err.message); 242 expect(err !== null).assertFalse(); 243 } 244 }) 245 246 /** 247 * @tc.number : USB_HostManager_JS__0600 248 * @tc.name : testRemoveRight002 249 * @tc.desc : Negative test: Param add letter 'abc' 250 * @tc.size : MediumTest 251 * @tc.type : Function 252 * @tc.level : Level 3 253 */ 254 it('testRemoveRight002', 0, function () { 255 console.info(TAG, 'usb testRemoveRight002 begin'); 256 if (!isDeviceConnected) { 257 expect(isDeviceConnected).assertFalse(); 258 return 259 } 260 try { 261 for (var i = 0; i < gDeviceList.length; i++) { 262 let deviceName = gDeviceList[i].name; 263 deviceName = deviceName + "abc"; 264 let remRight = usbManager.removeRight(deviceName); 265 console.info(TAG, 'usb [', deviceName, '] removeRight ret : ', remRight); 266 expect(remRight).assertFalse(); 267 } 268 } catch (err) { 269 console.info(TAG, 'testRemoveRight002 catch err code: ', err.code, ', message: ', err.message); 270 expect(err !== null).assertFalse(); 271 } 272 }) 273 274 /** 275 * @tc.number : USB_HostManager_JS__0700 276 * @tc.name : testRemoveRight003 277 * @tc.desc : Negative test: Param add special characters '@#' 278 * @tc.size : MediumTest 279 * @tc.type : Function 280 * @tc.level : Level 3 281 */ 282 it('testRemoveRight003', 0, function () { 283 console.info(TAG, 'usb testRemoveRight003 begin'); 284 if (!isDeviceConnected) { 285 expect(isDeviceConnected).assertFalse(); 286 return 287 } 288 try { 289 for (var i = 0; i < gDeviceList.length; i++) { 290 let deviceName = gDeviceList[i].name; 291 deviceName = deviceName + "@#"; 292 let remRight = usbManager.removeRight(deviceName); 293 console.info(TAG, 'usb [', deviceName, '] removeRight ret : ', remRight); 294 expect(remRight).assertFalse(); 295 } 296 } catch (err) { 297 console.info(TAG, 'testRemoveRight003 catch err code: ', err.code, ', message: ', err.message); 298 expect(err !== null).assertFalse(); 299 } 300 }) 301 302 /** 303 * @tc.number : USB_HostManager_JS__0800 304 * @tc.name : testRemoveRight004 305 * @tc.desc : Negative test: Param add number '123' 306 * @tc.size : MediumTest 307 * @tc.type : Function 308 * @tc.level : Level 3 309 */ 310 it('testRemoveRight004', 0, function () { 311 console.info(TAG, 'usb testRemoveRight004 begin'); 312 if (!isDeviceConnected) { 313 expect(isDeviceConnected).assertFalse(); 314 return 315 } 316 try { 317 for (var i = 0; i < gDeviceList.length; i++) { 318 let deviceName = gDeviceList[i].name; 319 deviceName = deviceName + "123"; 320 let remRight = usbManager.removeRight(deviceName); 321 console.info(TAG, 'usb [', deviceName, '] removeRight ret : ', remRight); 322 expect(remRight).assertFalse(); 323 } 324 } catch (err) { 325 console.info(TAG, 'testRemoveRight004 catch err code: ', err.code, ', message: ', err.message); 326 expect(err !== null).assertFalse(); 327 } 328 }) 329 330 /** 331 * @tc.number : USB_HostManager_JS__0900 332 * @tc.name : testConnectDevice001 333 * @tc.desc : Negative test: Param add number '123' 334 * @tc.size : MediumTest 335 * @tc.type : Function 336 * @tc.level : Level 3 337 */ 338 it('testConnectDevice001', 0, function () { 339 console.info(TAG, 'usb testConnectDevice001 begin'); 340 if (!isDeviceConnected) { 341 expect(isDeviceConnected).assertFalse(); 342 return 343 } 344 try { 345 let deviceName = devices.name + "123"; 346 devices.name = deviceName; 347 let gPipe = usbManager.connectDevice(devices); 348 349 console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe)); 350 expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse(); 351 } catch (err) { 352 console.info(TAG, 'testConnectDevice001 catch err code: ', err.code, ', message: ', err.message); 353 expect(err !== null).assertFalse(); 354 } 355 }) 356 357 /** 358 * @tc.number : USB_HostManager_JS__1000 359 * @tc.name : testConnectDevice002 360 * @tc.desc : Negative test: Param add letter 'abc' 361 * @tc.size : MediumTest 362 * @tc.type : Function 363 * @tc.level : Level 3 364 */ 365 it('testConnectDevice002', 0, function () { 366 console.info(TAG, 'usb testConnectDevice002 begin'); 367 if (!isDeviceConnected) { 368 expect(isDeviceConnected).assertFalse(); 369 return 370 } 371 try { 372 let deviceName = devices.name + "abc"; 373 devices.name = deviceName; 374 let gPipe = usbManager.connectDevice(devices); 375 console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe)); 376 expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse(); 377 } catch (err) { 378 console.info(TAG, 'testConnectDevice002 catch err code: ', err.code, ', message: ', err.message); 379 expect(err !== null).assertFalse(); 380 } 381 }) 382 383 /** 384 * @tc.number : USB_HostManager_JS__1100 385 * @tc.name : testConnectDevice003 386 * @tc.desc : Negative test: Param add special characters '@#' 387 * @tc.size : MediumTest 388 * @tc.type : Function 389 * @tc.level : Level 3 390 */ 391 it('testConnectDevice003', 0, function () { 392 console.info(TAG, 'usb testConnectDevice003 begin'); 393 if (!isDeviceConnected) { 394 expect(isDeviceConnected).assertFalse(); 395 return 396 } 397 try { 398 let deviceName = devices.name + "@#"; 399 devices.name = deviceName; 400 let gPipe = usbManager.connectDevice(devices); 401 console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe)); 402 expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse(); 403 } catch (err) { 404 console.info(TAG, 'testConnectDevice003 catch err code: ', err.code, ', message: ', err.message); 405 expect(err !== null).assertFalse(); 406 } 407 }) 408 409 /** 410 * @tc.number : USB_HostManager_JS__1200 411 * @tc.name : testConnectDevice004 412 * @tc.desc : Negative test: devices name is null string "" 413 * @tc.size : MediumTest 414 * @tc.type : Function 415 * @tc.level : Level 3 416 */ 417 it('testConnectDevice004', 0, function () { 418 console.info(TAG, 'usb testConnectDevice004 begin'); 419 if (!isDeviceConnected) { 420 expect(isDeviceConnected).assertFalse(); 421 return 422 } 423 try { 424 devices.name = PARAM_NULLSTRING; 425 let gPipe = usbManager.connectDevice(devices); 426 console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe)); 427 expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse(); 428 } catch (err) { 429 console.info(TAG, 'testConnectDevice004 catch err code: ', err.code, ', message: ', err.message); 430 expect(err !== null).assertFalse(); 431 } 432 }) 433 434 /** 435 * @tc.number : USB_HostManager_JS__1300 436 * @tc.name : testConnectDevice005 437 * @tc.desc : Negative test: devices serial is null string "" 438 * @tc.size : MediumTest 439 * @tc.type : Function 440 * @tc.level : Level 3 441 */ 442 it('testConnectDevice005', 0, function () { 443 console.info(TAG, 'usb testConnectDevice005 begin'); 444 if (!isDeviceConnected) { 445 expect(isDeviceConnected).assertFalse(); 446 return 447 } 448 try { 449 devices.serial = PARAM_NULLSTRING; 450 let gPipe = usbManager.connectDevice(devices); 451 console.info(TAG, 'usb [', devices.serial, '] connectDevice ret : ', JSON.stringify(gPipe)); 452 expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse(); 453 } catch (err) { 454 console.info(TAG, 'testConnectDevice005 catch err code: ', err.code, ', message: ', err.message); 455 expect(err !== null).assertFalse(); 456 } 457 }) 458 459 /** 460 * @tc.number : USB_HostManager_JS__1400 461 * @tc.name : testConnectDevice006 462 * @tc.desc : Negative test: devices serial add letter abc 463 * @tc.size : MediumTest 464 * @tc.type : Function 465 * @tc.level : Level 3 466 */ 467 it('testConnectDevice006', 0, function () { 468 console.info(TAG, 'usb testConnectDevice006 begin'); 469 if (!isDeviceConnected) { 470 expect(isDeviceConnected).assertFalse(); 471 return 472 } 473 try { 474 let devSerial = devices.serial + "abc"; 475 devices.serial = devSerial; 476 let gPipe = usbManager.connectDevice(devices); 477 console.info(TAG, 'usb [', devices.serial, '] connectDevice ret : ', JSON.stringify(gPipe)); 478 expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse(); 479 } catch (err) { 480 console.info(TAG, 'testConnectDevice006 catch err code: ', err.code, ', message: ', err.message); 481 expect(err !== null).assertFalse(); 482 } 483 }) 484 485 /** 486 * @tc.number : SUB_USB_HostManager_JS_ParamErr_1800 487 * @tc.name : testConnectDeviceParamErr007 488 * @tc.desc : Negative test: devices name is number 123 489 * @tc.size : MediumTest 490 * @tc.type : Function 491 * @tc.level : Level 3 492 */ 493 it('testConnectDeviceParamErr007', 0, function () { 494 console.info(TAG, 'usb testConnectDeviceParamErr007 begin'); 495 if (!isDeviceConnected) { 496 expect(isDeviceConnected).assertFalse(); 497 return 498 } 499 try { 500 devices.name = PARAM_NUMBERTYPE; 501 let ret = usbManager.connectDevice(devices); 502 console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(ret)); 503 expect(ret !== null).assertFalse(); 504 } catch (err) { 505 console.info(TAG, 'testConnectDeviceParamErr007 catch err code: ', err.code, ', message: ', err.message); 506 expect(err.code).assertEqual(PARAM_ERRCODE); 507 } 508 }) 509 510 /** 511 * @tc.number : SUB_USB_HostManager_JS_ParamErr_1900 512 * @tc.name : testConnectDeviceParamErr008 513 * @tc.desc : Negative test: devices busNum is null 514 * @tc.size : MediumTest 515 * @tc.type : Function 516 * @tc.level : Level 3 517 */ 518 it('testConnectDeviceParamErr008', 0, function () { 519 console.info(TAG, 'usb testConnectDeviceParamErr008 begin'); 520 if (!isDeviceConnected) { 521 expect(isDeviceConnected).assertFalse(); 522 return 523 } 524 try { 525 devices.busNum = PARAM_NULL; 526 let ret = usbManager.connectDevice(devices); 527 console.info(TAG, 'usb [busNum:null] connectDevice ret : ', JSON.stringify(ret)); 528 expect(ret !== null).assertFalse(); 529 } catch (err) { 530 console.info(TAG, 'testConnectDeviceParamErr008 catch err code: ', err.code, ', message: ', err.message); 531 expect(err.code).assertEqual(PARAM_ERRCODE); 532 } 533 }) 534 535 /** 536 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2000 537 * @tc.name : testConnectDeviceParamErr009 538 * @tc.desc : Negative test: devices busNum is undefined 539 * @tc.size : MediumTest 540 * @tc.type : Function 541 * @tc.level : Level 3 542 */ 543 it('testConnectDeviceParamErr009', 0, function () { 544 console.info(TAG, 'usb testConnectDeviceParamErr009 begin'); 545 if (!isDeviceConnected) { 546 expect(isDeviceConnected).assertFalse(); 547 return 548 } 549 try { 550 devices.busNum = PARAM_UNDEFINED; 551 let ret = usbManager.connectDevice(devices); 552 console.info(TAG, 'usb [busNum:undefined] connectDevice ret : ', JSON.stringify(ret)); 553 expect(ret !== null).assertFalse(); 554 } catch (err) { 555 console.info(TAG, 'testConnectDeviceParamErr009 catch err code: ', err.code, ', message: ', err.message); 556 expect(err.code).assertEqual(PARAM_ERRCODE); 557 } 558 }) 559 560 /** 561 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2100 562 * @tc.name : testConnectDeviceParamErr010 563 * @tc.desc : Negative test: devices busNum null string "" 564 * @tc.size : MediumTest 565 * @tc.type : Function 566 * @tc.level : Level 3 567 */ 568 it('testConnectDeviceParamErr010', 0, function () { 569 console.info(TAG, 'usb testConnectDeviceParamErr010 begin'); 570 if (!isDeviceConnected) { 571 expect(isDeviceConnected).assertFalse(); 572 return 573 } 574 try { 575 devices.busNum = PARAM_NULLSTRING; 576 let ret = usbManager.connectDevice(devices); 577 console.info(TAG, 'usb [busNum:null string] connectDevice ret : ', JSON.stringify(ret)); 578 expect(ret !== null).assertFalse(); 579 } catch (err) { 580 console.info(TAG, 'testConnectDeviceParamErr010 catch err code: ', err.code, ', message: ', err.message); 581 expect(err.code).assertEqual(PARAM_ERRCODE); 582 } 583 }) 584 585 /** 586 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2200 587 * @tc.name : testConnectDeviceParamErr011 588 * @tc.desc : Negative test: devices devAddress is null 589 * @tc.size : MediumTest 590 * @tc.type : Function 591 * @tc.level : Level 3 592 */ 593 it('testConnectDeviceParamErr011', 0, function () { 594 console.info(TAG, 'usb testConnectDeviceParamErr011 begin'); 595 if (!isDeviceConnected) { 596 expect(isDeviceConnected).assertFalse(); 597 return 598 } 599 try { 600 devices.devAddress = PARAM_NULL; 601 let ret = usbManager.connectDevice(devices); 602 console.info(TAG, 'usb [devAddress:null] connectDevice ret : ', JSON.stringify(ret)); 603 expect(ret !== null).assertFalse(); 604 } catch (err) { 605 console.info(TAG, 'testConnectDeviceParamErr011 catch err code: ', err.code, ', message: ', err.message); 606 expect(err.code).assertEqual(PARAM_ERRCODE); 607 } 608 }) 609 610 /** 611 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2300 612 * @tc.name : testConnectDeviceParamErr012 613 * @tc.desc : Negative test: devices devAddress is undefined 614 * @tc.size : MediumTest 615 * @tc.type : Function 616 * @tc.level : Level 3 617 */ 618 it('testConnectDeviceParamErr012', 0, function () { 619 console.info(TAG, 'usb testConnectDeviceParamErr012 begin'); 620 if (!isDeviceConnected) { 621 expect(isDeviceConnected).assertFalse(); 622 return 623 } 624 try { 625 devices.devAddress = PARAM_UNDEFINED; 626 let ret = usbManager.connectDevice(devices); 627 console.info(TAG, 'usb [devAddress:undefined] connectDevice ret : ', JSON.stringify(ret)); 628 expect(ret !== null).assertFalse(); 629 } catch (err) { 630 console.info(TAG, 'testConnectDeviceParamErr012 catch err code: ', err.code, ', message: ', err.message); 631 expect(err.code).assertEqual(PARAM_ERRCODE); 632 } 633 }) 634 635 /** 636 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2400 637 * @tc.name : testConnectDeviceParamErr013 638 * @tc.desc : Negative test: devices devAddress is null string 639 * @tc.size : MediumTest 640 * @tc.type : Function 641 * @tc.level : Level 3 642 */ 643 it('testConnectDeviceParamErr013', 0, function () { 644 console.info(TAG, 'usb testConnectDeviceParamErr013 begin'); 645 if (!isDeviceConnected) { 646 expect(isDeviceConnected).assertFalse(); 647 return 648 } 649 try { 650 devices.devAddress = PARAM_NULLSTRING; 651 let ret = usbManager.connectDevice(devices); 652 console.info(TAG, 'usb [devAddress:null string] connectDevice ret : ', JSON.stringify(ret)); 653 expect(ret !== null).assertFalse(); 654 } catch (err) { 655 console.info(TAG, 'testConnectDeviceParamErr013 catch err code: ', err.code, ', message: ', err.message); 656 expect(err.code).assertEqual(PARAM_ERRCODE); 657 } 658 }) 659 660 /** 661 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2500 662 * @tc.name : testConnectDeviceParamErr014 663 * @tc.desc : Negative test: devices serial is null 664 * @tc.size : MediumTest 665 * @tc.type : Function 666 * @tc.level : Level 3 667 */ 668 it('testConnectDeviceParamErr014', 0, function () { 669 console.info(TAG, 'usb testConnectDeviceParamErr014 begin'); 670 if (!isDeviceConnected) { 671 expect(isDeviceConnected).assertFalse(); 672 return 673 } 674 try { 675 devices.serial = PARAM_NULL; 676 let ret = usbManager.connectDevice(devices); 677 console.info(TAG, 'usb [serial:null] connectDevice ret : ', JSON.stringify(ret)); 678 expect(ret !== null).assertFalse(); 679 } catch (err) { 680 console.info(TAG, 'testConnectDeviceParamErr014 catch err code: ', err.code, ', message: ', err.message); 681 expect(err.code).assertEqual(PARAM_ERRCODE); 682 } 683 }) 684 685 /** 686 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2600 687 * @tc.name : testConnectDeviceParamErr015 688 * @tc.desc : Negative test: devices serial is undefined 689 * @tc.size : MediumTest 690 * @tc.type : Function 691 * @tc.level : Level 3 692 */ 693 it('testConnectDeviceParamErr015', 0, function () { 694 console.info(TAG, 'usb testConnectDeviceParamErr015 begin'); 695 if (!isDeviceConnected) { 696 expect(isDeviceConnected).assertFalse(); 697 return 698 } 699 try { 700 devices.serial = PARAM_UNDEFINED; 701 let ret = usbManager.connectDevice(devices); 702 console.info(TAG, 'usb [serial:undefined] connectDevice ret : ', JSON.stringify(ret)); 703 expect(ret !== null).assertFalse(); 704 } catch (err) { 705 console.info(TAG, 'testConnectDeviceParamErr015 catch err code: ', err.code, ', message: ', err.message); 706 expect(err.code).assertEqual(PARAM_ERRCODE); 707 } 708 }) 709 710 /** 711 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2700 712 * @tc.name : testConnectDeviceParamErr016 713 * @tc.desc : Negative test: devices serial is number 123 714 * @tc.size : MediumTest 715 * @tc.type : Function 716 * @tc.level : Level 3 717 */ 718 it('testConnectDeviceParamErr016', 0, function () { 719 console.info(TAG, 'usb testConnectDeviceParamErr016 begin'); 720 if (!isDeviceConnected) { 721 expect(isDeviceConnected).assertFalse(); 722 return 723 } 724 try { 725 devices.serial = PARAM_NUMBERTYPE; 726 let ret = usbManager.connectDevice(devices); 727 console.info(TAG, 'usb [serial:123] connectDevice ret : ', JSON.stringify(ret)); 728 expect(ret !== null).assertFalse(); 729 } catch (err) { 730 console.info(TAG, 'testConnectDeviceParamErr016 catch err code: ', err.code, ', message: ', err.message); 731 expect(err.code).assertEqual(PARAM_ERRCODE); 732 } 733 }) 734 735 /** 736 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2800 737 * @tc.name : testConnectDeviceParamErr017 738 * @tc.desc : Negative test: devices manufacturerName is null 739 * @tc.size : MediumTest 740 * @tc.type : Function 741 * @tc.level : Level 3 742 */ 743 it('testConnectDeviceParamErr017', 0, function () { 744 console.info(TAG, 'usb testConnectDeviceParamErr017 begin'); 745 if (!isDeviceConnected) { 746 expect(isDeviceConnected).assertFalse(); 747 return 748 } 749 try { 750 devices.manufacturerName = PARAM_NULL; 751 let ret = usbManager.connectDevice(devices); 752 console.info(TAG, 'usb [manufacturerName:null] connectDevice ret : ', JSON.stringify(ret)); 753 expect(ret !== null).assertFalse(); 754 } catch (err) { 755 console.info(TAG, 'testConnectDeviceParamErr017 catch err code: ', err.code, ', message: ', err.message); 756 expect(err.code).assertEqual(PARAM_ERRCODE); 757 } 758 }) 759 760 /** 761 * @tc.number : SUB_USB_HostManager_JS_ParamErr_2900 762 * @tc.name : testConnectDeviceParamErr018 763 * @tc.desc : Negative test: devices manufacturerName is undefined 764 * @tc.size : MediumTest 765 * @tc.type : Function 766 * @tc.level : Level 3 767 */ 768 it('testConnectDeviceParamErr018', 0, function () { 769 console.info(TAG, 'usb testConnectDeviceParamErr018 begin'); 770 if (!isDeviceConnected) { 771 expect(isDeviceConnected).assertFalse(); 772 return 773 } 774 try { 775 devices.manufacturerName = PARAM_UNDEFINED; 776 let ret = usbManager.connectDevice(devices); 777 console.info(TAG, 'usb [manufacturerName:undefined] connectDevice ret : ', JSON.stringify(ret)); 778 expect(ret !== null).assertFalse(); 779 } catch (err) { 780 console.info(TAG, 'testConnectDeviceParamErr018 catch err code: ', err.code, ', message: ', err.message); 781 expect(err.code).assertEqual(PARAM_ERRCODE); 782 } 783 }) 784 785 /** 786 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3000 787 * @tc.name : testConnectDeviceParamErr019 788 * @tc.desc : Negative test: devices manufacturerName is number 123 789 * @tc.size : MediumTest 790 * @tc.type : Function 791 * @tc.level : Level 3 792 */ 793 it('testConnectDeviceParamErr019', 0, function () { 794 console.info(TAG, 'usb testConnectDeviceParamErr019 begin'); 795 if (!isDeviceConnected) { 796 expect(isDeviceConnected).assertFalse(); 797 return 798 } 799 try { 800 devices.manufacturerName = PARAM_NUMBERTYPE; 801 let ret = usbManager.connectDevice(devices); 802 console.info(TAG, 'usb [manufacturerName:123] connectDevice ret : ', JSON.stringify(ret)); 803 expect(ret !== null).assertFalse(); 804 } catch (err) { 805 console.info(TAG, 'testConnectDeviceParamErr019 catch err code: ', err.code, ', message: ', err.message); 806 expect(err.code).assertEqual(PARAM_ERRCODE); 807 } 808 }) 809 810 /** 811 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3100 812 * @tc.name : testConnectDeviceParamErr020 813 * @tc.desc : Negative test: devices productName is null 814 * @tc.size : MediumTest 815 * @tc.type : Function 816 * @tc.level : Level 3 817 */ 818 it('testConnectDeviceParamErr020', 0, function () { 819 console.info(TAG, 'usb testConnectDeviceParamErr020 begin'); 820 if (!isDeviceConnected) { 821 expect(isDeviceConnected).assertFalse(); 822 return 823 } 824 try { 825 devices.productName = PARAM_NULL; 826 let ret = usbManager.connectDevice(devices); 827 console.info(TAG, 'usb [productName:null] connectDevice ret : ', JSON.stringify(ret)); 828 expect(ret !== null).assertFalse(); 829 } catch (err) { 830 console.info(TAG, 'testConnectDeviceParamErr020 catch err code: ', err.code, ', message: ', err.message); 831 expect(err.code).assertEqual(PARAM_ERRCODE); 832 } 833 }) 834 835 /** 836 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3200 837 * @tc.name : testConnectDeviceParamErr021 838 * @tc.desc : Negative test: devices productName is undefined 839 * @tc.size : MediumTest 840 * @tc.type : Function 841 * @tc.level : Level 3 842 */ 843 it('testConnectDeviceParamErr021', 0, function () { 844 console.info(TAG, 'usb testConnectDeviceParamErr021 begin'); 845 if (!isDeviceConnected) { 846 expect(isDeviceConnected).assertFalse(); 847 return 848 } 849 try { 850 devices.productName = PARAM_UNDEFINED; 851 let ret = usbManager.connectDevice(devices); 852 console.info(TAG, 'usb [productName:undefined] connectDevice ret : ', JSON.stringify(ret)); 853 expect(ret !== null).assertFalse(); 854 } catch (err) { 855 console.info(TAG, 'testConnectDeviceParamErr021 catch err code: ', err.code, ', message: ', err.message); 856 expect(err.code).assertEqual(PARAM_ERRCODE); 857 } 858 }) 859 860 /** 861 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3300 862 * @tc.name : testConnectDeviceParamErr022 863 * @tc.desc : Negative test: devices productName is number 123 864 * @tc.size : MediumTest 865 * @tc.type : Function 866 * @tc.level : Level 3 867 */ 868 it('testConnectDeviceParamErr022', 0, function () { 869 console.info(TAG, 'usb testConnectDeviceParamErr022 begin'); 870 if (!isDeviceConnected) { 871 expect(isDeviceConnected).assertFalse(); 872 return 873 } 874 try { 875 devices.productName = PARAM_NUMBERTYPE; 876 let ret = usbManager.connectDevice(devices); 877 console.info(TAG, 'usb [productName:123] connectDevice ret : ', JSON.stringify(ret)); 878 expect(ret !== null).assertFalse(); 879 } catch (err) { 880 console.info(TAG, 'testConnectDeviceParamErr022 catch err code: ', err.code, ', message: ', err.message); 881 expect(err.code).assertEqual(PARAM_ERRCODE); 882 } 883 }) 884 885 /** 886 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3400 887 * @tc.name : testConnectDeviceParamErr023 888 * @tc.desc : Negative test: devices version is null 889 * @tc.size : MediumTest 890 * @tc.type : Function 891 * @tc.level : Level 3 892 */ 893 it('testConnectDeviceParamErr023', 0, function () { 894 console.info(TAG, 'usb testConnectDeviceParamErr023 begin'); 895 if (!isDeviceConnected) { 896 expect(isDeviceConnected).assertFalse(); 897 return 898 } 899 try { 900 devices.version = PARAM_NULL; 901 let ret = usbManager.connectDevice(devices); 902 console.info(TAG, 'usb [version:null] connectDevice ret : ', JSON.stringify(ret)); 903 expect(ret !== null).assertFalse(); 904 } catch (err) { 905 console.info(TAG, 'testConnectDeviceParamErr023 catch err code: ', err.code, ', message: ', err.message); 906 expect(err.code).assertEqual(PARAM_ERRCODE); 907 } 908 }) 909 910 /** 911 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3500 912 * @tc.name : testConnectDeviceParamErr024 913 * @tc.desc : Negative test: devices version is undefined 914 * @tc.size : MediumTest 915 * @tc.type : Function 916 * @tc.level : Level 3 917 */ 918 it('testConnectDeviceParamErr024', 0, function () { 919 console.info(TAG, 'usb testConnectDeviceParamErr024 begin'); 920 if (!isDeviceConnected) { 921 expect(isDeviceConnected).assertFalse(); 922 return 923 } 924 try { 925 devices.version = PARAM_UNDEFINED; 926 let ret = usbManager.connectDevice(devices); 927 console.info(TAG, 'usb [version:undefined] connectDevice ret : ', JSON.stringify(ret)); 928 expect(ret !== null).assertFalse(); 929 } catch (err) { 930 console.info(TAG, 'testConnectDeviceParamErr024 catch err code: ', err.code, ', message: ', err.message); 931 expect(err.code).assertEqual(PARAM_ERRCODE); 932 } 933 }) 934 935 /** 936 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3600 937 * @tc.name : testConnectDeviceParamErr025 938 * @tc.desc : Negative test: devices vendorId is null 939 * @tc.size : MediumTest 940 * @tc.type : Function 941 * @tc.level : Level 3 942 */ 943 it('testConnectDeviceParamErr025', 0, function () { 944 console.info(TAG, 'usb testConnectDeviceParamErr025 begin'); 945 if (!isDeviceConnected) { 946 expect(isDeviceConnected).assertFalse(); 947 return 948 } 949 try { 950 devices.vendorId = PARAM_NULL; 951 let ret = usbManager.connectDevice(devices); 952 console.info(TAG, 'usb [vendorId:null] connectDevice ret : ', JSON.stringify(ret)); 953 expect(ret !== null).assertFalse(); 954 } catch (err) { 955 console.info(TAG, 'testConnectDeviceParamErr025 catch err code: ', err.code, ', message: ', err.message); 956 expect(err.code).assertEqual(PARAM_ERRCODE); 957 } 958 }) 959 960 /** 961 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3700 962 * @tc.name : testConnectDeviceParamErr026 963 * @tc.desc : Negative test: devices vendorId is undefined 964 * @tc.size : MediumTest 965 * @tc.type : Function 966 * @tc.level : Level 3 967 */ 968 it('testConnectDeviceParamErr026', 0, function () { 969 console.info(TAG, 'usb testConnectDeviceParamErr026 begin'); 970 if (!isDeviceConnected) { 971 expect(isDeviceConnected).assertFalse(); 972 return 973 } 974 try { 975 devices.vendorId = PARAM_UNDEFINED; 976 let ret = usbManager.connectDevice(devices); 977 console.info(TAG, 'usb [vendorId:undefined] connectDevice ret : ', JSON.stringify(ret)); 978 expect(ret !== null).assertFalse(); 979 } catch (err) { 980 console.info(TAG, 'testConnectDeviceParamErr026 catch err code: ', err.code, ', message: ', err.message); 981 expect(err.code).assertEqual(PARAM_ERRCODE); 982 } 983 }) 984 985 /** 986 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3800 987 * @tc.name : testConnectDeviceParamErr027 988 * @tc.desc : Negative test: devices vendorId is null string "" 989 * @tc.size : MediumTest 990 * @tc.type : Function 991 * @tc.level : Level 3 992 */ 993 it('testConnectDeviceParamErr027', 0, function () { 994 console.info(TAG, 'usb testConnectDeviceParamErr027 begin'); 995 if (!isDeviceConnected) { 996 expect(isDeviceConnected).assertFalse(); 997 return 998 } 999 try { 1000 devices.vendorId = PARAM_NULLSTRING; 1001 let ret = usbManager.connectDevice(devices); 1002 console.info(TAG, 'usb [vendorId:""] connectDevice ret : ', JSON.stringify(ret)); 1003 expect(ret !== null).assertFalse(); 1004 } catch (err) { 1005 console.info(TAG, 'testConnectDeviceParamErr027 catch err code: ', err.code, ', message: ', err.message); 1006 expect(err.code).assertEqual(PARAM_ERRCODE); 1007 } 1008 }) 1009 1010 /** 1011 * @tc.number : SUB_USB_HostManager_JS_ParamErr_3900 1012 * @tc.name : testConnectDeviceParamErr028 1013 * @tc.desc : Negative test: devices productId is null 1014 * @tc.size : MediumTest 1015 * @tc.type : Function 1016 * @tc.level : Level 3 1017 */ 1018 it('testConnectDeviceParamErr028', 0, function () { 1019 console.info(TAG, 'usb testConnectDeviceParamErr028 begin'); 1020 if (!isDeviceConnected) { 1021 expect(isDeviceConnected).assertFalse(); 1022 return 1023 } 1024 try { 1025 devices.productId = PARAM_NULL; 1026 let ret = usbManager.connectDevice(devices); 1027 console.info(TAG, 'usb [productId:null] connectDevice ret : ', JSON.stringify(ret)); 1028 expect(ret !== null).assertFalse(); 1029 } catch (err) { 1030 console.info(TAG, 'testConnectDeviceParamErr028 catch err code: ', err.code, ', message: ', err.message); 1031 expect(err.code).assertEqual(PARAM_ERRCODE); 1032 } 1033 }) 1034 1035 /** 1036 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4000 1037 * @tc.name : testConnectDeviceParamErr029 1038 * @tc.desc : Negative test: devices productId is undefined 1039 * @tc.size : MediumTest 1040 * @tc.type : Function 1041 * @tc.level : Level 3 1042 */ 1043 it('testConnectDeviceParamErr029', 0, function () { 1044 console.info(TAG, 'usb testConnectDeviceParamErr029 begin'); 1045 if (!isDeviceConnected) { 1046 expect(isDeviceConnected).assertFalse(); 1047 return 1048 } 1049 try { 1050 devices.productId = PARAM_UNDEFINED; 1051 let ret = usbManager.connectDevice(devices); 1052 console.info(TAG, 'usb [productId:undefined] connectDevice ret : ', JSON.stringify(ret)); 1053 expect(ret !== null).assertFalse(); 1054 } catch (err) { 1055 console.info(TAG, 'testConnectDeviceParamErr029 catch err code: ', err.code, ', message: ', err.message); 1056 expect(err.code).assertEqual(PARAM_ERRCODE); 1057 } 1058 }) 1059 1060 /** 1061 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4100 1062 * @tc.name : testConnectDeviceParamErr030 1063 * @tc.desc : Negative test: devices productId is null string "" 1064 * @tc.size : MediumTest 1065 * @tc.type : Function 1066 * @tc.level : Level 3 1067 */ 1068 it('testConnectDeviceParamErr030', 0, function () { 1069 console.info(TAG, 'usb testConnectDeviceParamErr030 begin'); 1070 if (!isDeviceConnected) { 1071 expect(isDeviceConnected).assertFalse(); 1072 return 1073 } 1074 try { 1075 devices.productId = PARAM_NULLSTRING; 1076 let ret = usbManager.connectDevice(devices); 1077 console.info(TAG, 'usb [productId:" "] connectDevice ret : ', JSON.stringify(ret)); 1078 expect(ret !== null).assertFalse(); 1079 } catch (err) { 1080 console.info(TAG, 'testConnectDeviceParamErr030 catch err code: ', err.code, ', message: ', err.message); 1081 expect(err.code).assertEqual(PARAM_ERRCODE); 1082 } 1083 }) 1084 1085 /** 1086 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4200 1087 * @tc.name : testConnectDeviceParamErr031 1088 * @tc.desc : Negative test: devices clazz is null 1089 * @tc.size : MediumTest 1090 * @tc.type : Function 1091 * @tc.level : Level 3 1092 */ 1093 it('testConnectDeviceParamErr031', 0, function () { 1094 console.info(TAG, 'usb testConnectDeviceParamErr031 begin'); 1095 if (!isDeviceConnected) { 1096 expect(isDeviceConnected).assertFalse(); 1097 return 1098 } 1099 try { 1100 devices.clazz = PARAM_NULL; 1101 let ret = usbManager.connectDevice(devices); 1102 console.info(TAG, 'usb [clazz:null] connectDevice ret : ', JSON.stringify(ret)); 1103 expect(ret !== null).assertFalse(); 1104 } catch (err) { 1105 console.info(TAG, 'testConnectDeviceParamErr031 catch err code: ', err.code, ', message: ', err.message); 1106 expect(err.code).assertEqual(PARAM_ERRCODE); 1107 } 1108 }) 1109 1110 /** 1111 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4300 1112 * @tc.name : testConnectDeviceParamErr032 1113 * @tc.desc : Negative test: devices clazz is undefined 1114 * @tc.size : MediumTest 1115 * @tc.type : Function 1116 * @tc.level : Level 3 1117 */ 1118 it('testConnectDeviceParamErr032', 0, function () { 1119 console.info(TAG, 'usb testConnectDeviceParamErr032 begin'); 1120 if (!isDeviceConnected) { 1121 expect(isDeviceConnected).assertFalse(); 1122 return 1123 } 1124 try { 1125 devices.clazz = PARAM_UNDEFINED; 1126 let ret = usbManager.connectDevice(devices); 1127 console.info(TAG, 'usb [clazz:undefined] connectDevice ret : ', JSON.stringify(ret)); 1128 expect(ret !== null).assertFalse(); 1129 } catch (err) { 1130 console.info(TAG, 'testConnectDeviceParamErr032 catch err code: ', err.code, ', message: ', err.message); 1131 expect(err.code).assertEqual(PARAM_ERRCODE); 1132 } 1133 }) 1134 1135 /** 1136 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4400 1137 * @tc.name : testConnectDeviceParamErr033 1138 * @tc.desc : Negative test: devices clazz is null string "" 1139 * @tc.size : MediumTest 1140 * @tc.type : Function 1141 * @tc.level : Level 3 1142 */ 1143 it('testConnectDeviceParamErr033', 0, function () { 1144 console.info(TAG, 'usb testConnectDeviceParamErr033 begin'); 1145 if (!isDeviceConnected) { 1146 expect(isDeviceConnected).assertFalse(); 1147 return 1148 } 1149 try { 1150 devices.clazz = PARAM_NULLSTRING; 1151 let ret = usbManager.connectDevice(devices); 1152 console.info(TAG, 'usb [clazz:""] connectDevice ret : ', JSON.stringify(ret)); 1153 expect(ret !== null).assertFalse(); 1154 } catch (err) { 1155 console.info(TAG, 'testConnectDeviceParamErr033 catch err code: ', err.code, ', message: ', err.message); 1156 expect(err.code).assertEqual(PARAM_ERRCODE); 1157 } 1158 }) 1159 1160 /** 1161 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4500 1162 * @tc.name : testConnectDeviceParamErr034 1163 * @tc.desc : Negative test: devices subClass is null 1164 * @tc.size : MediumTest 1165 * @tc.type : Function 1166 * @tc.level : Level 3 1167 */ 1168 it('testConnectDeviceParamErr034', 0, function () { 1169 console.info(TAG, 'usb testConnectDeviceParamErr034 begin'); 1170 if (!isDeviceConnected) { 1171 expect(isDeviceConnected).assertFalse(); 1172 return 1173 } 1174 try { 1175 devices.subClass = PARAM_NULL; 1176 let ret = usbManager.connectDevice(devices); 1177 console.info(TAG, 'usb [subClass:null] connectDevice ret : ', JSON.stringify(ret)); 1178 expect(ret !== null).assertFalse(); 1179 } catch (err) { 1180 console.info(TAG, 'testConnectDeviceParamErr034 catch err code: ', err.code, ', message: ', err.message); 1181 expect(err.code).assertEqual(PARAM_ERRCODE); 1182 } 1183 }) 1184 1185 /** 1186 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4600 1187 * @tc.name : testConnectDeviceParamErr035 1188 * @tc.desc : Negative test: devices subClass is undefined 1189 * @tc.size : MediumTest 1190 * @tc.type : Function 1191 * @tc.level : Level 3 1192 */ 1193 it('testConnectDeviceParamErr035', 0, function () { 1194 console.info(TAG, 'usb testConnectDeviceParamErr035 begin'); 1195 if (!isDeviceConnected) { 1196 expect(isDeviceConnected).assertFalse(); 1197 return 1198 } 1199 try { 1200 devices.subClass = PARAM_UNDEFINED; 1201 let ret = usbManager.connectDevice(devices); 1202 console.info(TAG, 'usb [subClass:undefined] connectDevice ret : ', JSON.stringify(ret)); 1203 expect(ret !== null).assertFalse(); 1204 } catch (err) { 1205 console.info(TAG, 'testConnectDeviceParamErr035 catch err code: ', err.code, ', message: ', err.message); 1206 expect(err.code).assertEqual(PARAM_ERRCODE); 1207 } 1208 }) 1209 1210 /** 1211 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4700 1212 * @tc.name : testConnectDeviceParamErr036 1213 * @tc.desc : Negative test: devices subClass is null string "" 1214 * @tc.size : MediumTest 1215 * @tc.type : Function 1216 * @tc.level : Level 3 1217 */ 1218 it('testConnectDeviceParamErr036', 0, function () { 1219 console.info(TAG, 'usb testConnectDeviceParamErr036 begin'); 1220 if (!isDeviceConnected) { 1221 expect(isDeviceConnected).assertFalse(); 1222 return 1223 } 1224 try { 1225 devices.subClass = PARAM_NULLSTRING; 1226 let ret = usbManager.connectDevice(devices); 1227 console.info(TAG, 'usb [subClass:""] connectDevice ret : ', JSON.stringify(ret)); 1228 expect(ret !== null).assertFalse(); 1229 } catch (err) { 1230 console.info(TAG, 'testConnectDeviceParamErr036 catch err code: ', err.code, ', message: ', err.message); 1231 expect(err.code).assertEqual(PARAM_ERRCODE); 1232 } 1233 }) 1234 1235 /** 1236 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4800 1237 * @tc.name : testConnectDeviceParamErr037 1238 * @tc.desc : Negative test: devices protocol is null 1239 * @tc.size : MediumTest 1240 * @tc.type : Function 1241 * @tc.level : Level 3 1242 */ 1243 it('testConnectDeviceParamErr037', 0, function () { 1244 console.info(TAG, 'usb testConnectDeviceParamErr037 begin'); 1245 if (!isDeviceConnected) { 1246 expect(isDeviceConnected).assertFalse(); 1247 return 1248 } 1249 try { 1250 devices.protocol = PARAM_NULL; 1251 let ret = usbManager.connectDevice(devices); 1252 console.info(TAG, 'usb [protocol:null] connectDevice ret : ', JSON.stringify(ret)); 1253 expect(ret !== null).assertFalse(); 1254 } catch (err) { 1255 console.info(TAG, 'testConnectDeviceParamErr037 catch err code: ', err.code, ', message: ', err.message); 1256 expect(err.code).assertEqual(PARAM_ERRCODE); 1257 } 1258 }) 1259 1260 /** 1261 * @tc.number : SUB_USB_HostManager_JS_ParamErr_4900 1262 * @tc.name : testConnectDeviceParamErr038 1263 * @tc.desc : Negative test: devices protocol is undefined 1264 * @tc.size : MediumTest 1265 * @tc.type : Function 1266 * @tc.level : Level 3 1267 */ 1268 it('testConnectDeviceParamErr038', 0, function () { 1269 console.info(TAG, 'usb testConnectDeviceParamErr038 begin'); 1270 if (!isDeviceConnected) { 1271 expect(isDeviceConnected).assertFalse(); 1272 return 1273 } 1274 try { 1275 devices.protocol = PARAM_UNDEFINED; 1276 let ret = usbManager.connectDevice(devices); 1277 console.info(TAG, 'usb [protocol:undefined] connectDevice ret : ', JSON.stringify(ret)); 1278 expect(ret !== null).assertFalse(); 1279 } catch (err) { 1280 console.info(TAG, 'testConnectDeviceParamErr038 catch err code: ', err.code, ', message: ', err.message); 1281 expect(err.code).assertEqual(PARAM_ERRCODE); 1282 } 1283 }) 1284 1285 /** 1286 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5000 1287 * @tc.name : testConnectDeviceParamErr039 1288 * @tc.desc : Negative test: devices protocol is null string "" 1289 * @tc.size : MediumTest 1290 * @tc.type : Function 1291 * @tc.level : Level 3 1292 */ 1293 it('testConnectDeviceParamErr039', 0, function () { 1294 console.info(TAG, 'usb testConnectDeviceParamErr039 begin'); 1295 if (!isDeviceConnected) { 1296 expect(isDeviceConnected).assertFalse(); 1297 return 1298 } 1299 try { 1300 devices.protocol = PARAM_NULLSTRING; 1301 let ret = usbManager.connectDevice(devices); 1302 console.info(TAG, 'usb [protocol:""] connectDevice ret : ', JSON.stringify(ret)); 1303 expect(ret !== null).assertFalse(); 1304 } catch (err) { 1305 console.info(TAG, 'testConnectDeviceParamErr039 catch err code: ', err.code, ', message: ', err.message); 1306 expect(err.code).assertEqual(PARAM_ERRCODE); 1307 } 1308 }) 1309 1310 /** 1311 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5100 1312 * @tc.name : testConnectDeviceParamErr040 1313 * @tc.desc : Negative test: devices configs is null 1314 * @tc.size : MediumTest 1315 * @tc.type : Function 1316 * @tc.level : Level 3 1317 */ 1318 it('testConnectDeviceParamErr040', 0, function () { 1319 console.info(TAG, 'usb testConnectDeviceParamErr040 begin'); 1320 if (!isDeviceConnected) { 1321 expect(isDeviceConnected).assertFalse(); 1322 return 1323 } 1324 try { 1325 devices.configs = PARAM_NULL; 1326 let ret = usbManager.connectDevice(devices); 1327 console.info(TAG, 'usb [configs:null] connectDevice ret : ', JSON.stringify(ret)); 1328 expect(ret !== null).assertFalse(); 1329 } catch (err) { 1330 console.info(TAG, 'testConnectDeviceParamErr040 catch err code: ', err.code, ', message: ', err.message); 1331 expect(err.code).assertEqual(PARAM_ERRCODE); 1332 } 1333 }) 1334 1335 /** 1336 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5200 1337 * @tc.name : testConnectDeviceParamErr041 1338 * @tc.desc : Negative test: devices configs is undefined 1339 * @tc.size : MediumTest 1340 * @tc.type : Function 1341 * @tc.level : Level 3 1342 */ 1343 it('testConnectDeviceParamErr041', 0, function () { 1344 console.info(TAG, 'usb testConnectDeviceParamErr041 begin'); 1345 if (!isDeviceConnected) { 1346 expect(isDeviceConnected).assertFalse(); 1347 return 1348 } 1349 try { 1350 devices.configs = PARAM_UNDEFINED; 1351 let ret = usbManager.connectDevice(devices); 1352 console.info(TAG, 'usb [configs:undefined] connectDevice ret : ', JSON.stringify(ret)); 1353 expect(ret !== null).assertFalse(); 1354 } catch (err) { 1355 console.info(TAG, 'testConnectDeviceParamErr041 catch err code: ', err.code, ', message: ', err.message); 1356 expect(err.code).assertEqual(PARAM_ERRCODE); 1357 } 1358 }) 1359 1360 /** 1361 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5300 1362 * @tc.name : testConnectDeviceParamErr042 1363 * @tc.desc : Negative test: devices configs is null string "" 1364 * @tc.size : MediumTest 1365 * @tc.type : Function 1366 * @tc.level : Level 3 1367 */ 1368 it('testConnectDeviceParamErr042', 0, function () { 1369 console.info(TAG, 'usb testConnectDeviceParamErr042 begin'); 1370 if (!isDeviceConnected) { 1371 expect(isDeviceConnected).assertFalse(); 1372 return 1373 } 1374 try { 1375 devices.configs = PARAM_NULLSTRING; 1376 let ret = usbManager.connectDevice(devices); 1377 console.info(TAG, 'usb [configs:""] connectDevice ret : ', JSON.stringify(ret)); 1378 expect(ret !== null).assertFalse(); 1379 } catch (err) { 1380 console.info(TAG, 'testConnectDeviceParamErr042 catch err code: ', err.code, ', message: ', err.message); 1381 expect(err.code).assertEqual(PARAM_ERRCODE); 1382 } 1383 }) 1384 1385 /** 1386 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5400 1387 * @tc.name : testConnectDeviceParamErr043 1388 * @tc.desc : Negative test: devices configs is number 123 1389 * @tc.size : MediumTest 1390 * @tc.type : Function 1391 * @tc.level : Level 3 1392 */ 1393 it('testConnectDeviceParamErr043', 0, function () { 1394 console.info(TAG, 'usb testConnectDeviceParamErr043 begin'); 1395 if (!isDeviceConnected) { 1396 expect(isDeviceConnected).assertFalse(); 1397 return 1398 } 1399 try { 1400 devices.configs = PARAM_NULLSTRING; 1401 let ret = usbManager.connectDevice(devices); 1402 console.info(TAG, 'usb [configs:123] connectDevice ret : ', JSON.stringify(ret)); 1403 expect(ret !== null).assertFalse(); 1404 } catch (err) { 1405 console.info(TAG, 'testConnectDeviceParamErr043 catch err code: ', err.code, ', message: ', err.message); 1406 expect(err.code).assertEqual(PARAM_ERRCODE); 1407 } 1408 }) 1409 1410 /** 1411 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5500 1412 * @tc.name : testClosePipeParamErr001 1413 * @tc.desc : Negative test: Enter two parameters 1414 * @tc.size : MediumTest 1415 * @tc.type : Function 1416 * @tc.level : Level 3 1417 */ 1418 it('testClosePipeParamErr001', 0, function () { 1419 console.info(TAG, 'usb testClosePipeParamErr001 begin'); 1420 if (!isDeviceConnected) { 1421 expect(isDeviceConnected).assertFalse(); 1422 return 1423 } 1424 getPipe('testClosePipeParamErr001'); 1425 try { 1426 let ret = usbManager.closePipe(gPipe, gPipe); 1427 console.info(TAG, 'usb Enter two parameters closePipe ret : ', ret); 1428 expect(ret).assertEqual(0); 1429 } catch (err) { 1430 console.info(TAG, 'testClosePipeParamErr001 catch err : ', err.code, ', message: ', err.message); 1431 expect(err !== null).assertFalse(); 1432 } 1433 }) 1434 1435 /** 1436 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5600 1437 * @tc.name : testClosePipeParamErr002 1438 * @tc.desc : Negative test: pipe busNum is null 1439 * @tc.size : MediumTest 1440 * @tc.type : Function 1441 * @tc.level : Level 3 1442 */ 1443 it('testClosePipeParamErr002', 0, function () { 1444 console.info(TAG, 'usb testClosePipeParamErr002 begin'); 1445 if (!isDeviceConnected) { 1446 expect(isDeviceConnected).assertFalse(); 1447 return 1448 } 1449 try { 1450 gPipe.busNum = PARAM_NULL; 1451 let ret = usbManager.closePipe(gPipe); 1452 console.info(TAG, 'usb [busNum:null] closePipe ret : ', ret); 1453 expect(ret !== null).assertFalse(); 1454 } catch (err) { 1455 console.info(TAG, 'testClosePipeParamErr002 catch err code: ', err.code, ', message: ', err.message); 1456 expect(err.code).assertEqual(PARAM_ERRCODE); 1457 } 1458 }) 1459 1460 /** 1461 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5700 1462 * @tc.name : testClosePipeParamErr003 1463 * @tc.desc : Negative test: pipe busNum is undefined 1464 * @tc.size : MediumTest 1465 * @tc.type : Function 1466 * @tc.level : Level 3 1467 */ 1468 it('testClosePipeParamErr003', 0, function () { 1469 console.info(TAG, 'usb testClosePipeParamErr003 begin'); 1470 if (!isDeviceConnected) { 1471 expect(isDeviceConnected).assertFalse(); 1472 return 1473 } 1474 try { 1475 gPipe.busNum = PARAM_UNDEFINED; 1476 let ret = usbManager.closePipe(gPipe); 1477 console.info(TAG, 'usb [busNum:undefined] closePipe ret : ', ret); 1478 expect(ret !== null).assertFalse(); 1479 } catch (err) { 1480 console.info(TAG, 'testClosePipeParamErr003 catch err code: ', err.code, ', message: ', err.message); 1481 expect(err.code).assertEqual(PARAM_ERRCODE); 1482 } 1483 }) 1484 1485 /** 1486 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5800 1487 * @tc.name : testClosePipeParamErr004 1488 * @tc.desc : Negative test: pipe busNum is null string "" 1489 * @tc.size : MediumTest 1490 * @tc.type : Function 1491 * @tc.level : Level 3 1492 */ 1493 it('testClosePipeParamErr004', 0, function () { 1494 console.info(TAG, 'usb testClosePipeParamErr004 begin'); 1495 if (!isDeviceConnected) { 1496 expect(isDeviceConnected).assertFalse(); 1497 return 1498 } 1499 try { 1500 gPipe.busNum = PARAM_NULLSTRING; 1501 let ret = usbManager.closePipe(gPipe); 1502 console.info(TAG, 'usb [busNum:""] closePipe ret : ', ret); 1503 expect(ret !== null).assertFalse(); 1504 } catch (err) { 1505 console.info(TAG, 'testClosePipeParamErr004 catch err code: ', err.code, ', message: ', err.message); 1506 expect(err.code).assertEqual(PARAM_ERRCODE); 1507 } 1508 }) 1509 1510 /** 1511 * @tc.number : SUB_USB_HostManager_JS_ParamErr_5900 1512 * @tc.name : testClosePipeParamErr005 1513 * @tc.desc : Negative test: pipe devAddress is null 1514 * @tc.size : MediumTest 1515 * @tc.type : Function 1516 * @tc.level : Level 3 1517 */ 1518 it('testClosePipeParamErr005', 0, function () { 1519 console.info(TAG, 'usb testClosePipeParamErr005 begin'); 1520 if (!isDeviceConnected) { 1521 expect(isDeviceConnected).assertFalse(); 1522 return 1523 } 1524 try { 1525 gPipe.devAddress = PARAM_NULL; 1526 let ret = usbManager.closePipe(gPipe); 1527 console.info(TAG, 'usb [devAddress:null] closePipe ret : ', ret); 1528 expect(ret !== null).assertFalse(); 1529 } catch (err) { 1530 console.info(TAG, 'testClosePipeParamErr005 catch err code: ', err.code, ', message: ', err.message); 1531 expect(err.code).assertEqual(PARAM_ERRCODE); 1532 } 1533 }) 1534 1535 /** 1536 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6000 1537 * @tc.name : testClosePipeParamErr006 1538 * @tc.desc : Negative test: pipe devAddress is undefined 1539 * @tc.size : MediumTest 1540 * @tc.type : Function 1541 * @tc.level : Level 3 1542 */ 1543 it('testClosePipeParamErr006', 0, function () { 1544 console.info(TAG, 'usb testClosePipeParamErr006 begin'); 1545 if (!isDeviceConnected) { 1546 expect(isDeviceConnected).assertFalse(); 1547 return 1548 } 1549 try { 1550 gPipe.devAddress = PARAM_UNDEFINED; 1551 let ret = usbManager.closePipe(gPipe); 1552 console.info(TAG, 'usb [devAddress:undefined] closePipe ret : ', ret); 1553 expect(ret !== null).assertFalse(); 1554 } catch (err) { 1555 console.info(TAG, 'testClosePipeParamErr006 catch err code: ', err.code, ', message: ', err.message); 1556 expect(err.code).assertEqual(PARAM_ERRCODE); 1557 } 1558 }) 1559 1560 /** 1561 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6100 1562 * @tc.name : testClosePipeParamErr007 1563 * @tc.desc : Negative test: devices devAddress is null string "" 1564 * @tc.size : MediumTest 1565 * @tc.type : Function 1566 * @tc.level : Level 3 1567 */ 1568 it('testClosePipeParamErr007', 0, function () { 1569 console.info(TAG, 'usb testClosePipeParamErr007 begin'); 1570 if (!isDeviceConnected) { 1571 expect(isDeviceConnected).assertFalse(); 1572 return 1573 } 1574 try { 1575 gPipe.devAddress = PARAM_NULLSTRING; 1576 let ret = usbManager.closePipe(gPipe); 1577 console.info(TAG, 'usb [devAddress:""] closePipe ret : ', ret); 1578 expect(ret !== null).assertFalse(); 1579 } catch (err) { 1580 console.info(TAG, 'testClosePipeParamErr007 catch err code: ', err.code, ', message: ', err.message); 1581 expect(err.code).assertEqual(PARAM_ERRCODE); 1582 } 1583 }) 1584 1585 /** 1586 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6200 1587 * @tc.name : testClosePipeParamErr008 1588 * @tc.desc : Negative test: Param is null 1589 * @tc.size : MediumTest 1590 * @tc.type : Function 1591 * @tc.level : Level 3 1592 */ 1593 it('testClosePipeParamErr008', 0, function () { 1594 console.info(TAG, 'usb testClosePipeParamErr008 begin'); 1595 if (!isDeviceConnected) { 1596 expect(isDeviceConnected).assertFalse(); 1597 return 1598 } 1599 try { 1600 let ret = usbManager.closePipe(PARAM_NULL); 1601 console.info(TAG, 'usb [param:null] closePipe ret : ', ret); 1602 expect(ret !== null).assertFalse(); 1603 } catch (err) { 1604 console.info(TAG, 'testClosePipeParamErr008 catch err code: ', err.code, ', message: ', err.message); 1605 expect(err.code).assertEqual(PARAM_ERRCODE); 1606 } 1607 }) 1608 1609 /** 1610 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6300 1611 * @tc.name : testClosePipeParamErr009 1612 * @tc.desc : Negative test: Param is undefined 1613 * @tc.size : MediumTest 1614 * @tc.type : Function 1615 * @tc.level : Level 3 1616 */ 1617 it('testClosePipeParamErr009', 0, function () { 1618 console.info(TAG, 'usb testClosePipeParamErr009 begin'); 1619 if (!isDeviceConnected) { 1620 expect(isDeviceConnected).assertFalse(); 1621 return 1622 } 1623 try { 1624 let ret = usbManager.closePipe(PARAM_UNDEFINED); 1625 console.info(TAG, 'usb [param:undefined] closePipe ret : ', ret); 1626 expect(ret !== null).assertFalse(); 1627 } catch (err) { 1628 console.info(TAG, 'testClosePipeParamErr009 catch err code: ', err.code, ', message: ', err.message); 1629 expect(err.code).assertEqual(PARAM_ERRCODE); 1630 } 1631 }) 1632 1633 /** 1634 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6400 1635 * @tc.name : testClosePipeParamErr010 1636 * @tc.desc : Negative test: Param is null string "" 1637 * @tc.size : MediumTest 1638 * @tc.type : Function 1639 * @tc.level : Level 3 1640 */ 1641 it('testClosePipeParamErr010', 0, function () { 1642 console.info(TAG, 'usb testClosePipeParamErr010 begin'); 1643 if (!isDeviceConnected) { 1644 expect(isDeviceConnected).assertFalse(); 1645 return 1646 } 1647 try { 1648 let ret = usbManager.closePipe(PARAM_NULLSTRING); 1649 console.info(TAG, 'usb [param:""] closePipe ret : ', ret); 1650 expect(ret !== null).assertFalse(); 1651 } catch (err) { 1652 console.info(TAG, 'testClosePipeParamErr010 catch err code: ', err.code, ', message: ', err.message); 1653 expect(err.code).assertEqual(PARAM_ERRCODE); 1654 } 1655 }) 1656 1657 /** 1658 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6500 1659 * @tc.name : testGetRawDescriptorParamErr001 1660 * @tc.desc : Negative test: Enter two parameters 1661 * @tc.size : MediumTest 1662 * @tc.type : Function 1663 * @tc.level : Level 3 1664 */ 1665 it('testGetRawDescriptorParamErr001', 0, function () { 1666 console.info(TAG, 'usb testGetRawDescriptorParamErr001 begin'); 1667 if (!isDeviceConnected) { 1668 expect(isDeviceConnected).assertFalse(); 1669 return 1670 } 1671 getPipe('testGetRawDescriptorParamErr001'); 1672 try { 1673 let ret = usbManager.getRawDescriptor(gPipe, gPipe); 1674 console.info(TAG, 'usb Enter two parameters getRawDescriptor ret : ', JSON.stringify(ret)); 1675 expect(ret.length >= 0).assertTrue(); 1676 } catch (err) { 1677 console.info(TAG, 'testGetRawDescriptorParamErr001 catch err code: ', err.code, ', message: ', err.message); 1678 expect(err !== null).assertFalse(); 1679 } 1680 toClosePipe('testGetRawDescriptorParamErr001'); 1681 }) 1682 1683 /** 1684 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6600 1685 * @tc.name : testGetRawDescriptorParamErr002 1686 * @tc.desc : Negative test: Param is null 1687 * @tc.size : MediumTest 1688 * @tc.type : Function 1689 * @tc.level : Level 3 1690 */ 1691 it('testGetRawDescriptorParamErr002', 0, function () { 1692 console.info(TAG, 'usb testGetRawDescriptorParamErr002 begin'); 1693 if (!isDeviceConnected) { 1694 expect(isDeviceConnected).assertFalse(); 1695 return 1696 } 1697 try { 1698 let ret = usbManager.getRawDescriptor(PARAM_NULL); 1699 console.info(TAG, 'usb [param:null] getRawDescriptor ret : ', JSON.stringify(ret)); 1700 expect(ret !== null).assertFalse(); 1701 } catch (err) { 1702 console.info(TAG, 'testGetRawDescriptorParamErr002 catch err code: ', err.code, ', message: ', err.message); 1703 expect(err.code).assertEqual(PARAM_ERRCODE); 1704 } 1705 }) 1706 1707 /** 1708 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6700 1709 * @tc.name : testGetRawDescriptorParamErr003 1710 * @tc.desc : Negative test: Param is undefined 1711 * @tc.size : MediumTest 1712 * @tc.type : Function 1713 * @tc.level : Level 3 1714 */ 1715 it('testGetRawDescriptorParamErr003', 0, function () { 1716 console.info(TAG, 'usb testGetRawDescriptorParamErr003 begin'); 1717 if (!isDeviceConnected) { 1718 expect(isDeviceConnected).assertFalse(); 1719 return 1720 } 1721 try { 1722 let ret = usbManager.getRawDescriptor(PARAM_UNDEFINED); 1723 console.info(TAG, 'usb [param:undefined] getRawDescriptor ret : ', JSON.stringify(ret)); 1724 expect(ret !== null).assertFalse(); 1725 } catch (err) { 1726 console.info(TAG, 'testGetRawDescriptorParamErr003 catch err code: ', err.code, ', message: ', err.message); 1727 expect(err.code).assertEqual(PARAM_ERRCODE); 1728 } 1729 }) 1730 1731 /** 1732 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6800 1733 * @tc.name : testGetRawDescriptorParamErr004 1734 * @tc.desc : Negative test: Param is null string "" 1735 * @tc.size : MediumTest 1736 * @tc.type : Function 1737 * @tc.level : Level 3 1738 */ 1739 it('testGetRawDescriptorParamErr004', 0, function () { 1740 console.info(TAG, 'usb testGetRawDescriptorParamErr004 begin'); 1741 if (!isDeviceConnected) { 1742 expect(isDeviceConnected).assertFalse(); 1743 return 1744 } 1745 try { 1746 let ret = usbManager.getRawDescriptor(PARAM_NULLSTRING); 1747 console.info(TAG, 'usb [param:""] getRawDescriptor ret : ', JSON.stringify(ret)); 1748 expect(ret !== null).assertFalse(); 1749 } catch (err) { 1750 console.info(TAG, 'testGetRawDescriptorParamErr004 catch err code: ', err.code, ', message: ', err.message); 1751 expect(err.code).assertEqual(PARAM_ERRCODE); 1752 } 1753 }) 1754 1755 /** 1756 * @tc.number : SUB_USB_HostManager_JS_ParamErr_6900 1757 * @tc.name : testGetRawDescriptorParamErr005 1758 * @tc.desc : Negative test: pipe busNum is null 1759 * @tc.size : MediumTest 1760 * @tc.type : Function 1761 * @tc.level : Level 3 1762 */ 1763 it('testGetRawDescriptorParamErr005', 0, function () { 1764 console.info(TAG, 'usb testGetRawDescriptorParamErr005 begin'); 1765 if (!isDeviceConnected) { 1766 expect(isDeviceConnected).assertFalse(); 1767 return 1768 } 1769 try { 1770 gPipe.busNum = PARAM_NULL; 1771 let ret = usbManager.getRawDescriptor(gPipe); 1772 console.info(TAG, 'usb [busNum:null] getRawDescriptor ret : ', JSON.stringify(ret)); 1773 expect(ret !== null).assertFalse(); 1774 } catch (err) { 1775 console.info(TAG, 'testGetRawDescriptorParamErr005 catch err code: ', err.code, ', message: ', err.message); 1776 expect(err.code).assertEqual(PARAM_ERRCODE); 1777 } 1778 }) 1779 1780 /** 1781 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7000 1782 * @tc.name : testGetRawDescriptorParamErr006 1783 * @tc.desc : Negative test: pipe busNum is undefined 1784 * @tc.size : MediumTest 1785 * @tc.type : Function 1786 * @tc.level : Level 3 1787 */ 1788 it('testGetRawDescriptorParamErr006', 0, function () { 1789 console.info(TAG, 'usb testGetRawDescriptorParamErr006 begin'); 1790 if (!isDeviceConnected) { 1791 expect(isDeviceConnected).assertFalse(); 1792 return 1793 } 1794 try { 1795 gPipe.busNum = PARAM_UNDEFINED; 1796 let ret = usbManager.getRawDescriptor(gPipe); 1797 console.info(TAG, 'usb [busNum:undefined] getRawDescriptor ret : ', JSON.stringify(ret)); 1798 expect(ret !== null).assertFalse(); 1799 } catch (err) { 1800 console.info(TAG, 'testGetRawDescriptorParamErr006 catch err code: ', err.code, ', message: ', err.message); 1801 expect(err.code).assertEqual(PARAM_ERRCODE); 1802 } 1803 }) 1804 1805 /** 1806 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7100 1807 * @tc.name : testGetRawDescriptorParamErr007 1808 * @tc.desc : Negative test: pipe busNum is null string "" 1809 * @tc.size : MediumTest 1810 * @tc.type : Function 1811 * @tc.level : Level 3 1812 */ 1813 it('testGetRawDescriptorParamErr007', 0, function () { 1814 console.info(TAG, 'usb testGetRawDescriptorParamErr007 begin'); 1815 if (!isDeviceConnected) { 1816 expect(isDeviceConnected).assertFalse(); 1817 return 1818 } 1819 try { 1820 gPipe.busNum = PARAM_NULLSTRING; 1821 let ret = usbManager.getRawDescriptor(gPipe); 1822 console.info(TAG, 'usb [busNum:""] getRawDescriptor ret : ', JSON.stringify(ret)); 1823 expect(ret !== null).assertFalse(); 1824 } catch (err) { 1825 console.info(TAG, 'testGetRawDescriptorParamErr007 catch err code: ', err.code, ', message: ', err.message); 1826 expect(err.code).assertEqual(PARAM_ERRCODE); 1827 } 1828 }) 1829 1830 /** 1831 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7200 1832 * @tc.name : testGetRawDescriptorParamErr008 1833 * @tc.desc : Negative test: pipe devAddress is null 1834 * @tc.size : MediumTest 1835 * @tc.type : Function 1836 * @tc.level : Level 3 1837 */ 1838 it('testGetRawDescriptorParamErr008', 0, function () { 1839 console.info(TAG, 'usb testGetRawDescriptorParamErr008 begin'); 1840 if (!isDeviceConnected) { 1841 expect(isDeviceConnected).assertFalse(); 1842 return 1843 } 1844 try { 1845 gPipe.devAddress = PARAM_NULL; 1846 let ret = usbManager.getRawDescriptor(gPipe); 1847 console.info(TAG, 'usb [devAddress:null] getRawDescriptor ret : ', JSON.stringify(ret)); 1848 expect(ret !== null).assertFalse(); 1849 } catch (err) { 1850 console.info(TAG, 'testGetRawDescriptorParamErr008 catch err code: ', err.code, ', message: ', err.message); 1851 expect(err.code).assertEqual(PARAM_ERRCODE); 1852 } 1853 }) 1854 1855 /** 1856 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7300 1857 * @tc.name : testGetRawDescriptorParamErr009 1858 * @tc.desc : Negative test: pipe devAddress is undefined 1859 * @tc.size : MediumTest 1860 * @tc.type : Function 1861 * @tc.level : Level 3 1862 */ 1863 it('testGetRawDescriptorParamErr009', 0, function () { 1864 console.info(TAG, 'usb testGetRawDescriptorParamErr009 begin'); 1865 if (!isDeviceConnected) { 1866 expect(isDeviceConnected).assertFalse(); 1867 return 1868 } 1869 try { 1870 gPipe.devAddress = PARAM_UNDEFINED; 1871 let ret = usbManager.getRawDescriptor(gPipe); 1872 console.info(TAG, 'usb [devAddress:undefined] getRawDescriptor ret : ', JSON.stringify(ret)); 1873 expect(ret !== null).assertFalse(); 1874 } catch (err) { 1875 console.info(TAG, 'testGetRawDescriptorParamErr009 catch err code: ', err.code, ', message: ', err.message); 1876 expect(err.code).assertEqual(PARAM_ERRCODE); 1877 } 1878 }) 1879 1880 /** 1881 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7400 1882 * @tc.name : testGetRawDescriptorParamErr010 1883 * @tc.desc : Negative test: devices devAddress is null string "" 1884 * @tc.size : MediumTest 1885 * @tc.type : Function 1886 * @tc.level : Level 3 1887 */ 1888 it('testGetRawDescriptorParamErr010', 0, function () { 1889 console.info(TAG, 'usb testGetRawDescriptorParamErr010 begin'); 1890 if (!isDeviceConnected) { 1891 expect(isDeviceConnected).assertFalse(); 1892 return 1893 } 1894 try { 1895 gPipe.devAddress = PARAM_NULLSTRING; 1896 let ret = usbManager.getRawDescriptor(gPipe); 1897 console.info(TAG, 'usb [devAddress:""] getRawDescriptor ret : ', JSON.stringify(ret)); 1898 expect(ret !== null).assertFalse(); 1899 } catch (err) { 1900 console.info(TAG, 'testGetRawDescriptorParamErr010 catch err code: ', err.code, ', message: ', err.message); 1901 expect(err.code).assertEqual(PARAM_ERRCODE); 1902 } 1903 }) 1904 1905 /** 1906 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7500 1907 * @tc.name : testGetFileDescriptorParamErr001 1908 * @tc.desc : Negative test: Enter two parameters 1909 * @tc.size : MediumTest 1910 * @tc.type : Function 1911 * @tc.level : Level 3 1912 */ 1913 it('testGetFileDescriptorParamErr001', 0, function () { 1914 console.info(TAG, 'usb testGetFileDescriptorParamErr001 begin'); 1915 if (!isDeviceConnected) { 1916 expect(isDeviceConnected).assertFalse(); 1917 return 1918 } 1919 getPipe('testGetRawDescriptorParamErr001'); 1920 try { 1921 let ret = usbManager.getFileDescriptor(gPipe, gPipe); 1922 console.info(TAG, 'usb Enter two parameters getFileDescriptor ret : ', ret); 1923 expect(ret >= 0).assertTrue(); 1924 } catch (err) { 1925 console.info(TAG, 'testGetFileDescriptorParamErr001 catch err code: ', 1926 err.code, ', message: ', err.message); 1927 expect(err !== null).assertFalse(); 1928 } 1929 toClosePipe('testGetRawDescriptorParamErr001'); 1930 }) 1931 1932 /** 1933 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7600 1934 * @tc.name : testGetFileDescriptorParamErr002 1935 * @tc.desc : Negative test: Param is null 1936 * @tc.size : MediumTest 1937 * @tc.type : Function 1938 * @tc.level : Level 3 1939 */ 1940 it('testGetFileDescriptorParamErr002', 0, function () { 1941 console.info(TAG, 'usb testGetFileDescriptorParamErr002 begin'); 1942 if (!isDeviceConnected) { 1943 expect(isDeviceConnected).assertFalse(); 1944 return 1945 } 1946 try { 1947 let ret = usbManager.getFileDescriptor(PARAM_NULL); 1948 console.info(TAG, 'usb [param:null] getFileDescriptor ret : ', ret); 1949 expect(ret !== null).assertFalse(); 1950 } catch (err) { 1951 console.info(TAG, 'testGetFileDescriptorParamErr002 catch err code: ', 1952 err.code, ', message: ', err.message); 1953 expect(err.code).assertEqual(PARAM_ERRCODE); 1954 } 1955 }) 1956 1957 /** 1958 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7700 1959 * @tc.name : testGetFileDescriptorParamErr003 1960 * @tc.desc : Negative test: Param is undefined 1961 * @tc.size : MediumTest 1962 * @tc.type : Function 1963 * @tc.level : Level 3 1964 */ 1965 it('testGetFileDescriptorParamErr003', 0, function () { 1966 console.info(TAG, 'usb testGetFileDescriptorParamErr003 begin'); 1967 if (!isDeviceConnected) { 1968 expect(isDeviceConnected).assertFalse(); 1969 return 1970 } 1971 try { 1972 let ret = usbManager.getFileDescriptor(PARAM_UNDEFINED); 1973 console.info(TAG, 'usb [param:undefined] getFileDescriptor ret : ', ret); 1974 expect(ret !== null).assertFalse(); 1975 } catch (err) { 1976 console.info(TAG, 'testGetFileDescriptorParamErr003 catch err code: ', 1977 err.code, ', message: ', err.message); 1978 expect(err.code).assertEqual(PARAM_ERRCODE); 1979 } 1980 }) 1981 1982 /** 1983 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7800 1984 * @tc.name : testGetFileDescriptorParamErr004 1985 * @tc.desc : Negative test: Param is null string "" 1986 * @tc.size : MediumTest 1987 * @tc.type : Function 1988 * @tc.level : Level 3 1989 */ 1990 it('testGetFileDescriptorParamErr004', 0, function () { 1991 console.info(TAG, 'usb testGetFileDescriptorParamErr004 begin'); 1992 if (!isDeviceConnected) { 1993 expect(isDeviceConnected).assertFalse(); 1994 return 1995 } 1996 try { 1997 let ret = usbManager.getFileDescriptor(PARAM_NULLSTRING); 1998 console.info(TAG, 'usb [param:""] getFileDescriptor ret : ', ret); 1999 expect(ret !== null).assertFalse(); 2000 } catch (err) { 2001 console.info(TAG, 'testGetFileDescriptorParamErr004 catch err code: ', 2002 err.code, ', message: ', err.message); 2003 expect(err.code).assertEqual(PARAM_ERRCODE); 2004 } 2005 }) 2006 2007 /** 2008 * @tc.number : SUB_USB_HostManager_JS_ParamErr_7900 2009 * @tc.name : testGetFileDescriptorParamErr005 2010 * @tc.desc : Negative test: pipe busNum is null 2011 * @tc.size : MediumTest 2012 * @tc.type : Function 2013 * @tc.level : Level 3 2014 */ 2015 it('testGetFileDescriptorParamErr005', 0, function () { 2016 console.info(TAG, 'usb testGetFileDescriptorParamErr005 begin'); 2017 if (!isDeviceConnected) { 2018 expect(isDeviceConnected).assertFalse(); 2019 return 2020 } 2021 try { 2022 gPipe.busNum = PARAM_NULL; 2023 let ret = usbManager.getFileDescriptor(gPipe); 2024 console.info(TAG, 'usb [busNum:null] getFileDescriptor ret : ', ret); 2025 expect(ret !== null).assertFalse(); 2026 } catch (err) { 2027 console.info(TAG, 'testGetFileDescriptorParamErr005 catch err code: ', 2028 err.code, ', message: ', err.message); 2029 expect(err.code).assertEqual(PARAM_ERRCODE); 2030 } 2031 }) 2032 2033 /** 2034 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8000 2035 * @tc.name : testGetFileDescriptorParamErr006 2036 * @tc.desc : Negative test: pipe busNum is undefined 2037 * @tc.size : MediumTest 2038 * @tc.type : Function 2039 * @tc.level : Level 3 2040 */ 2041 it('testGetFileDescriptorParamErr006', 0, function () { 2042 console.info(TAG, 'usb testGetFileDescriptorParamErr006 begin'); 2043 if (!isDeviceConnected) { 2044 expect(isDeviceConnected).assertFalse(); 2045 return 2046 } 2047 try { 2048 gPipe.busNum = PARAM_UNDEFINED; 2049 let ret = usbManager.getFileDescriptor(gPipe); 2050 console.info(TAG, 'usb [busNum:undefined] getFileDescriptor ret : ', ret); 2051 expect(ret !== null).assertFalse(); 2052 } catch (err) { 2053 console.info(TAG, 'testGetFileDescriptorParamErr006 catch err code: ', 2054 err.code, ', message: ', err.message); 2055 expect(err.code).assertEqual(PARAM_ERRCODE); 2056 } 2057 }) 2058 2059 /** 2060 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8100 2061 * @tc.name : testGetFileDescriptorParamErr007 2062 * @tc.desc : Negative test: pipe busNum is null string "" 2063 * @tc.size : MediumTest 2064 * @tc.type : Function 2065 * @tc.level : Level 3 2066 */ 2067 it('testGetFileDescriptorParamErr007', 0, function () { 2068 console.info(TAG, 'usb testGetFileDescriptorParamErr007 begin'); 2069 if (!isDeviceConnected) { 2070 expect(isDeviceConnected).assertFalse(); 2071 return 2072 } 2073 try { 2074 gPipe.busNum = PARAM_NULLSTRING; 2075 let ret = usbManager.getFileDescriptor(gPipe); 2076 console.info(TAG, 'usb [busNum:""] getFileDescriptor ret : ', ret); 2077 expect(ret !== null).assertFalse(); 2078 } catch (err) { 2079 console.info(TAG, 'testGetFileDescriptorParamErr007 catch err code: ', 2080 err.code, ', message: ', err.message); 2081 expect(err.code).assertEqual(PARAM_ERRCODE); 2082 } 2083 }) 2084 2085 /** 2086 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8200 2087 * @tc.name : testGetFileDescriptorParamErr008 2088 * @tc.desc : Negative test: pipe devAddress is null 2089 * @tc.size : MediumTest 2090 * @tc.type : Function 2091 * @tc.level : Level 3 2092 */ 2093 it('testGetFileDescriptorParamErr008', 0, function () { 2094 console.info(TAG, 'usb testGetFileDescriptorParamErr008 begin'); 2095 if (!isDeviceConnected) { 2096 expect(isDeviceConnected).assertFalse(); 2097 return 2098 } 2099 try { 2100 gPipe.devAddress = PARAM_NULL; 2101 let ret = usbManager.getFileDescriptor(gPipe); 2102 console.info(TAG, 'usb [devAddress:null] getFileDescriptor ret : ', ret); 2103 expect(ret !== null).assertFalse(); 2104 } catch (err) { 2105 console.info(TAG, 'testGetFileDescriptorParamErr008 catch err code: ', err.code, ', message: ', err.message); 2106 expect(err.code).assertEqual(PARAM_ERRCODE); 2107 } 2108 }) 2109 2110 /** 2111 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8300 2112 * @tc.name : testGetFileDescriptorParamErr009 2113 * @tc.desc : Negative test: pipe devAddress is undefined 2114 * @tc.size : MediumTest 2115 * @tc.type : Function 2116 * @tc.level : Level 3 2117 */ 2118 it('testGetFileDescriptorParamErr009', 0, function () { 2119 console.info(TAG, 'usb testGetFileDescriptorParamErr009 begin'); 2120 if (!isDeviceConnected) { 2121 expect(isDeviceConnected).assertFalse(); 2122 return 2123 } 2124 try { 2125 gPipe.devAddress = PARAM_UNDEFINED; 2126 let ret = usbManager.getFileDescriptor(gPipe); 2127 console.info(TAG, 'usb [devAddress:undefined] getFileDescriptor ret : ', ret); 2128 expect(ret !== null).assertFalse(); 2129 } catch (err) { 2130 console.info(TAG, 'testGetFileDescriptorParamErr009 catch err code: ', 2131 err.code, ', message: ', err.message); 2132 expect(err.code).assertEqual(PARAM_ERRCODE); 2133 } 2134 }) 2135 2136 /** 2137 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8400 2138 * @tc.name : testGetFileDescriptorParamErr010 2139 * @tc.desc : Negative test: devices devAddress is null string "" 2140 * @tc.size : MediumTest 2141 * @tc.type : Function 2142 * @tc.level : Level 3 2143 */ 2144 it('testGetFileDescriptorParamErr010', 0, function () { 2145 console.info(TAG, 'usb testGetFileDescriptorParamErr010 begin'); 2146 if (!isDeviceConnected) { 2147 expect(isDeviceConnected).assertFalse(); 2148 return 2149 } 2150 try { 2151 gPipe.devAddress = PARAM_NULLSTRING; 2152 let ret = usbManager.getFileDescriptor(gPipe); 2153 console.info(TAG, 'usb [devAddress:""] getFileDescriptor ret : ', ret); 2154 expect(ret !== null).assertFalse(); 2155 } catch (err) { 2156 console.info(TAG, 'testGetFileDescriptorParamErr010 catch err code: ', 2157 err.code, ', message: ', err.message); 2158 expect(err.code).assertEqual(PARAM_ERRCODE); 2159 } 2160 }) 2161 2162 /** 2163 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8500 2164 * @tc.name : testClaimInterfaceParamErr001 2165 * @tc.desc : Negative test: Param is null 2166 * @tc.size : MediumTest 2167 * @tc.type : Function 2168 * @tc.level : Level 3 2169 */ 2170 it('testClaimInterfaceParamErr001', 0, function () { 2171 console.info(TAG, 'usb testClaimInterfaceParamErr001 begin'); 2172 if (!isDeviceConnected) { 2173 expect(isDeviceConnected).assertFalse(); 2174 return 2175 } 2176 try { 2177 let ret = usbManager.claimInterface(PARAM_NULL); 2178 console.info(TAG, 'usb [param:null] claimInterface ret : ', ret); 2179 expect(ret !== null).assertFalse(); 2180 } catch (err) { 2181 console.info(TAG, 'testClaimInterfaceParamErr001 catch err code: ', err.code, ', message: ', err.message); 2182 expect(err.code).assertEqual(PARAM_ERRCODE); 2183 } 2184 }) 2185 2186 /** 2187 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8600 2188 * @tc.name : testClaimInterfaceParamErr002 2189 * @tc.desc : Negative test: Param is undefined 2190 * @tc.size : MediumTest 2191 * @tc.type : Function 2192 * @tc.level : Level 3 2193 */ 2194 it('testClaimInterfaceParamErr002', 0, function () { 2195 console.info(TAG, 'usb testClaimInterfaceParamErr002 begin'); 2196 if (!isDeviceConnected) { 2197 expect(isDeviceConnected).assertFalse(); 2198 return 2199 } 2200 try { 2201 let ret = usbManager.claimInterface(PARAM_UNDEFINED); 2202 console.info(TAG, 'usb [param:undefined] claimInterface ret : ', ret); 2203 expect(ret !== null).assertFalse(); 2204 } catch (err) { 2205 console.info(TAG, 'testClaimInterfaceParamErr002 catch err code: ', err.code, ', message: ', err.message); 2206 expect(err.code).assertEqual(PARAM_ERRCODE); 2207 } 2208 }) 2209 2210 /** 2211 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8700 2212 * @tc.name : testClaimInterfaceParamErr003 2213 * @tc.desc : Negative test: Param is null string "" 2214 * @tc.size : MediumTest 2215 * @tc.type : Function 2216 * @tc.level : Level 3 2217 */ 2218 it('testClaimInterfaceParamErr003', 0, function () { 2219 console.info(TAG, 'usb testClaimInterfaceParamErr003 begin'); 2220 if (!isDeviceConnected) { 2221 expect(isDeviceConnected).assertFalse(); 2222 return 2223 } 2224 try { 2225 let ret = usbManager.claimInterface(PARAM_NULLSTRING); 2226 console.info(TAG, 'usb [param:""] claimInterface ret : ', ret); 2227 expect(ret !== null).assertFalse(); 2228 } catch (err) { 2229 console.info(TAG, 'testClaimInterfaceParamErr003 catch err code: ', err.code, ', message: ', err.message); 2230 expect(err.code).assertEqual(PARAM_ERRCODE); 2231 } 2232 }) 2233 2234 /** 2235 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8800 2236 * @tc.name : testClaimInterfaceParamErr004 2237 * @tc.desc : Negative test: pipe busNum is null 2238 * @tc.size : MediumTest 2239 * @tc.type : Function 2240 * @tc.level : Level 3 2241 */ 2242 it('testClaimInterfaceParamErr004', 0, function () { 2243 console.info(TAG, 'usb testClaimInterfaceParamErr004 begin'); 2244 if (!isDeviceConnected) { 2245 expect(isDeviceConnected).assertFalse(); 2246 return 2247 } 2248 try { 2249 gPipe.busNum = PARAM_NULL; 2250 let tmpInterface = devices.configs[0].interfaces[0]; 2251 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2252 console.info(TAG, 'usb [busNum:null] claimInterface ret : ', ret); 2253 expect(ret !== null).assertFalse(); 2254 } catch (err) { 2255 console.info(TAG, 'testClaimInterfaceParamErr004 catch err code: ', err.code, ', message: ', err.message); 2256 expect(err.code).assertEqual(PARAM_ERRCODE); 2257 } 2258 }) 2259 2260 /** 2261 * @tc.number : SUB_USB_HostManager_JS_ParamErr_8900 2262 * @tc.name : testClaimInterfaceParamErr005 2263 * @tc.desc : Negative test: pipe busNum is undefined 2264 * @tc.size : MediumTest 2265 * @tc.type : Function 2266 * @tc.level : Level 3 2267 */ 2268 it('testClaimInterfaceParamErr005', 0, function () { 2269 console.info(TAG, 'usb testClaimInterfaceParamErr005 begin'); 2270 if (!isDeviceConnected) { 2271 expect(isDeviceConnected).assertFalse(); 2272 return 2273 } 2274 try { 2275 gPipe.busNum = PARAM_UNDEFINED; 2276 let tmpInterface = devices.configs[0].interfaces[0]; 2277 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2278 console.info(TAG, 'usb [busNum:undefined] claimInterface ret : ', ret); 2279 expect(ret !== null).assertFalse(); 2280 } catch (err) { 2281 console.info(TAG, 'testClaimInterfaceParamErr005 catch err code: ', err.code, ', message: ', err.message); 2282 expect(err.code).assertEqual(PARAM_ERRCODE); 2283 } 2284 }) 2285 2286 /** 2287 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9000 2288 * @tc.name : testClaimInterfaceParamErr006 2289 * @tc.desc : Negative test: pipe busNum is null string "" 2290 * @tc.size : MediumTest 2291 * @tc.type : Function 2292 * @tc.level : Level 3 2293 */ 2294 it('testClaimInterfaceParamErr006', 0, function () { 2295 console.info(TAG, 'usb testClaimInterfaceParamErr006 begin'); 2296 if (!isDeviceConnected) { 2297 expect(isDeviceConnected).assertFalse(); 2298 return 2299 } 2300 try { 2301 gPipe.busNum = PARAM_NULLSTRING; 2302 let tmpInterface = devices.configs[0].interfaces[0]; 2303 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2304 console.info(TAG, 'usb [busNum:""] claimInterface ret : ', ret); 2305 expect(ret !== null).assertFalse(); 2306 } catch (err) { 2307 console.info(TAG, 'testClaimInterfaceParamErr006 catch err code: ', err.code, ', message: ', err.message); 2308 expect(err.code).assertEqual(PARAM_ERRCODE); 2309 } 2310 }) 2311 2312 /** 2313 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9100 2314 * @tc.name : testClaimInterfaceParamErr007 2315 * @tc.desc : Negative test: pipe devAddress is null 2316 * @tc.size : MediumTest 2317 * @tc.type : Function 2318 * @tc.level : Level 3 2319 */ 2320 it('testClaimInterfaceParamErr007', 0, function () { 2321 console.info(TAG, 'usb testClaimInterfaceParamErr007 begin'); 2322 if (!isDeviceConnected) { 2323 expect(isDeviceConnected).assertFalse(); 2324 return 2325 } 2326 try { 2327 gPipe.devAddress = PARAM_NULL; 2328 let tmpInterface = devices.configs[0].interfaces[0]; 2329 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2330 console.info(TAG, 'usb [devAddress:null] claimInterface ret : ', ret); 2331 expect(ret !== null).assertFalse(); 2332 } catch (err) { 2333 console.info(TAG, 'testClaimInterfaceParamErr007 catch err code: ', err.code, ', message: ', err.message); 2334 expect(err.code).assertEqual(PARAM_ERRCODE); 2335 } 2336 }) 2337 2338 /** 2339 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9200 2340 * @tc.name : testClaimInterfaceParamErr008 2341 * @tc.desc : Negative test: pipe devAddress is undefined 2342 * @tc.size : MediumTest 2343 * @tc.type : Function 2344 * @tc.level : Level 3 2345 */ 2346 it('testClaimInterfaceParamErr008', 0, function () { 2347 console.info(TAG, 'usb testClaimInterfaceParamErr008 begin'); 2348 if (!isDeviceConnected) { 2349 expect(isDeviceConnected).assertFalse(); 2350 return 2351 } 2352 try { 2353 gPipe.devAddress = PARAM_UNDEFINED; 2354 let tmpInterface = devices.configs[0].interfaces[0]; 2355 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2356 console.info(TAG, 'usb [devAddress:undefined] claimInterface ret : ', ret); 2357 expect(ret !== null).assertFalse(); 2358 } catch (err) { 2359 console.info(TAG, 'testClaimInterfaceParamErr008 catch err code: ', err.code, ', message: ', err.message); 2360 expect(err.code).assertEqual(PARAM_ERRCODE); 2361 } 2362 }) 2363 2364 /** 2365 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9300 2366 * @tc.name : testClaimInterfaceParamErr009 2367 * @tc.desc : Negative test: pipe devAddress is null string "" 2368 * @tc.size : MediumTest 2369 * @tc.type : Function 2370 * @tc.level : Level 3 2371 */ 2372 it('testClaimInterfaceParamErr009', 0, function () { 2373 console.info(TAG, 'usb testClaimInterfaceParamErr009 begin'); 2374 if (!isDeviceConnected) { 2375 expect(isDeviceConnected).assertFalse(); 2376 return 2377 } 2378 try { 2379 gPipe.devAddress = PARAM_NULLSTRING; 2380 let tmpInterface = devices.configs[0].interfaces[0]; 2381 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2382 console.info(TAG, 'usb [devAddress:""] claimInterface ret : ', ret); 2383 expect(ret !== null).assertFalse(); 2384 } catch (err) { 2385 console.info(TAG, 'testClaimInterfaceParamErr009 catch err code: ', err.code, ', message: ', err.message); 2386 expect(err.code).assertEqual(PARAM_ERRCODE); 2387 } 2388 }) 2389 2390 /** 2391 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9400 2392 * @tc.name : testClaimInterfaceParamErr010 2393 * @tc.desc : Negative test: interfaces id is null 2394 * @tc.size : MediumTest 2395 * @tc.type : Function 2396 * @tc.level : Level 3 2397 */ 2398 it('testClaimInterfaceParamErr010', 0, function () { 2399 console.info(TAG, 'usb testClaimInterfaceParamErr010 begin'); 2400 if (!isDeviceConnected) { 2401 expect(isDeviceConnected).assertFalse(); 2402 return 2403 } 2404 try { 2405 gPipe.busNum = devices.busNum; 2406 gPipe.devAddress = devices.devAddress; 2407 let tmpInterface = devices.configs[0].interfaces[0]; 2408 tmpInterface.id = PARAM_NULL; 2409 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2410 console.info(TAG, 'usb [interfaces.id:null] claimInterface ret : ', ret); 2411 expect(ret !== null).assertFalse(); 2412 } catch (err) { 2413 console.info(TAG, 'testClaimInterfaceParamErr010 catch err code: ', err.code, ', message: ', err.message); 2414 expect(err.code).assertEqual(PARAM_ERRCODE); 2415 } 2416 }) 2417 2418 /** 2419 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9500 2420 * @tc.name : testClaimInterfaceParamErr011 2421 * @tc.desc : Negative test: interfaces id is undefined 2422 * @tc.size : MediumTest 2423 * @tc.type : Function 2424 * @tc.level : Level 3 2425 */ 2426 it('testClaimInterfaceParamErr011', 0, function () { 2427 console.info(TAG, 'usb testClaimInterfaceParamErr011 begin'); 2428 if (!isDeviceConnected) { 2429 expect(isDeviceConnected).assertFalse(); 2430 return 2431 } 2432 try { 2433 gPipe.busNum = devices.busNum; 2434 gPipe.devAddress = devices.devAddress; 2435 let tmpInterface = devices.configs[0].interfaces[0]; 2436 tmpInterface.id = PARAM_UNDEFINED; 2437 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2438 console.info(TAG, 'usb [interfaces.id:undefined] claimInterface ret : ', ret); 2439 expect(ret !== null).assertFalse(); 2440 } catch (err) { 2441 console.info(TAG, 'testClaimInterfaceParamErr011 catch err code: ', err.code, ', message: ', err.message); 2442 expect(err.code).assertEqual(PARAM_ERRCODE); 2443 } 2444 }) 2445 2446 /** 2447 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9600 2448 * @tc.name : testClaimInterfaceParamErr012 2449 * @tc.desc : Negative test: interfaces id is null string "" 2450 * @tc.size : MediumTest 2451 * @tc.type : Function 2452 * @tc.level : Level 3 2453 */ 2454 it('testClaimInterfaceParamErr012', 0, function () { 2455 console.info(TAG, 'usb testClaimInterfaceParamErr012 begin'); 2456 if (!isDeviceConnected) { 2457 expect(isDeviceConnected).assertFalse(); 2458 return 2459 } 2460 try { 2461 gPipe.busNum = devices.busNum; 2462 gPipe.devAddress = devices.devAddress; 2463 let tmpInterface = devices.configs[0].interfaces[0]; 2464 tmpInterface.id = PARAM_NULLSTRING; 2465 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2466 console.info(TAG, 'usb [interfaces.id:""] claimInterface ret : ', ret); 2467 expect(ret !== null).assertFalse(); 2468 } catch (err) { 2469 console.info(TAG, 'testClaimInterfaceParamErr012 catch err code: ', err.code, ', message: ', err.message); 2470 expect(err.code).assertEqual(PARAM_ERRCODE); 2471 } 2472 }) 2473 2474 /** 2475 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9700 2476 * @tc.name : testClaimInterfaceParamErr013 2477 * @tc.desc : Negative test: interfaces protocol is null 2478 * @tc.size : MediumTest 2479 * @tc.type : Function 2480 * @tc.level : Level 3 2481 */ 2482 it('testClaimInterfaceParamErr013', 0, function () { 2483 console.info(TAG, 'usb testClaimInterfaceParamErr013 begin'); 2484 if (!isDeviceConnected) { 2485 expect(isDeviceConnected).assertFalse(); 2486 return 2487 } 2488 try { 2489 gPipe.busNum = devices.busNum; 2490 gPipe.devAddress = devices.devAddress; 2491 let tmpInterface = devices.configs[0].interfaces[0]; 2492 tmpInterface.protocol = PARAM_NULL; 2493 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2494 console.info(TAG, 'usb [interfaces.protocol:null] claimInterface ret : ', ret); 2495 expect(ret !== null).assertFalse(); 2496 } catch (err) { 2497 console.info(TAG, 'testClaimInterfaceParamErr013 catch err code: ', err.code, ', message: ', err.message); 2498 expect(err.code).assertEqual(PARAM_ERRCODE); 2499 } 2500 }) 2501 2502 /** 2503 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9800 2504 * @tc.name : testClaimInterfaceParamErr014 2505 * @tc.desc : Negative test: interfaces protocol is undefined 2506 * @tc.size : MediumTest 2507 * @tc.type : Function 2508 * @tc.level : Level 3 2509 */ 2510 it('testClaimInterfaceParamErr014', 0, function () { 2511 console.info(TAG, 'usb testClaimInterfaceParamErr014 begin'); 2512 if (!isDeviceConnected) { 2513 expect(isDeviceConnected).assertFalse(); 2514 return 2515 } 2516 try { 2517 gPipe.busNum = devices.busNum; 2518 gPipe.devAddress = devices.devAddress; 2519 let tmpInterface = devices.configs[0].interfaces[0]; 2520 tmpInterface.protocol = PARAM_UNDEFINED; 2521 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2522 console.info(TAG, 'usb [interfaces.protocol:undefined] claimInterface ret : ', ret); 2523 expect(ret !== null).assertFalse(); 2524 } catch (err) { 2525 console.info(TAG, 'testClaimInterfaceParamErr014 catch err code: ', err.code, ', message: ', err.message); 2526 expect(err.code).assertEqual(PARAM_ERRCODE); 2527 } 2528 }) 2529 2530 /** 2531 * @tc.number : SUB_USB_HostManager_JS_ParamErr_9900 2532 * @tc.name : testClaimInterfaceParamErr015 2533 * @tc.desc : Negative test: interfaces protocol is null string "" 2534 * @tc.size : MediumTest 2535 * @tc.type : Function 2536 * @tc.level : Level 3 2537 */ 2538 it('testClaimInterfaceParamErr015', 0, function () { 2539 console.info(TAG, 'usb testClaimInterfaceParamErr015 begin'); 2540 if (!isDeviceConnected) { 2541 expect(isDeviceConnected).assertFalse(); 2542 return 2543 } 2544 try { 2545 gPipe.busNum = devices.busNum; 2546 gPipe.devAddress = devices.devAddress; 2547 let tmpInterface = devices.configs[0].interfaces[0]; 2548 tmpInterface.protocol = PARAM_NULLSTRING; 2549 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2550 console.info(TAG, 'usb [interfaces.protocol:""] claimInterface ret : ', ret); 2551 expect(ret !== null).assertFalse(); 2552 } catch (err) { 2553 console.info(TAG, 'testClaimInterfaceParamErr015 catch err code: ', err.code, ', message: ', err.message); 2554 expect(err.code).assertEqual(PARAM_ERRCODE); 2555 } 2556 }) 2557 2558 /** 2559 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0110 2560 * @tc.name : testClaimInterfaceParamErr016 2561 * @tc.desc : Negative test: interfaces clazz is null 2562 * @tc.size : MediumTest 2563 * @tc.type : Function 2564 * @tc.level : Level 3 2565 */ 2566 it('testClaimInterfaceParamErr016', 0, function () { 2567 console.info(TAG, 'usb testClaimInterfaceParamErr016 begin'); 2568 if (!isDeviceConnected) { 2569 expect(isDeviceConnected).assertFalse(); 2570 return 2571 } 2572 try { 2573 gPipe.busNum = devices.busNum; 2574 gPipe.devAddress = devices.devAddress; 2575 let tmpInterface = devices.configs[0].interfaces[0]; 2576 tmpInterface.clazz = PARAM_NULL; 2577 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2578 console.info(TAG, 'usb [interfaces.clazz:null] claimInterface ret : ', ret); 2579 expect(ret !== null).assertFalse(); 2580 } catch (err) { 2581 console.info(TAG, 'testClaimInterfaceParamErr016 catch err code: ', err.code, ', message: ', err.message); 2582 expect(err.code).assertEqual(PARAM_ERRCODE); 2583 } 2584 }) 2585 2586 /** 2587 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0120 2588 * @tc.name : testClaimInterfaceParamErr017 2589 * @tc.desc : Negative test: interfaces clazz is undefined 2590 * @tc.size : MediumTest 2591 * @tc.type : Function 2592 * @tc.level : Level 3 2593 */ 2594 it('testClaimInterfaceParamErr017', 0, function () { 2595 console.info(TAG, 'usb testClaimInterfaceParamErr017 begin'); 2596 if (!isDeviceConnected) { 2597 expect(isDeviceConnected).assertFalse(); 2598 return 2599 } 2600 try { 2601 gPipe.busNum = devices.busNum; 2602 gPipe.devAddress = devices.devAddress; 2603 let tmpInterface = devices.configs[0].interfaces[0]; 2604 tmpInterface.clazz = PARAM_UNDEFINED; 2605 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2606 console.info(TAG, 'usb [interfaces.clazz:undefined] claimInterface ret : ', ret); 2607 expect(ret !== null).assertFalse(); 2608 } catch (err) { 2609 console.info(TAG, 'testClaimInterfaceParamErr017 catch err code: ', err.code, ', message: ', err.message); 2610 expect(err.code).assertEqual(PARAM_ERRCODE); 2611 } 2612 }) 2613 2614 /** 2615 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0130 2616 * @tc.name : testClaimInterfaceParamErr018 2617 * @tc.desc : Negative test: interfaces clazz is null string "" 2618 * @tc.size : MediumTest 2619 * @tc.type : Function 2620 * @tc.level : Level 3 2621 */ 2622 it('testClaimInterfaceParamErr018', 0, function () { 2623 console.info(TAG, 'usb testClaimInterfaceParamErr018 begin'); 2624 if (!isDeviceConnected) { 2625 expect(isDeviceConnected).assertFalse(); 2626 return 2627 } 2628 try { 2629 gPipe.busNum = devices.busNum; 2630 gPipe.devAddress = devices.devAddress; 2631 let tmpInterface = devices.configs[0].interfaces[0]; 2632 tmpInterface.clazz = PARAM_NULLSTRING; 2633 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2634 console.info(TAG, 'usb [interfaces.clazz:""] claimInterface ret : ', ret); 2635 expect(ret !== null).assertFalse(); 2636 } catch (err) { 2637 console.info(TAG, 'testClaimInterfaceParamErr018 catch err code: ', err.code, ', message: ', err.message); 2638 expect(err.code).assertEqual(PARAM_ERRCODE); 2639 } 2640 }) 2641 2642 /** 2643 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0140 2644 * @tc.name : testClaimInterfaceParamErr019 2645 * @tc.desc : Negative test: interfaces name is null 2646 * @tc.size : MediumTest 2647 * @tc.type : Function 2648 * @tc.level : Level 3 2649 */ 2650 it('testClaimInterfaceParamErr019', 0, function () { 2651 console.info(TAG, 'usb testClaimInterfaceParamErr019 begin'); 2652 if (!isDeviceConnected) { 2653 expect(isDeviceConnected).assertFalse(); 2654 return 2655 } 2656 try { 2657 gPipe.busNum = devices.busNum; 2658 gPipe.devAddress = devices.devAddress; 2659 let tmpInterface = devices.configs[0].interfaces[0]; 2660 tmpInterface.name = PARAM_NULL; 2661 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2662 console.info(TAG, 'usb [interfaces.name:null] claimInterface ret : ', ret); 2663 expect(ret !== null).assertFalse(); 2664 } catch (err) { 2665 console.info(TAG, 'testClaimInterfaceParamErr019 catch err code: ', err.code, ', message: ', err.message); 2666 expect(err.code).assertEqual(PARAM_ERRCODE); 2667 } 2668 }) 2669 2670 /** 2671 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0150 2672 * @tc.name : testClaimInterfaceParamErr020 2673 * @tc.desc : Negative test: interfaces name is undefined 2674 * @tc.size : MediumTest 2675 * @tc.type : Function 2676 * @tc.level : Level 3 2677 */ 2678 it('testClaimInterfaceParamErr020', 0, function () { 2679 console.info(TAG, 'usb testClaimInterfaceParamErr020 begin'); 2680 if (!isDeviceConnected) { 2681 expect(isDeviceConnected).assertFalse(); 2682 return 2683 } 2684 try { 2685 gPipe.busNum = devices.busNum; 2686 gPipe.devAddress = devices.devAddress; 2687 let tmpInterface = devices.configs[0].interfaces[0]; 2688 tmpInterface.name = PARAM_UNDEFINED; 2689 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2690 console.info(TAG, 'usb [interfaces.name:undefined] claimInterface ret : ', ret); 2691 expect(ret !== null).assertFalse(); 2692 } catch (err) { 2693 console.info(TAG, 'testClaimInterfaceParamErr020 catch err code: ', err.code, ', message: ', err.message); 2694 expect(err.code).assertEqual(PARAM_ERRCODE); 2695 } 2696 }) 2697 2698 /** 2699 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0160 2700 * @tc.name : testClaimInterfaceParamErr021 2701 * @tc.desc : Negative test: interfaces name is number 2702 * @tc.size : MediumTest 2703 * @tc.type : Function 2704 * @tc.level : Level 3 2705 */ 2706 it('testClaimInterfaceParamErr021', 0, function () { 2707 console.info(TAG, 'usb testClaimInterfaceParamErr021 begin'); 2708 if (!isDeviceConnected) { 2709 expect(isDeviceConnected).assertFalse(); 2710 return 2711 } 2712 try { 2713 gPipe.busNum = devices.busNum; 2714 gPipe.devAddress = devices.devAddress; 2715 let tmpInterface = devices.configs[0].interfaces[0]; 2716 tmpInterface.name = PARAM_NUMBERTYPE; 2717 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2718 console.info(TAG, 'usb [interfaces.name:number_123] claimInterface ret : ', ret); 2719 expect(ret !== null).assertFalse(); 2720 } catch (err) { 2721 console.info(TAG, 'testClaimInterfaceParamErr021 catch err code: ', err.code, ', message: ', err.message); 2722 expect(err.code).assertEqual(PARAM_ERRCODE); 2723 } 2724 }) 2725 2726 /** 2727 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0170 2728 * @tc.name : testClaimInterfaceParamErr022 2729 * @tc.desc : Negative test: interfaces subClass is null 2730 * @tc.size : MediumTest 2731 * @tc.type : Function 2732 * @tc.level : Level 3 2733 */ 2734 it('testClaimInterfaceParamErr022', 0, function () { 2735 console.info(TAG, 'usb testClaimInterfaceParamErr022 begin'); 2736 if (!isDeviceConnected) { 2737 expect(isDeviceConnected).assertFalse(); 2738 return 2739 } 2740 try { 2741 gPipe.busNum = devices.busNum; 2742 gPipe.devAddress = devices.devAddress; 2743 let tmpInterface = devices.configs[0].interfaces[0]; 2744 tmpInterface.subClass = PARAM_NULL; 2745 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2746 console.info(TAG, 'usb [interfaces.subClass:null] claimInterface ret : ', ret); 2747 expect(ret !== null).assertFalse(); 2748 } catch (err) { 2749 console.info(TAG, 'testClaimInterfaceParamErr022 catch err code: ', err.code, ', message: ', err.message); 2750 expect(err.code).assertEqual(PARAM_ERRCODE); 2751 } 2752 }) 2753 2754 /** 2755 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0180 2756 * @tc.name : testClaimInterfaceParamErr023 2757 * @tc.desc : Negative test: interfaces subClass is undefined 2758 * @tc.size : MediumTest 2759 * @tc.type : Function 2760 * @tc.level : Level 3 2761 */ 2762 it('testClaimInterfaceParamErr023', 0, function () { 2763 console.info(TAG, 'usb testClaimInterfaceParamErr023 begin'); 2764 if (!isDeviceConnected) { 2765 expect(isDeviceConnected).assertFalse(); 2766 return 2767 } 2768 try { 2769 gPipe.busNum = devices.busNum; 2770 gPipe.devAddress = devices.devAddress; 2771 let tmpInterface = devices.configs[0].interfaces[0]; 2772 tmpInterface.subClass = PARAM_UNDEFINED; 2773 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2774 console.info(TAG, 'usb [interfaces.subClass:undefined] claimInterface ret : ', ret); 2775 expect(ret !== null).assertFalse(); 2776 } catch (err) { 2777 console.info(TAG, 'testClaimInterfaceParamErr023 catch err code: ', err.code, ', message: ', err.message); 2778 expect(err.code).assertEqual(PARAM_ERRCODE); 2779 } 2780 }) 2781 2782 /** 2783 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0190 2784 * @tc.name : testClaimInterfaceParamErr024 2785 * @tc.desc : Negative test: interfaces subClass is null string "" 2786 * @tc.size : MediumTest 2787 * @tc.type : Function 2788 * @tc.level : Level 3 2789 */ 2790 it('testClaimInterfaceParamErr024', 0, function () { 2791 console.info(TAG, 'usb testClaimInterfaceParamErr024 begin'); 2792 if (!isDeviceConnected) { 2793 expect(isDeviceConnected).assertFalse(); 2794 return 2795 } 2796 try { 2797 gPipe.busNum = devices.busNum; 2798 gPipe.devAddress = devices.devAddress; 2799 let tmpInterface = devices.configs[0].interfaces[0]; 2800 tmpInterface.subClass = PARAM_NULLSTRING; 2801 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2802 console.info(TAG, 'usb [interfaces.subClass:""] claimInterface ret : ', ret); 2803 expect(ret !== null).assertFalse(); 2804 } catch (err) { 2805 console.info(TAG, 'testClaimInterfaceParamErr024 catch err code: ', err.code, ', message: ', err.message); 2806 expect(err.code).assertEqual(PARAM_ERRCODE); 2807 } 2808 }) 2809 2810 /** 2811 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0210 2812 * @tc.name : testClaimInterfaceParamErr025 2813 * @tc.desc : Negative test: interfaces alternateSetting is null 2814 * @tc.size : MediumTest 2815 * @tc.type : Function 2816 * @tc.level : Level 3 2817 */ 2818 it('testClaimInterfaceParamErr025', 0, function () { 2819 console.info(TAG, 'usb testClaimInterfaceParamErr025 begin'); 2820 if (!isDeviceConnected) { 2821 expect(isDeviceConnected).assertFalse(); 2822 return 2823 } 2824 try { 2825 gPipe.busNum = devices.busNum; 2826 gPipe.devAddress = devices.devAddress; 2827 let tmpInterface = devices.configs[0].interfaces[0]; 2828 tmpInterface.alternateSetting = PARAM_NULL; 2829 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2830 console.info(TAG, 'usb [interfaces.alternateSetting:null] claimInterface ret : ', ret); 2831 expect(ret !== null).assertFalse(); 2832 } catch (err) { 2833 console.info(TAG, 'testClaimInterfaceParamErr025 catch err code: ', err.code, ', message: ', err.message); 2834 expect(err.code).assertEqual(PARAM_ERRCODE); 2835 } 2836 }) 2837 2838 /** 2839 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0220 2840 * @tc.name : testClaimInterfaceParamErr026 2841 * @tc.desc : Negative test: interfaces alternateSetting is undefined 2842 * @tc.size : MediumTest 2843 * @tc.type : Function 2844 * @tc.level : Level 3 2845 */ 2846 it('testClaimInterfaceParamErr026', 0, function () { 2847 console.info(TAG, 'usb testClaimInterfaceParamErr026 begin'); 2848 if (!isDeviceConnected) { 2849 expect(isDeviceConnected).assertFalse(); 2850 return 2851 } 2852 try { 2853 gPipe.busNum = devices.busNum; 2854 gPipe.devAddress = devices.devAddress; 2855 let tmpInterface = devices.configs[0].interfaces[0]; 2856 tmpInterface.alternateSetting = PARAM_UNDEFINED; 2857 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2858 console.info(TAG, 'usb [interfaces.alternateSetting:undefined] claimInterface ret : ', ret); 2859 expect(ret !== null).assertFalse(); 2860 } catch (err) { 2861 console.info(TAG, 'testClaimInterfaceParamErr026 catch err code: ', err.code, ', message: ', err.message); 2862 expect(err.code).assertEqual(PARAM_ERRCODE); 2863 } 2864 }) 2865 2866 /** 2867 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0230 2868 * @tc.name : testClaimInterfaceParamErr027 2869 * @tc.desc : Negative test: interfaces alternateSetting is null string "" 2870 * @tc.size : MediumTest 2871 * @tc.type : Function 2872 * @tc.level : Level 3 2873 */ 2874 it('testClaimInterfaceParamErr027', 0, function () { 2875 console.info(TAG, 'usb testClaimInterfaceParamErr027 begin'); 2876 if (!isDeviceConnected) { 2877 expect(isDeviceConnected).assertFalse(); 2878 return 2879 } 2880 try { 2881 gPipe.busNum = devices.busNum; 2882 gPipe.devAddress = devices.devAddress; 2883 let tmpInterface = devices.configs[0].interfaces[0]; 2884 tmpInterface.alternateSetting = PARAM_NULLSTRING; 2885 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2886 console.info(TAG, 'usb [interfaces.alternateSetting:""] claimInterface ret : ', ret); 2887 expect(ret !== null).assertFalse(); 2888 } catch (err) { 2889 console.info(TAG, 'testClaimInterfaceParamErr027 catch err code: ', err.code, ', message: ', err.message); 2890 expect(err.code).assertEqual(PARAM_ERRCODE); 2891 } 2892 }) 2893 2894 /** 2895 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0240 2896 * @tc.name : testClaimInterfaceParamErr028 2897 * @tc.desc : Negative test: interfaces endpoints is null 2898 * @tc.size : MediumTest 2899 * @tc.type : Function 2900 * @tc.level : Level 3 2901 */ 2902 it('testClaimInterfaceParamErr028', 0, function () { 2903 console.info(TAG, 'usb testClaimInterfaceParamErr028 begin'); 2904 if (!isDeviceConnected) { 2905 expect(isDeviceConnected).assertFalse(); 2906 return 2907 } 2908 try { 2909 gPipe.busNum = devices.busNum; 2910 gPipe.devAddress = devices.devAddress; 2911 let tmpInterface = devices.configs[0].interfaces[0]; 2912 tmpInterface.endpoints = PARAM_NULL; 2913 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2914 console.info(TAG, 'usb [interfaces.endpoints:null] claimInterface ret : ', ret); 2915 expect(ret !== null).assertFalse(); 2916 } catch (err) { 2917 console.info(TAG, 'testClaimInterfaceParamErr028 catch err code: ', err.code, ', message: ', err.message); 2918 expect(err.code).assertEqual(PARAM_ERRCODE); 2919 } 2920 }) 2921 2922 /** 2923 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0250 2924 * @tc.name : testClaimInterfaceParamErr029 2925 * @tc.desc : Negative test: interfaces endpoints is undefined 2926 * @tc.size : MediumTest 2927 * @tc.type : Function 2928 * @tc.level : Level 3 2929 */ 2930 it('testClaimInterfaceParamErr029', 0, function () { 2931 console.info(TAG, 'usb testClaimInterfaceParamErr029 begin'); 2932 if (!isDeviceConnected) { 2933 expect(isDeviceConnected).assertFalse(); 2934 return 2935 } 2936 try { 2937 gPipe.busNum = devices.busNum; 2938 gPipe.devAddress = devices.devAddress; 2939 let tmpInterface = devices.configs[0].interfaces[0]; 2940 tmpInterface.endpoints = PARAM_UNDEFINED; 2941 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2942 console.info(TAG, 'usb [interfaces.endpoints:undefined] claimInterface ret : ', ret); 2943 expect(ret !== null).assertFalse(); 2944 } catch (err) { 2945 console.info(TAG, 'testClaimInterfaceParamErr029 catch err code: ', err.code, ', message: ', err.message); 2946 expect(err.code).assertEqual(PARAM_ERRCODE); 2947 } 2948 }) 2949 2950 /** 2951 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0260 2952 * @tc.name : testClaimInterfaceParamErr030 2953 * @tc.desc : Negative test: interfaces endpoints is null string "" 2954 * @tc.size : MediumTest 2955 * @tc.type : Function 2956 * @tc.level : Level 3 2957 */ 2958 it('testClaimInterfaceParamErr030', 0, function () { 2959 console.info(TAG, 'usb testClaimInterfaceParamErr030 begin'); 2960 if (!isDeviceConnected) { 2961 expect(isDeviceConnected).assertFalse(); 2962 return 2963 } 2964 try { 2965 gPipe.busNum = devices.busNum; 2966 gPipe.devAddress = devices.devAddress; 2967 let tmpInterface = devices.configs[0].interfaces[0]; 2968 tmpInterface.endpoints = PARAM_NULLSTRING; 2969 let ret = usbManager.claimInterface(gPipe, tmpInterface); 2970 console.info(TAG, 'usb [interfaces.endpoints:""] claimInterface ret : ', ret); 2971 expect(ret !== null).assertFalse(); 2972 } catch (err) { 2973 console.info(TAG, 'testClaimInterfaceParamErr030 catch err code: ', err.code, ', message: ', err.message); 2974 expect(err.code).assertEqual(PARAM_ERRCODE); 2975 } 2976 }) 2977 2978 /** 2979 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0270 2980 * @tc.name : testClaimInterfaceParamErr031 2981 * @tc.desc : Negative test: Enter four parameters 2982 * @tc.size : MediumTest 2983 * @tc.type : Function 2984 * @tc.level : Level 3 2985 */ 2986 it('testClaimInterfaceParamErr031', 0, function () { 2987 console.info(TAG, 'usb testClaimInterfaceParamErr031 begin'); 2988 if (!isDeviceConnected) { 2989 expect(isDeviceConnected).assertFalse(); 2990 return 2991 } 2992 getPipe('testClaimInterfaceParamErr031'); 2993 let tmpInterface = devices.configs[0].interfaces[0]; 2994 try { 2995 let ret = usbManager.claimInterface(gPipe, tmpInterface, true, gPipe); 2996 console.info(TAG, 'usb [Enter four param] claimInterface ret : ', ret); 2997 expect(ret).assertEqual(0); 2998 } catch (err) { 2999 console.info(TAG, 'testClaimInterfaceParamErr031 catch err code: ', err.code, ', message: ', err.message); 3000 expect(err !== null).assertFalse(); 3001 } 3002 toReleaseInterface('testClaimInterfaceParamErr031', tmpInterface); 3003 toClosePipe('testClaimInterfaceParamErr031'); 3004 }) 3005 3006 /** 3007 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0280 3008 * @tc.name : testClaimInterfaceParamErr032 3009 * @tc.desc : Negative test: iface is null 3010 * @tc.size : MediumTest 3011 * @tc.type : Function 3012 * @tc.level : Level 3 3013 */ 3014 it('testClaimInterfaceParamErr032', 0, function () { 3015 console.info(TAG, 'usb testClaimInterfaceParamErr032 begin'); 3016 if (!isDeviceConnected) { 3017 expect(isDeviceConnected).assertFalse(); 3018 return 3019 } 3020 try { 3021 gPipe.busNum = devices.busNum; 3022 gPipe.devAddress = devices.devAddress; 3023 let ret = usbManager.claimInterface(gPipe, PARAM_NULL); 3024 console.info(TAG, 'usb [iface:null] claimInterface ret : ', ret); 3025 expect(ret !== null).assertFalse(); 3026 } catch (err) { 3027 console.info(TAG, 'testClaimInterfaceParamErr032 catch err code: ', err.code, ', message: ', err.message); 3028 expect(err.code).assertEqual(PARAM_ERRCODE); 3029 } 3030 }) 3031 3032 /** 3033 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0290 3034 * @tc.name : testClaimInterfaceParamErr033 3035 * @tc.desc : Negative test: iface is undefined 3036 * @tc.size : MediumTest 3037 * @tc.type : Function 3038 * @tc.level : Level 3 3039 */ 3040 it('testClaimInterfaceParamErr033', 0, function () { 3041 console.info(TAG, 'usb testClaimInterfaceParamErr033 begin'); 3042 if (!isDeviceConnected) { 3043 expect(isDeviceConnected).assertFalse(); 3044 return 3045 } 3046 try { 3047 gPipe.busNum = devices.busNum; 3048 gPipe.devAddress = devices.devAddress; 3049 let ret = usbManager.claimInterface(gPipe, PARAM_UNDEFINED); 3050 console.info(TAG, 'usb [iface:undefined] claimInterface ret : ', ret); 3051 expect(ret !== null).assertFalse(); 3052 } catch (err) { 3053 console.info(TAG, 'testClaimInterfaceParamErr033 catch err code: ', err.code, ', message: ', err.message); 3054 expect(err.code).assertEqual(PARAM_ERRCODE); 3055 } 3056 }) 3057 3058 /** 3059 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0310 3060 * @tc.name : testClaimInterfaceParamErr034 3061 * @tc.desc : Negative test: iface is "" 3062 * @tc.size : MediumTest 3063 * @tc.type : Function 3064 * @tc.level : Level 3 3065 */ 3066 it('testClaimInterfaceParamErr034', 0, function () { 3067 console.info(TAG, 'usb testClaimInterfaceParamErr034 begin'); 3068 if (!isDeviceConnected) { 3069 expect(isDeviceConnected).assertFalse(); 3070 return 3071 } 3072 try { 3073 gPipe.busNum = devices.busNum; 3074 gPipe.devAddress = devices.devAddress; 3075 let ret = usbManager.claimInterface(gPipe, PARAM_NULLSTRING); 3076 console.info(TAG, 'usb [iface:""] claimInterface ret : ', ret); 3077 expect(ret !== null).assertFalse(); 3078 } catch (err) { 3079 console.info(TAG, 'testClaimInterfaceParamErr034 catch err code: ', err.code, ', message: ', err.message); 3080 expect(err.code).assertEqual(PARAM_ERRCODE); 3081 } 3082 }) 3083 3084 /** 3085 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0320 3086 * @tc.name : testClaimInterfaceParamErr035 3087 * @tc.desc : Negative test: pipe is null 3088 * @tc.size : MediumTest 3089 * @tc.type : Function 3090 * @tc.level : Level 3 3091 */ 3092 it('testClaimInterfaceParamErr035', 0, function () { 3093 console.info(TAG, 'usb testClaimInterfaceParamErr035 begin'); 3094 if (!isDeviceConnected) { 3095 expect(isDeviceConnected).assertFalse(); 3096 return 3097 } 3098 try { 3099 let tmpInterface = devices.configs[0].interfaces[0]; 3100 let ret = usbManager.claimInterface(PARAM_NULL, tmpInterface); 3101 console.info(TAG, 'usb [iface:null] claimInterface ret : ', ret); 3102 expect(ret !== null).assertFalse(); 3103 } catch (err) { 3104 console.info(TAG, 'testClaimInterfaceParamErr035 catch err code: ', err.code, ', message: ', err.message); 3105 expect(err.code).assertEqual(PARAM_ERRCODE); 3106 } 3107 }) 3108 3109 /** 3110 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0330 3111 * @tc.name : testClaimInterfaceParamErr036 3112 * @tc.desc : Negative test: pipe is undefined 3113 * @tc.size : MediumTest 3114 * @tc.type : Function 3115 * @tc.level : Level 3 3116 */ 3117 it('testClaimInterfaceParamErr036', 0, function () { 3118 console.info(TAG, 'usb testClaimInterfaceParamErr036 begin'); 3119 if (!isDeviceConnected) { 3120 expect(isDeviceConnected).assertFalse(); 3121 return 3122 } 3123 try { 3124 let tmpInterface = devices.configs[0].interfaces[0]; 3125 let ret = usbManager.claimInterface(PARAM_UNDEFINED, tmpInterface); 3126 console.info(TAG, 'usb [iface:undefined] claimInterface ret : ', ret); 3127 expect(ret !== null).assertFalse(); 3128 } catch (err) { 3129 console.info(TAG, 'testClaimInterfaceParamErr036 catch err code: ', err.code, ', message: ', err.message); 3130 expect(err.code).assertEqual(PARAM_ERRCODE); 3131 } 3132 }) 3133 3134 /** 3135 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0340 3136 * @tc.name : testClaimInterfaceParamErr037 3137 * @tc.desc : Negative test: pipe is "" 3138 * @tc.size : MediumTest 3139 * @tc.type : Function 3140 * @tc.level : Level 3 3141 */ 3142 it('testClaimInterfaceParamErr037', 0, function () { 3143 console.info(TAG, 'usb testClaimInterfaceParamErr037 begin'); 3144 if (!isDeviceConnected) { 3145 expect(isDeviceConnected).assertFalse(); 3146 return 3147 } 3148 try { 3149 let tmpInterface = devices.configs[0].interfaces[0]; 3150 let ret = usbManager.claimInterface(PARAM_NULLSTRING, tmpInterface); 3151 console.info(TAG, 'usb [iface:""] claimInterface ret : ', ret); 3152 expect(ret !== null).assertFalse(); 3153 } catch (err) { 3154 console.info(TAG, 'testClaimInterfaceParamErr037 catch err code: ', err.code, ', message: ', err.message); 3155 expect(err.code).assertEqual(PARAM_ERRCODE); 3156 } 3157 }) 3158 3159 /** 3160 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0350 3161 * @tc.name : testClaimInterfaceParamErr038 3162 * @tc.desc : Negative test: force is null string 3163 * @tc.size : MediumTest 3164 * @tc.type : Function 3165 * @tc.level : Level 3 3166 */ 3167 it('testClaimInterfaceParamErr038', 0, function () { 3168 console.info(TAG, 'usb testClaimInterfaceParamErr038 begin'); 3169 if (!isDeviceConnected) { 3170 expect(isDeviceConnected).assertFalse(); 3171 return 3172 } 3173 getPipe('testClaimInterfaceParamErr038'); 3174 let tmpInterface = devices.configs[0].interfaces[0]; 3175 try { 3176 let ret = usbManager.claimInterface(gPipe, tmpInterface, PARAM_NULLSTRING); 3177 console.info(TAG, 'usb [force:""] claimInterface ret : ', ret); 3178 expect(ret).assertEqual(0); 3179 } catch (err) { 3180 console.info(TAG, 'testClaimInterfaceParamErr038 catch err code: ', err.code, ', message: ', err.message); 3181 expect(err !== null).assertFalse(); 3182 } 3183 toReleaseInterface('testClaimInterfaceParamErr038', tmpInterface); 3184 toClosePipe('testClaimInterfaceParamErr038'); 3185 }) 3186 3187 /** 3188 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0360 3189 * @tc.name : testSetConfigurationParamErr001 3190 * @tc.desc : Negative test: Enter two parameters 3191 * @tc.size : MediumTest 3192 * @tc.type : Function 3193 * @tc.level : Level 3 3194 */ 3195 it('testSetConfigurationParamErr001', 0, function () { 3196 console.info(TAG, 'usb testSetConfigurationParamErr001 begin'); 3197 if (!isDeviceConnected) { 3198 expect(isDeviceConnected).assertFalse(); 3199 return 3200 } 3201 getPipe('testSetConfigurationParamErr001'); 3202 try { 3203 gPipe.busNum = devices.busNum; 3204 gPipe.devAddress = devices.devAddress; 3205 let tmpConfig = devices.configs[0]; 3206 let ret = usbManager.setConfiguration(gPipe, tmpConfig, gPipe); 3207 console.info(TAG, 'usb [Enter two parameters] setConfiguration ret : ', ret); 3208 expect(ret).assertEqual(0); 3209 } catch (err) { 3210 console.info(TAG, 'testSetConfigurationParamErr001 catch err code: ', err.code, ', message: ', err.message); 3211 expect(err !== null).assertFalse(); 3212 } 3213 toClosePipe('testSetConfigurationParamErr001'); 3214 }) 3215 3216 /** 3217 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0370 3218 * @tc.name : testSetConfigurationParamErr002 3219 * @tc.desc : Negative test: Param is null 3220 * @tc.size : MediumTest 3221 * @tc.type : Function 3222 * @tc.level : Level 3 3223 */ 3224 it('testSetConfigurationParamErr002', 0, function () { 3225 console.info(TAG, 'usb testSetConfigurationParamErr002 begin'); 3226 if (!isDeviceConnected) { 3227 expect(isDeviceConnected).assertFalse(); 3228 return 3229 } 3230 try { 3231 let ret = usbManager.setConfiguration(PARAM_NULL); 3232 console.info(TAG, 'usb [param:null] setConfiguration ret : ', ret); 3233 expect(ret !== null).assertFalse(); 3234 } catch (err) { 3235 console.info(TAG, 'testSetConfigurationParamErr002 catch err code: ', err.code, ', message: ', err.message); 3236 expect(err.code).assertEqual(PARAM_ERRCODE); 3237 } 3238 }) 3239 3240 /** 3241 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0380 3242 * @tc.name : testSetConfigurationParamErr003 3243 * @tc.desc : Negative test: Param is undefined 3244 * @tc.size : MediumTest 3245 * @tc.type : Function 3246 * @tc.level : Level 3 3247 */ 3248 it('testSetConfigurationParamErr003', 0, function () { 3249 console.info(TAG, 'usb testSetConfigurationParamErr003 begin'); 3250 if (!isDeviceConnected) { 3251 expect(isDeviceConnected).assertFalse(); 3252 return 3253 } 3254 try { 3255 let ret = usbManager.setConfiguration(PARAM_UNDEFINED); 3256 console.info(TAG, 'usb [param:undefined] setConfiguration ret : ', ret); 3257 expect(ret !== null).assertFalse(); 3258 } catch (err) { 3259 console.info(TAG, 'testSetConfigurationParamErr003 catch err code: ', err.code, ', message: ', err.message); 3260 expect(err.code).assertEqual(PARAM_ERRCODE); 3261 } 3262 }) 3263 3264 /** 3265 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0390 3266 * @tc.name : testSetConfigurationParamErr004 3267 * @tc.desc : Negative test: Param is "" 3268 * @tc.size : MediumTest 3269 * @tc.type : Function 3270 * @tc.level : Level 3 3271 */ 3272 it('testSetConfigurationParamErr004', 0, function () { 3273 console.info(TAG, 'usb testSetConfigurationParamErr004 begin'); 3274 if (!isDeviceConnected) { 3275 expect(isDeviceConnected).assertFalse(); 3276 return 3277 } 3278 try { 3279 let ret = usbManager.setConfiguration(PARAM_NULLSTRING); 3280 console.info(TAG, 'usb [param:""] setConfiguration ret : ', ret); 3281 expect(ret !== null).assertFalse(); 3282 } catch (err) { 3283 console.info(TAG, 'testSetConfigurationParamErr004 catch err code: ', err.code, ', message: ', err.message); 3284 expect(err.code).assertEqual(PARAM_ERRCODE); 3285 } 3286 }) 3287 3288 /** 3289 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0410 3290 * @tc.name : testSetConfigurationParamErr005 3291 * @tc.desc : Negative test: pipe is null 3292 * @tc.size : MediumTest 3293 * @tc.type : Function 3294 * @tc.level : Level 3 3295 */ 3296 it('testSetConfigurationParamErr005', 0, function () { 3297 console.info(TAG, 'usb testSetConfigurationParamErr005 begin'); 3298 if (!isDeviceConnected) { 3299 expect(isDeviceConnected).assertFalse(); 3300 return 3301 } 3302 try { 3303 let tmpConfig = devices.configs[0]; 3304 let ret = usbManager.setConfiguration(PARAM_NULL, tmpConfig); 3305 console.info(TAG, 'usb [pipe:null] setConfiguration ret : ', ret); 3306 expect(ret !== null).assertFalse(); 3307 } catch (err) { 3308 console.info(TAG, 'testSetConfigurationParamErr005 catch err code: ', err.code, ', message: ', err.message); 3309 expect(err.code).assertEqual(PARAM_ERRCODE); 3310 } 3311 }) 3312 3313 /** 3314 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0420 3315 * @tc.name : testSetConfigurationParamErr006 3316 * @tc.desc : Negative test: pipe is undefined 3317 * @tc.size : MediumTest 3318 * @tc.type : Function 3319 * @tc.level : Level 3 3320 */ 3321 it('testSetConfigurationParamErr006', 0, function () { 3322 console.info(TAG, 'usb testSetConfigurationParamErr006 begin'); 3323 if (!isDeviceConnected) { 3324 expect(isDeviceConnected).assertFalse(); 3325 return 3326 } 3327 try { 3328 let tmpConfig = devices.configs[0]; 3329 let ret = usbManager.setConfiguration(PARAM_UNDEFINED, tmpConfig); 3330 console.info(TAG, 'usb [pipe:undefined] setConfiguration ret : ', ret); 3331 expect(ret !== null).assertFalse(); 3332 } catch (err) { 3333 console.info(TAG, 'testSetConfigurationParamErr006 catch err code: ', err.code, ', message: ', err.message); 3334 expect(err.code).assertEqual(PARAM_ERRCODE); 3335 } 3336 }) 3337 3338 /** 3339 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0430 3340 * @tc.name : testSetConfigurationParamErr007 3341 * @tc.desc : Negative test: pipe is "" 3342 * @tc.size : MediumTest 3343 * @tc.type : Function 3344 * @tc.level : Level 3 3345 */ 3346 it('testSetConfigurationParamErr007', 0, function () { 3347 console.info(TAG, 'usb testSetConfigurationParamErr007 begin'); 3348 if (!isDeviceConnected) { 3349 expect(isDeviceConnected).assertFalse(); 3350 return 3351 } 3352 try { 3353 let tmpConfig = devices.configs[0]; 3354 let ret = usbManager.setConfiguration(PARAM_NULLSTRING, tmpConfig); 3355 console.info(TAG, 'usb [pipe:""] setConfiguration ret : ', ret); 3356 expect(ret !== null).assertFalse(); 3357 } catch (err) { 3358 console.info(TAG, 'testSetConfigurationParamErr007 catch err code: ', err.code, ', message: ', err.message); 3359 expect(err.code).assertEqual(PARAM_ERRCODE); 3360 } 3361 }) 3362 3363 /** 3364 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0440 3365 * @tc.name : testSetConfigurationParamErr008 3366 * @tc.desc : Negative test: config is null 3367 * @tc.size : MediumTest 3368 * @tc.type : Function 3369 * @tc.level : Level 3 3370 */ 3371 it('testSetConfigurationParamErr008', 0, function () { 3372 console.info(TAG, 'usb testSetConfigurationParamErr008 begin'); 3373 if (!isDeviceConnected) { 3374 expect(isDeviceConnected).assertFalse(); 3375 return 3376 } 3377 try { 3378 gPipe.busNum = devices.busNum; 3379 gPipe.devAddress = devices.devAddress; 3380 let ret = usbManager.setConfiguration(gPipe, PARAM_NULL); 3381 console.info(TAG, 'usb [config:null] setConfiguration ret : ', ret); 3382 expect(ret !== null).assertFalse(); 3383 } catch (err) { 3384 console.info(TAG, 'testSetConfigurationParamErr008 catch err code: ', err.code, ', message: ', err.message); 3385 expect(err.code).assertEqual(PARAM_ERRCODE); 3386 } 3387 }) 3388 3389 /** 3390 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0450 3391 * @tc.name : testSetConfigurationParamErr009 3392 * @tc.desc : Negative test: config is undefined 3393 * @tc.size : MediumTest 3394 * @tc.type : Function 3395 * @tc.level : Level 3 3396 */ 3397 it('testSetConfigurationParamErr009', 0, function () { 3398 console.info(TAG, 'usb testSetConfigurationParamErr009 begin'); 3399 if (!isDeviceConnected) { 3400 expect(isDeviceConnected).assertFalse(); 3401 return 3402 } 3403 try { 3404 gPipe.busNum = devices.busNum; 3405 gPipe.devAddress = devices.devAddress; 3406 let ret = usbManager.setConfiguration(gPipe, PARAM_UNDEFINED); 3407 console.info(TAG, 'usb [config:undefined] setConfiguration ret : ', ret); 3408 expect(ret !== null).assertFalse(); 3409 } catch (err) { 3410 console.info(TAG, 'testSetConfigurationParamErr009 catch err code: ', err.code, ', message: ', err.message); 3411 expect(err.code).assertEqual(PARAM_ERRCODE); 3412 } 3413 }) 3414 3415 /** 3416 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0460 3417 * @tc.name : testSetConfigurationParamErr010 3418 * @tc.desc : Negative test: config is "" 3419 * @tc.size : MediumTest 3420 * @tc.type : Function 3421 * @tc.level : Level 3 3422 */ 3423 it('testSetConfigurationParamErr010', 0, function () { 3424 console.info(TAG, 'usb testSetConfigurationParamErr010 begin'); 3425 if (!isDeviceConnected) { 3426 expect(isDeviceConnected).assertFalse(); 3427 return 3428 } 3429 try { 3430 gPipe.busNum = devices.busNum; 3431 gPipe.devAddress = devices.devAddress; 3432 let ret = usbManager.setConfiguration(gPipe, PARAM_NULLSTRING); 3433 console.info(TAG, 'usb [config:""] setConfiguration ret : ', ret); 3434 expect(ret !== null).assertFalse(); 3435 } catch (err) { 3436 console.info(TAG, 'testSetConfigurationParamErr010 catch err code: ', err.code, ', message: ', err.message); 3437 expect(err.code).assertEqual(PARAM_ERRCODE); 3438 } 3439 }) 3440 3441 /** 3442 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0470 3443 * @tc.name : testSetConfigurationParamErr011 3444 * @tc.desc : Negative test: config id is null 3445 * @tc.size : MediumTest 3446 * @tc.type : Function 3447 * @tc.level : Level 3 3448 */ 3449 it('testSetConfigurationParamErr011', 0, function () { 3450 console.info(TAG, 'usb testSetConfigurationParamErr011 begin'); 3451 if (!isDeviceConnected) { 3452 expect(isDeviceConnected).assertFalse(); 3453 return 3454 } 3455 try { 3456 gPipe.busNum = devices.busNum; 3457 gPipe.devAddress = devices.devAddress; 3458 let tmpConfig = devices.configs[0]; 3459 tmpConfig.id = PARAM_NULL; 3460 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3461 console.info(TAG, 'usb [config.id:null] setConfiguration ret : ', ret); 3462 expect(ret !== null).assertFalse(); 3463 } catch (err) { 3464 console.info(TAG, 'testSetConfigurationParamErr011 catch err code: ', err.code, ', message: ', err.message); 3465 expect(err.code).assertEqual(PARAM_ERRCODE); 3466 } 3467 }) 3468 3469 /** 3470 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0480 3471 * @tc.name : testSetConfigurationParamErr012 3472 * @tc.desc : Negative test: config id is undefined 3473 * @tc.size : MediumTest 3474 * @tc.type : Function 3475 * @tc.level : Level 3 3476 */ 3477 it('testSetConfigurationParamErr012', 0, function () { 3478 console.info(TAG, 'usb testSetConfigurationParamErr012 begin'); 3479 if (!isDeviceConnected) { 3480 expect(isDeviceConnected).assertFalse(); 3481 return 3482 } 3483 try { 3484 gPipe.busNum = devices.busNum; 3485 gPipe.devAddress = devices.devAddress; 3486 let tmpConfig = devices.configs[0]; 3487 tmpConfig.id = PARAM_UNDEFINED; 3488 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3489 console.info(TAG, 'usb [config.id:undefined] setConfiguration ret : ', ret); 3490 expect(ret !== null).assertFalse(); 3491 } catch (err) { 3492 console.info(TAG, 'testSetConfigurationParamErr012 catch err code: ', err.code, ', message: ', err.message); 3493 expect(err.code).assertEqual(PARAM_ERRCODE); 3494 } 3495 }) 3496 3497 /** 3498 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0490 3499 * @tc.name : testSetConfigurationParamErr013 3500 * @tc.desc : Negative test: config id is "" 3501 * @tc.size : MediumTest 3502 * @tc.type : Function 3503 * @tc.level : Level 3 3504 */ 3505 it('testSetConfigurationParamErr013', 0, function () { 3506 console.info(TAG, 'usb testSetConfigurationParamErr013 begin'); 3507 if (!isDeviceConnected) { 3508 expect(isDeviceConnected).assertFalse(); 3509 return 3510 } 3511 try { 3512 gPipe.busNum = devices.busNum; 3513 gPipe.devAddress = devices.devAddress; 3514 let tmpConfig = devices.configs[0]; 3515 tmpConfig.id = PARAM_NULLSTRING; 3516 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3517 console.info(TAG, 'usb [config.id:""] setConfiguration ret : ', ret); 3518 expect(ret !== null).assertFalse(); 3519 } catch (err) { 3520 console.info(TAG, 'testSetConfigurationParamErr013 catch err code: ', err.code, ', message: ', err.message); 3521 expect(err.code).assertEqual(PARAM_ERRCODE); 3522 } 3523 }) 3524 3525 /** 3526 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0510 3527 * @tc.name : testSetConfigurationParamErr014 3528 * @tc.desc : Negative test: config attributes is null 3529 * @tc.size : MediumTest 3530 * @tc.type : Function 3531 * @tc.level : Level 3 3532 */ 3533 it('testSetConfigurationParamErr014', 0, function () { 3534 console.info(TAG, 'usb testSetConfigurationParamErr014 begin'); 3535 if (!isDeviceConnected) { 3536 expect(isDeviceConnected).assertFalse(); 3537 return 3538 } 3539 try { 3540 gPipe.busNum = devices.busNum; 3541 gPipe.devAddress = devices.devAddress; 3542 let tmpConfig = devices.configs[0]; 3543 tmpConfig.attributes = PARAM_NULL; 3544 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3545 console.info(TAG, 'usb [config.attributes:null] setConfiguration ret : ', ret); 3546 expect(ret !== null).assertFalse(); 3547 } catch (err) { 3548 console.info(TAG, 'testSetConfigurationParamErr014 catch err code: ', err.code, ', message: ', err.message); 3549 expect(err.code).assertEqual(PARAM_ERRCODE); 3550 } 3551 }) 3552 3553 /** 3554 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0520 3555 * @tc.name : testSetConfigurationParamErr015 3556 * @tc.desc : Negative test: config attributes is undefined 3557 * @tc.size : MediumTest 3558 * @tc.type : Function 3559 * @tc.level : Level 3 3560 */ 3561 it('testSetConfigurationParamErr015', 0, function () { 3562 console.info(TAG, 'usb testSetConfigurationParamErr015 begin'); 3563 if (!isDeviceConnected) { 3564 expect(isDeviceConnected).assertFalse(); 3565 return 3566 } 3567 try { 3568 gPipe.busNum = devices.busNum; 3569 gPipe.devAddress = devices.devAddress; 3570 let tmpConfig = devices.configs[0]; 3571 tmpConfig.attributes = PARAM_UNDEFINED; 3572 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3573 console.info(TAG, 'usb [config.attributes:undefined] setConfiguration ret : ', ret); 3574 expect(ret !== null).assertFalse(); 3575 } catch (err) { 3576 console.info(TAG, 'testSetConfigurationParamErr015 catch err code: ', err.code, ', message: ', err.message); 3577 expect(err.code).assertEqual(PARAM_ERRCODE); 3578 } 3579 }) 3580 3581 /** 3582 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0530 3583 * @tc.name : testSetConfigurationParamErr016 3584 * @tc.desc : Negative test: config attributes is "" 3585 * @tc.size : MediumTest 3586 * @tc.type : Function 3587 * @tc.level : Level 3 3588 */ 3589 it('testSetConfigurationParamErr016', 0, function () { 3590 console.info(TAG, 'usb testSetConfigurationParamErr016 begin'); 3591 if (!isDeviceConnected) { 3592 expect(isDeviceConnected).assertFalse(); 3593 return 3594 } 3595 try { 3596 gPipe.busNum = devices.busNum; 3597 gPipe.devAddress = devices.devAddress; 3598 let tmpConfig = devices.configs[0]; 3599 tmpConfig.attributes = PARAM_NULLSTRING; 3600 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3601 console.info(TAG, 'usb [config.attributes:""] setConfiguration ret : ', ret); 3602 expect(ret !== null).assertFalse(); 3603 } catch (err) { 3604 console.info(TAG, 'testSetConfigurationParamErr016 catch err code: ', err.code, ', message: ', err.message); 3605 expect(err.code).assertEqual(PARAM_ERRCODE); 3606 } 3607 }) 3608 3609 /** 3610 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0540 3611 * @tc.name : testSetConfigurationParamErr017 3612 * @tc.desc : Negative test: config maxPower is null 3613 * @tc.size : MediumTest 3614 * @tc.type : Function 3615 * @tc.level : Level 3 3616 */ 3617 it('testSetConfigurationParamErr017', 0, function () { 3618 console.info(TAG, 'usb testSetConfigurationParamErr017 begin'); 3619 if (!isDeviceConnected) { 3620 expect(isDeviceConnected).assertFalse(); 3621 return 3622 } 3623 try { 3624 gPipe.busNum = devices.busNum; 3625 gPipe.devAddress = devices.devAddress; 3626 let tmpConfig = devices.configs[0]; 3627 tmpConfig.maxPower = PARAM_NULL; 3628 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3629 console.info(TAG, 'usb [config.maxPower:null] setConfiguration ret : ', ret); 3630 expect(ret !== null).assertFalse(); 3631 } catch (err) { 3632 console.info(TAG, 'testSetConfigurationParamErr017 catch err code: ', err.code, ', message: ', err.message); 3633 expect(err.code).assertEqual(PARAM_ERRCODE); 3634 } 3635 }) 3636 3637 /** 3638 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0550 3639 * @tc.name : testSetConfigurationParamErr018 3640 * @tc.desc : Negative test: config maxPower is undefined 3641 * @tc.size : MediumTest 3642 * @tc.type : Function 3643 * @tc.level : Level 3 3644 */ 3645 it('testSetConfigurationParamErr018', 0, function () { 3646 console.info(TAG, 'usb testSetConfigurationParamErr018 begin'); 3647 if (!isDeviceConnected) { 3648 expect(isDeviceConnected).assertFalse(); 3649 return 3650 } 3651 try { 3652 gPipe.busNum = devices.busNum; 3653 gPipe.devAddress = devices.devAddress; 3654 let tmpConfig = devices.configs[0]; 3655 tmpConfig.maxPower = PARAM_UNDEFINED; 3656 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3657 console.info(TAG, 'usb [config.maxPower:undefined] setConfiguration ret : ', ret); 3658 expect(ret !== null).assertFalse(); 3659 } catch (err) { 3660 console.info(TAG, 'testSetConfigurationParamErr018 catch err code: ', err.code, ', message: ', err.message); 3661 expect(err.code).assertEqual(PARAM_ERRCODE); 3662 } 3663 }) 3664 3665 /** 3666 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0560 3667 * @tc.name : testSetConfigurationParamErr019 3668 * @tc.desc : Negative test: config maxPower is "" 3669 * @tc.size : MediumTest 3670 * @tc.type : Function 3671 * @tc.level : Level 3 3672 */ 3673 it('testSetConfigurationParamErr019', 0, function () { 3674 console.info(TAG, 'usb testSetConfigurationParamErr019 begin'); 3675 if (!isDeviceConnected) { 3676 expect(isDeviceConnected).assertFalse(); 3677 return 3678 } 3679 try { 3680 gPipe.busNum = devices.busNum; 3681 gPipe.devAddress = devices.devAddress; 3682 let tmpConfig = devices.configs[0]; 3683 tmpConfig.maxPower = PARAM_NULLSTRING; 3684 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3685 console.info(TAG, 'usb [config.maxPower:""] setConfiguration ret : ', ret); 3686 expect(ret !== null).assertFalse(); 3687 } catch (err) { 3688 console.info(TAG, 'testSetConfigurationParamErr019 catch err code: ', err.code, ', message: ', err.message); 3689 expect(err.code).assertEqual(PARAM_ERRCODE); 3690 } 3691 }) 3692 3693 /** 3694 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0570 3695 * @tc.name : testSetConfigurationParamErr020 3696 * @tc.desc : Negative test: config name is null 3697 * @tc.size : MediumTest 3698 * @tc.type : Function 3699 * @tc.level : Level 3 3700 */ 3701 it('testSetConfigurationParamErr020', 0, function () { 3702 console.info(TAG, 'usb testSetConfigurationParamErr020 begin'); 3703 if (!isDeviceConnected) { 3704 expect(isDeviceConnected).assertFalse(); 3705 return 3706 } 3707 try { 3708 gPipe.busNum = devices.busNum; 3709 gPipe.devAddress = devices.devAddress; 3710 let tmpConfig = devices.configs[0]; 3711 tmpConfig.name = PARAM_NULL; 3712 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3713 console.info(TAG, 'usb [config.name:null] setConfiguration ret : ', ret); 3714 expect(ret !== null).assertFalse(); 3715 } catch (err) { 3716 console.info(TAG, 'testSetConfigurationParamErr020 catch err code: ', err.code, ', message: ', err.message); 3717 expect(err.code).assertEqual(PARAM_ERRCODE); 3718 } 3719 }) 3720 3721 /** 3722 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0580 3723 * @tc.name : testSetConfigurationParamErr021 3724 * @tc.desc : Negative test: config name is undefined 3725 * @tc.size : MediumTest 3726 * @tc.type : Function 3727 * @tc.level : Level 3 3728 */ 3729 it('testSetConfigurationParamErr021', 0, function () { 3730 console.info(TAG, 'usb testSetConfigurationParamErr021 begin'); 3731 if (!isDeviceConnected) { 3732 expect(isDeviceConnected).assertFalse(); 3733 return 3734 } 3735 try { 3736 gPipe.busNum = devices.busNum; 3737 gPipe.devAddress = devices.devAddress; 3738 let tmpConfig = devices.configs[0]; 3739 tmpConfig.name = PARAM_UNDEFINED; 3740 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3741 console.info(TAG, 'usb [config.name:undefined] setConfiguration ret : ', ret); 3742 expect(ret !== null).assertFalse(); 3743 } catch (err) { 3744 console.info(TAG, 'testSetConfigurationParamErr021 catch err code: ', err.code, ', message: ', err.message); 3745 expect(err.code).assertEqual(PARAM_ERRCODE); 3746 } 3747 }) 3748 3749 /** 3750 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0590 3751 * @tc.name : testSetConfigurationParamErr022 3752 * @tc.desc : Negative test: config name is 123 3753 * @tc.size : MediumTest 3754 * @tc.type : Function 3755 * @tc.level : Level 3 3756 */ 3757 it('testSetConfigurationParamErr022', 0, function () { 3758 console.info(TAG, 'usb testSetConfigurationParamErr022 begin'); 3759 if (!isDeviceConnected) { 3760 expect(isDeviceConnected).assertFalse(); 3761 return 3762 } 3763 try { 3764 gPipe.busNum = devices.busNum; 3765 gPipe.devAddress = devices.devAddress; 3766 let tmpConfig = devices.configs[0]; 3767 tmpConfig.name = PARAM_NUMBERTYPE; 3768 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3769 console.info(TAG, 'usb [config.name:""] setConfiguration ret : ', ret); 3770 expect(ret !== null).assertFalse(); 3771 } catch (err) { 3772 console.info(TAG, 'testSetConfigurationParamErr022 catch err code: ', err.code, ', message: ', err.message); 3773 expect(err.code).assertEqual(PARAM_ERRCODE); 3774 } 3775 }) 3776 3777 /** 3778 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0610 3779 * @tc.name : testSetConfigurationParamErr023 3780 * @tc.desc : Negative test: config isRemoteWakeup is null 3781 * @tc.size : MediumTest 3782 * @tc.type : Function 3783 * @tc.level : Level 3 3784 */ 3785 it('testSetConfigurationParamErr023', 0, function () { 3786 console.info(TAG, 'usb testSetConfigurationParamErr023 begin'); 3787 if (!isDeviceConnected) { 3788 expect(isDeviceConnected).assertFalse(); 3789 return 3790 } 3791 try { 3792 gPipe.busNum = devices.busNum; 3793 gPipe.devAddress = devices.devAddress; 3794 let tmpConfig = devices.configs[0]; 3795 tmpConfig.isRemoteWakeup = PARAM_NULL; 3796 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3797 console.info(TAG, 'usb [config.isRemoteWakeup:null] setConfiguration ret : ', ret); 3798 expect(ret !== null).assertFalse(); 3799 } catch (err) { 3800 console.info(TAG, 'testSetConfigurationParamErr023 catch err code: ', err.code, ', message: ', err.message); 3801 expect(err.code).assertEqual(PARAM_ERRCODE); 3802 } 3803 }) 3804 3805 /** 3806 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0620 3807 * @tc.name : testSetConfigurationParamErr024 3808 * @tc.desc : Negative test: config isRemoteWakeup is undefined 3809 * @tc.size : MediumTest 3810 * @tc.type : Function 3811 * @tc.level : Level 3 3812 */ 3813 it('testSetConfigurationParamErr024', 0, function () { 3814 console.info(TAG, 'usb testSetConfigurationParamErr024 begin'); 3815 if (!isDeviceConnected) { 3816 expect(isDeviceConnected).assertFalse(); 3817 return 3818 } 3819 try { 3820 gPipe.busNum = devices.busNum; 3821 gPipe.devAddress = devices.devAddress; 3822 let tmpConfig = devices.configs[0]; 3823 tmpConfig.isRemoteWakeup = PARAM_UNDEFINED; 3824 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3825 console.info(TAG, 'usb [config.isRemoteWakeup:undefined] setConfiguration ret : ', ret); 3826 expect(ret !== null).assertFalse(); 3827 } catch (err) { 3828 console.info(TAG, 'testSetConfigurationParamErr024 catch err code: ', err.code, ', message: ', err.message); 3829 expect(err.code).assertEqual(PARAM_ERRCODE); 3830 } 3831 }) 3832 3833 /** 3834 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0630 3835 * @tc.name : testSetConfigurationParamErr025 3836 * @tc.desc : Negative test: config isRemoteWakeup is "" 3837 * @tc.size : MediumTest 3838 * @tc.type : Function 3839 * @tc.level : Level 3 3840 */ 3841 it('testSetConfigurationParamErr025', 0, function () { 3842 console.info(TAG, 'usb testSetConfigurationParamErr025 begin'); 3843 if (!isDeviceConnected) { 3844 expect(isDeviceConnected).assertFalse(); 3845 return 3846 } 3847 try { 3848 gPipe.busNum = devices.busNum; 3849 gPipe.devAddress = devices.devAddress; 3850 let tmpConfig = devices.configs[0]; 3851 tmpConfig.isRemoteWakeup = PARAM_NULLSTRING; 3852 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3853 console.info(TAG, 'usb [config.isRemoteWakeup:""] setConfiguration ret : ', ret); 3854 expect(ret !== null).assertFalse(); 3855 } catch (err) { 3856 console.info(TAG, 'testSetConfigurationParamErr025 catch err code: ', err.code, ', message: ', err.message); 3857 expect(err.code).assertEqual(PARAM_ERRCODE); 3858 } 3859 }) 3860 3861 /** 3862 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0640 3863 * @tc.name : testSetConfigurationParamErr026 3864 * @tc.desc : Negative test: config isSelfPowered is null 3865 * @tc.size : MediumTest 3866 * @tc.type : Function 3867 * @tc.level : Level 3 3868 */ 3869 it('testSetConfigurationParamErr026', 0, function () { 3870 console.info(TAG, 'usb testSetConfigurationParamErr026 begin'); 3871 if (!isDeviceConnected) { 3872 expect(isDeviceConnected).assertFalse(); 3873 return 3874 } 3875 try { 3876 gPipe.busNum = devices.busNum; 3877 gPipe.devAddress = devices.devAddress; 3878 let tmpConfig = devices.configs[0]; 3879 tmpConfig.isSelfPowered = PARAM_NULL; 3880 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3881 console.info(TAG, 'usb [config.isSelfPowered:null] setConfiguration ret : ', ret); 3882 expect(ret !== null).assertFalse(); 3883 } catch (err) { 3884 console.info(TAG, 'testSetConfigurationParamErr026 catch err code: ', err.code, ', message: ', err.message); 3885 expect(err.code).assertEqual(PARAM_ERRCODE); 3886 } 3887 }) 3888 3889 /** 3890 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0650 3891 * @tc.name : testSetConfigurationParamErr027 3892 * @tc.desc : Negative test: config isSelfPowered is undefined 3893 * @tc.size : MediumTest 3894 * @tc.type : Function 3895 * @tc.level : Level 3 3896 */ 3897 it('testSetConfigurationParamErr027', 0, function () { 3898 console.info(TAG, 'usb testSetConfigurationParamErr027 begin'); 3899 if (!isDeviceConnected) { 3900 expect(isDeviceConnected).assertFalse(); 3901 return 3902 } 3903 try { 3904 gPipe.busNum = devices.busNum; 3905 gPipe.devAddress = devices.devAddress; 3906 let tmpConfig = devices.configs[0]; 3907 tmpConfig.isSelfPowered = PARAM_UNDEFINED; 3908 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3909 console.info(TAG, 'usb [config.isSelfPowered:undefined] setConfiguration ret : ', ret); 3910 expect(ret !== null).assertFalse(); 3911 } catch (err) { 3912 console.info(TAG, 'testSetConfigurationParamErr027 catch err code: ', err.code, ', message: ', err.message); 3913 expect(err.code).assertEqual(PARAM_ERRCODE); 3914 } 3915 }) 3916 3917 /** 3918 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0660 3919 * @tc.name : testSetConfigurationParamErr028 3920 * @tc.desc : Negative test: config isSelfPowered is "" 3921 * @tc.size : MediumTest 3922 * @tc.type : Function 3923 * @tc.level : Level 3 3924 */ 3925 it('testSetConfigurationParamErr028', 0, function () { 3926 console.info(TAG, 'usb testSetConfigurationParamErr028 begin'); 3927 if (!isDeviceConnected) { 3928 expect(isDeviceConnected).assertFalse(); 3929 return 3930 } 3931 try { 3932 gPipe.busNum = devices.busNum; 3933 gPipe.devAddress = devices.devAddress; 3934 let tmpConfig = devices.configs[0]; 3935 tmpConfig.isSelfPowered = PARAM_NULLSTRING; 3936 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3937 console.info(TAG, 'usb [config.isSelfPowered:""] setConfiguration ret : ', ret); 3938 expect(ret !== null).assertFalse(); 3939 } catch (err) { 3940 console.info(TAG, 'testSetConfigurationParamErr028 catch err code: ', err.code, ', message: ', err.message); 3941 expect(err.code).assertEqual(PARAM_ERRCODE); 3942 } 3943 }) 3944 3945 /** 3946 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0670 3947 * @tc.name : testSetConfigurationParamErr029 3948 * @tc.desc : Negative test: config interfaces is null 3949 * @tc.size : MediumTest 3950 * @tc.type : Function 3951 * @tc.level : Level 3 3952 */ 3953 it('testSetConfigurationParamErr029', 0, function () { 3954 console.info(TAG, 'usb testSetConfigurationParamErr029 begin'); 3955 if (!isDeviceConnected) { 3956 expect(isDeviceConnected).assertFalse(); 3957 return 3958 } 3959 try { 3960 gPipe.busNum = devices.busNum; 3961 gPipe.devAddress = devices.devAddress; 3962 let tmpConfig = devices.configs[0]; 3963 tmpConfig.interfaces = PARAM_NULL; 3964 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3965 console.info(TAG, 'usb [config.interfaces:null] setConfiguration ret : ', ret); 3966 expect(ret !== null).assertFalse(); 3967 } catch (err) { 3968 console.info(TAG, 'testSetConfigurationParamErr029 catch err code: ', err.code, ', message: ', err.message); 3969 expect(err.code).assertEqual(PARAM_ERRCODE); 3970 } 3971 }) 3972 3973 /** 3974 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0680 3975 * @tc.name : testSetConfigurationParamErr030 3976 * @tc.desc : Negative test: config interfaces is undefined 3977 * @tc.size : MediumTest 3978 * @tc.type : Function 3979 * @tc.level : Level 3 3980 */ 3981 it('testSetConfigurationParamErr030', 0, function () { 3982 console.info(TAG, 'usb testSetConfigurationParamErr030 begin'); 3983 if (!isDeviceConnected) { 3984 expect(isDeviceConnected).assertFalse(); 3985 return 3986 } 3987 try { 3988 gPipe.busNum = devices.busNum; 3989 gPipe.devAddress = devices.devAddress; 3990 let tmpConfig = devices.configs[0]; 3991 tmpConfig.interfaces = PARAM_UNDEFINED; 3992 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 3993 console.info(TAG, 'usb [config.interfaces:undefined] setConfiguration ret : ', ret); 3994 expect(ret !== null).assertFalse(); 3995 } catch (err) { 3996 console.info(TAG, 'testSetConfigurationParamErr030 catch err code: ', err.code, ', message: ', err.message); 3997 expect(err.code).assertEqual(PARAM_ERRCODE); 3998 } 3999 }) 4000 4001 /** 4002 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0690 4003 * @tc.name : testSetConfigurationParamErr031 4004 * @tc.desc : Negative test: config interfaces is "" 4005 * @tc.size : MediumTest 4006 * @tc.type : Function 4007 * @tc.level : Level 3 4008 */ 4009 it('testSetConfigurationParamErr031', 0, function () { 4010 console.info(TAG, 'usb testSetConfigurationParamErr031 begin'); 4011 if (!isDeviceConnected) { 4012 expect(isDeviceConnected).assertFalse(); 4013 return 4014 } 4015 try { 4016 gPipe.busNum = devices.busNum; 4017 gPipe.devAddress = devices.devAddress; 4018 let tmpConfig = devices.configs[0]; 4019 tmpConfig.interfaces = PARAM_NULLSTRING; 4020 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 4021 console.info(TAG, 'usb [config.interfaces:""] setConfiguration ret : ', ret); 4022 expect(ret !== null).assertFalse(); 4023 } catch (err) { 4024 console.info(TAG, 'testSetConfigurationParamErr031 catch err code: ', err.code, ', message: ', err.message); 4025 expect(err.code).assertEqual(PARAM_ERRCODE); 4026 } 4027 }) 4028 4029 /** 4030 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0710 4031 * @tc.name : testSetConfigurationParamErr032 4032 * @tc.desc : Negative test: config isRemoteWakeup is 123 4033 * @tc.size : MediumTest 4034 * @tc.type : Function 4035 * @tc.level : Level 3 4036 */ 4037 it('testSetConfigurationParamErr032', 0, function () { 4038 console.info(TAG, 'usb testSetConfigurationParamErr032 begin'); 4039 if (!isDeviceConnected) { 4040 expect(isDeviceConnected).assertFalse(); 4041 return 4042 } 4043 try { 4044 gPipe.busNum = devices.busNum; 4045 gPipe.devAddress = devices.devAddress; 4046 let tmpConfig = devices.configs[0]; 4047 tmpConfig.isRemoteWakeup = PARAM_NUMBERTYPE; 4048 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 4049 console.info(TAG, 'usb [config.isRemoteWakeup:123] setConfiguration ret : ', ret); 4050 expect(ret !== null).assertFalse(); 4051 } catch (err) { 4052 console.info(TAG, 'testSetConfigurationParamErr032 catch err code: ', err.code, ', message: ', err.message); 4053 expect(err.code).assertEqual(PARAM_ERRCODE); 4054 } 4055 }) 4056 4057 /** 4058 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0720 4059 * @tc.name : testSetConfigurationParamErr033 4060 * @tc.desc : Negative test: config isSelfPowered is 123 4061 * @tc.size : MediumTest 4062 * @tc.type : Function 4063 * @tc.level : Level 3 4064 */ 4065 it('testSetConfigurationParamErr033', 0, function () { 4066 console.info(TAG, 'usb testSetConfigurationParamErr033 begin'); 4067 if (!isDeviceConnected) { 4068 expect(isDeviceConnected).assertFalse(); 4069 return 4070 } 4071 try { 4072 gPipe.busNum = devices.busNum; 4073 gPipe.devAddress = devices.devAddress; 4074 let tmpConfig = devices.configs[0]; 4075 tmpConfig.isSelfPowered = PARAM_NUMBERTYPE; 4076 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 4077 console.info(TAG, 'usb [config.isSelfPowered:123] setConfiguration ret : ', ret); 4078 expect(ret !== null).assertFalse(); 4079 } catch (err) { 4080 console.info(TAG, 'testSetConfigurationParamErr033 catch err code: ', err.code, ', message: ', err.message); 4081 expect(err.code).assertEqual(PARAM_ERRCODE); 4082 } 4083 }) 4084 4085 /** 4086 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0730 4087 * @tc.name : testSetConfigurationParamErr034 4088 * @tc.desc : Negative test: config interfaces is 123 4089 * @tc.size : MediumTest 4090 * @tc.type : Function 4091 * @tc.level : Level 3 4092 */ 4093 it('testSetConfigurationParamErr034', 0, function () { 4094 console.info(TAG, 'usb testSetConfigurationParamErr034 begin'); 4095 if (!isDeviceConnected) { 4096 expect(isDeviceConnected).assertFalse(); 4097 return 4098 } 4099 try { 4100 gPipe.busNum = devices.busNum; 4101 gPipe.devAddress = devices.devAddress; 4102 let tmpConfig = devices.configs[0]; 4103 tmpConfig.interfaces = PARAM_NUMBERTYPE; 4104 let ret = usbManager.setConfiguration(gPipe, tmpConfig); 4105 console.info(TAG, 'usb [config.interfaces:123] setConfiguration ret : ', ret); 4106 expect(ret !== null).assertFalse(); 4107 } catch (err) { 4108 console.info(TAG, 'testSetConfigurationParamErr034 catch err code: ', err.code, ', message: ', err.message); 4109 expect(err.code).assertEqual(PARAM_ERRCODE); 4110 } 4111 }) 4112 4113 /** 4114 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0740 4115 * @tc.name : testSetInterfaceParamErr001 4116 * @tc.desc : Negative test: Enter three parameters 4117 * @tc.size : MediumTest 4118 * @tc.type : Function 4119 * @tc.level : Level 3 4120 */ 4121 it('testSetInterfaceParamErr001', 0, function () { 4122 console.info(TAG, 'usb testSetInterfaceParamErr001 begin'); 4123 if (!isDeviceConnected) { 4124 expect(isDeviceConnected).assertFalse(); 4125 return 4126 } 4127 getPipe('testSetInterfaceParamErr001'); 4128 let tmpInterface = devices.configs[0].interfaces[0]; 4129 let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true); 4130 expect(isClaim).assertEqual(0); 4131 try { 4132 let ret = usbManager.setInterface(gPipe, tmpInterface, gPipe); 4133 console.info(TAG, 'usb [Enter three parameters] setInterface ret : ', ret); 4134 expect(ret).assertEqual(0); 4135 } catch (err) { 4136 console.info(TAG, 'testSetInterfaceParamErr001 catch err code: ', err.code, ', message: ', err.message); 4137 expect(err !== null).assertFalse(); 4138 } 4139 toReleaseInterface('testSetInterfaceParamErr001', tmpInterface); 4140 toClosePipe('testSetInterfaceParamErr001'); 4141 }) 4142 4143 /** 4144 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0750 4145 * @tc.name : testSetInterfaceParamErr002 4146 * @tc.desc : Negative test: Param is null 4147 * @tc.size : MediumTest 4148 * @tc.type : Function 4149 * @tc.level : Level 3 4150 */ 4151 it('testSetInterfaceParamErr002', 0, function () { 4152 console.info(TAG, 'usb testSetInterfaceParamErr002 begin'); 4153 if (!isDeviceConnected) { 4154 expect(isDeviceConnected).assertFalse(); 4155 return 4156 } 4157 try { 4158 let ret = usbManager.setInterface(PARAM_NULL); 4159 console.info(TAG, 'usb [param:null] setInterface ret : ', ret); 4160 expect(ret !== null).assertFalse(); 4161 } catch (err) { 4162 console.info(TAG, 'testSetInterfaceParamErr002 catch err code: ', err.code, ', message: ', err.message); 4163 expect(err.code).assertEqual(PARAM_ERRCODE); 4164 } 4165 }) 4166 4167 /** 4168 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0760 4169 * @tc.name : testSetInterfaceParamErr003 4170 * @tc.desc : Negative test: Param is undefined 4171 * @tc.size : MediumTest 4172 * @tc.type : Function 4173 * @tc.level : Level 3 4174 */ 4175 it('testSetInterfaceParamErr003', 0, function () { 4176 console.info(TAG, 'usb testSetInterfaceParamErr003 begin'); 4177 if (!isDeviceConnected) { 4178 expect(isDeviceConnected).assertFalse(); 4179 return 4180 } 4181 try { 4182 let ret = usbManager.setInterface(PARAM_UNDEFINED); 4183 console.info(TAG, 'usb [param:undefined] setInterface ret : ', ret); 4184 expect(ret !== null).assertFalse(); 4185 } catch (err) { 4186 console.info(TAG, 'testSetInterfaceParamErr003 catch err code: ', err.code, ', message: ', err.message); 4187 expect(err.code).assertEqual(PARAM_ERRCODE); 4188 } 4189 }) 4190 4191 /** 4192 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0770 4193 * @tc.name : testSetInterfaceParamErr004 4194 * @tc.desc : Negative test: Param is "" 4195 * @tc.size : MediumTest 4196 * @tc.type : Function 4197 * @tc.level : Level 3 4198 */ 4199 it('testSetInterfaceParamErr004', 0, function () { 4200 console.info(TAG, 'usb testSetInterfaceParamErr004 begin'); 4201 if (!isDeviceConnected) { 4202 expect(isDeviceConnected).assertFalse(); 4203 return 4204 } 4205 try { 4206 let ret = usbManager.setInterface(PARAM_NULLSTRING); 4207 console.info(TAG, 'usb [param:""] setInterface ret : ', ret); 4208 expect(ret !== null).assertFalse(); 4209 } catch (err) { 4210 console.info(TAG, 'testSetInterfaceParamErr004 catch err code: ', err.code, ', message: ', err.message); 4211 expect(err.code).assertEqual(PARAM_ERRCODE); 4212 } 4213 }) 4214 4215 /** 4216 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0780 4217 * @tc.name : testSetInterfaceParamErr005 4218 * @tc.desc : Negative test: pipe is null 4219 * @tc.size : MediumTest 4220 * @tc.type : Function 4221 * @tc.level : Level 3 4222 */ 4223 it('testSetInterfaceParamErr005', 0, function () { 4224 console.info(TAG, 'usb testSetInterfaceParamErr005 begin'); 4225 if (!isDeviceConnected) { 4226 expect(isDeviceConnected).assertFalse(); 4227 return 4228 } 4229 try { 4230 let tmpInterface = devices.configs[0].interfaces[0]; 4231 let ret = usbManager.setInterface(PARAM_NULL, tmpInterface); 4232 console.info(TAG, 'usb [pipe:null] setInterface ret : ', ret); 4233 expect(ret !== null).assertFalse(); 4234 } catch (err) { 4235 console.info(TAG, 'testSetInterfaceParamErr005 catch err code: ', err.code, ', message: ', err.message); 4236 expect(err.code).assertEqual(PARAM_ERRCODE); 4237 } 4238 }) 4239 4240 /** 4241 * @tc.number : SUB_USB_HostManager_JS_ParamErr_0790 4242 * @tc.name : testSetInterfaceParamErr006 4243 * @tc.desc : Negative test: pipe is undefined 4244 * @tc.size : MediumTest 4245 * @tc.type : Function 4246 * @tc.level : Level 3 4247 */ 4248 it('testSetInterfaceParamErr006', 0, function () { 4249 console.info(TAG, 'usb testSetInterfaceParamErr006 begin'); 4250 if (!isDeviceConnected) { 4251 expect(isDeviceConnected).assertFalse(); 4252 return 4253 } 4254 try { 4255 let tmpInterface = devices.configs[0].interfaces[0]; 4256 let ret = usbManager.setInterface(PARAM_UNDEFINED, tmpInterface); 4257 console.info(TAG, 'usb [pipe:undefined] setInterface ret : ', ret); 4258 expect(ret !== null).assertFalse(); 4259 } catch (err) { 4260 console.info(TAG, 'testSetInterfaceParamErr006 catch err code: ', err.code, ', message: ', err.message); 4261 expect(err.code).assertEqual(PARAM_ERRCODE); 4262 } 4263 }) 4264}) 4265}