Add "empty" to confirm no transfers are in flight in fakeusb.

Update endpoint_test - if buffer length is 0, no transfer is submitted.
This commit is contained in:
Sebastian Zagrodzki
2017-04-29 01:35:09 +02:00
parent c2d1a4c03d
commit b39b8d9521
2 changed files with 40 additions and 26 deletions

View File

@@ -296,6 +296,11 @@ func (f *fakeLibusb) waitForSubmitted() *fakeTransfer {
return <-f.submitted
}
// empty can be used to confirm that all transfers were cleaned up.
func (f *fakeLibusb) empty() bool {
return len(f.submitted) == 0
}
func newFakeLibusb() (*fakeLibusb, func() error) {
origLibusb := libusb
fl := &fakeLibusb{