Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3632)

Unified Diff: device/usb/usb_device_handle_unittest.cc

Issue 1847183002: Use interface associations to check function permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit and fixed Windows build. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/usb/usb_device_handle_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_device_handle_unittest.cc
diff --git a/device/usb/usb_device_handle_unittest.cc b/device/usb/usb_device_handle_unittest.cc
index 5fac40a55e7c82ef090fb22e2ae54a2e5834bf9d..84072dcddca0ab9e44f99d6afdbd546fd1d0969d 100644
--- a/device/usb/usb_device_handle_unittest.cc
+++ b/device/usb/usb_device_handle_unittest.cc
@@ -132,6 +132,16 @@ TEST_F(UsbDeviceHandleTest, InterruptTransfer) {
handle->ClaimInterface(0, claim_interface.callback());
ASSERT_TRUE(claim_interface.WaitForResult());
+ const UsbInterfaceDescriptor* interface =
+ handle->FindInterfaceByEndpoint(0x81);
+ EXPECT_TRUE(interface);
+ EXPECT_EQ(0, interface->interface_number);
+ interface = handle->FindInterfaceByEndpoint(0x01);
+ EXPECT_TRUE(interface);
+ EXPECT_EQ(0, interface->interface_number);
+ EXPECT_FALSE(handle->FindInterfaceByEndpoint(0x82));
+ EXPECT_FALSE(handle->FindInterfaceByEndpoint(0x02));
+
scoped_refptr<net::IOBufferWithSize> in_buffer(new net::IOBufferWithSize(64));
TestCompletionCallback in_completion;
handle->GenericTransfer(USB_DIRECTION_INBOUND, 0x81, in_buffer.get(),
@@ -190,6 +200,16 @@ TEST_F(UsbDeviceHandleTest, BulkTransfer) {
handle->ClaimInterface(1, claim_interface.callback());
ASSERT_TRUE(claim_interface.WaitForResult());
+ EXPECT_FALSE(handle->FindInterfaceByEndpoint(0x81));
+ EXPECT_FALSE(handle->FindInterfaceByEndpoint(0x01));
+ const UsbInterfaceDescriptor* interface =
+ handle->FindInterfaceByEndpoint(0x82);
+ EXPECT_TRUE(interface);
+ EXPECT_EQ(1, interface->interface_number);
+ interface = handle->FindInterfaceByEndpoint(0x02);
+ EXPECT_TRUE(interface);
+ EXPECT_EQ(1, interface->interface_number);
+
scoped_refptr<net::IOBufferWithSize> in_buffer(
new net::IOBufferWithSize(512));
TestCompletionCallback in_completion;
« no previous file with comments | « device/usb/usb_device_handle_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698