Пример #1
0
  private void clearOutTheINEventAndIrpListForISO(List listOfPipeEvents, List listOfIrps) {
    // all of the IRPs and events in which we are interested SHOULD have a non zero length
    // amount of data returned.
    // Once the zero length data IRPs and events are removed, only the IRPs and events that received
    // the
    // expected OUT data should be left in the lists
    printDebug("Total pipe events for IN ISO is " + listOfPipeEvents.size());

    for (int i = (listOfPipeEvents.size() - 1); i >= 0; i--) {
      // all of the IRPs in which we are interested SHOULD have a non zero length
      // amount of data returned.
      // Once the zero length data IRP events are removed, only the IRP events that received the
      // expected OUT data should be left in the list

      Assert.assertTrue(
          "There should be no error events in the list.",
          ((UsbPipeEvent) listOfPipeEvents.get(i)).getClass() == UsbPipeDataEvent.class);
      if (((UsbPipeDataEvent) listOfPipeEvents.get(i)).getUsbIrp().getActualLength() == 0) {
        listOfPipeEvents.remove(i);
        Assert.assertEquals(
            "Original Irps and pipe event Irps should be zero actual length in the same position in the list.",
            0,
            ((UsbIrp) listOfIrps.get(i)).getActualLength());
        listOfIrps.remove(i);
      } else {
        Assert.assertEquals(
            "Original Irps and pipe event Irps actual length should be the same at the same position in the list.",
            ((UsbPipeDataEvent) listOfPipeEvents.get(i)).getUsbIrp().getActualLength(),
            ((UsbIrp) listOfIrps.get(i)).getActualLength());
        printDebug("Non-zero actual length pipe event found at index " + i);
      }
    }
    Assert.assertFalse(
        "None of the Isochronous IN IRPs received any data", 0 == listOfPipeEvents.size());
  };