From: Michal Bloch Date: Tue, 27 Oct 2015 18:32:35 +0000 (+0100) Subject: tests: add a better libhusb_close test X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad3f8613ee33e9613568cbfaa5354d6c7fc877a2;p=platform%2Fcore%2Fapi%2Fusb-host.git tests: add a better libhusb_close test 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 --- diff --git a/tests/libhusb-test.c b/tests/libhusb-test.c index 823b842..a67e45d 100644 --- a/tests/libhusb-test.c +++ b/tests/libhusb-test.c @@ -342,6 +342,9 @@ static void test_open_device_vid_pid(void **state) 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)