Commit db9f2761 authored by reillyg's avatar reillyg Committed by Commit bot

Remove extra call to UsbDeviceHandle::Close in chrome.usb.closeDevice.

When chrome.usb.closeDevice is called the device is explicitly closed in
the extension function implementation and then closed again when the
UsbDeviceResource object is destroyed. Only the latter is necessary as
that covers other ways in which the resource can be released.

Review URL: https://codereview.chromium.org/881363004

Cr-Commit-Position: refs/heads/master@{#313605}
parent ea2760c1
......@@ -940,7 +940,7 @@ void UsbCloseDeviceFunction::AsyncWorkStart() {
if (!device_handle.get())
return;
device_handle->Close();
// The device handle is closed when the resource is destroyed.
RemoveUsbDeviceResource(parameters_->handle.handle);
AsyncWorkCompleted();
}
......
......@@ -200,7 +200,7 @@ class UsbApiTest : public ShellApiTest {
} // namespace
IN_PROC_BROWSER_TEST_F(UsbApiTest, DeviceHandling) {
EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(4);
EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(2);
ASSERT_TRUE(RunAppTest("api_test/usb/device_handling"));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment