Since libhusb_device_open_with_vid_pid creates
a device handle with the necessary properties,
i.e. containing a real libusb_device_handle, it
can be used for the libhusb_close test.
This also fixes a memory leak because the handle
was not else deallocated.
The old libhusb_close test (manual allocation
of the libusb_device_handle) stays because it
allows more flexibility as we have control over
what the libusb_device_handle contains, unlike
when using libhusb_device_open_with_vid_pid.
Change-Id: Ic2a77f458023e1e3099ff2e2623fa35730e6bebb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
assert_ptr_equal(handle->lusb_dev_handle, lusb_dev_handle);
assert_non_null(handle->device);
assert_ptr_equal(handle->device->lusb_dev, lusb_device);
+
+ expect_value (libusb_close, dev_handle, handle->lusb_dev_handle);
+ libhusb_close(handle);
}
static void test_set_config(void **state)