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

Unified Diff: device/usb/usb_device_handle_unittest.cc

Issue 1897483003: Revert of Replace libusb in the Linux/Chrome OS USB I/O path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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.h ('k') | device/usb/usb_device_handle_usbfs.h » ('j') | 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 f98b2e4e2e825a0bd048b4057e1c1ee288b77a7f..410f5ad73ace8f8b4777b43ff594a710bb2af5ad 100644
--- a/device/usb/usb_device_handle_unittest.cc
+++ b/device/usb/usb_device_handle_unittest.cc
@@ -253,51 +253,21 @@
handle->Close();
}
-TEST_F(UsbDeviceHandleTest, ControlTransfer) {
- if (!UsbTestGadget::IsTestEnabled())
+TEST_F(UsbDeviceHandleTest, SetInterfaceAlternateSetting) {
+ if (!UsbTestGadget::IsTestEnabled()) {
return;
-
- scoped_ptr<UsbTestGadget> gadget =
+ }
+
+ std::unique_ptr<UsbTestGadget> gadget =
UsbTestGadget::Claim(io_thread_->task_runner());
ASSERT_TRUE(gadget.get());
+ ASSERT_TRUE(gadget->SetType(UsbTestGadget::ECHO));
TestOpenCallback open_device;
gadget->GetDevice()->Open(open_device.callback());
scoped_refptr<UsbDeviceHandle> handle = open_device.WaitForResult();
ASSERT_TRUE(handle.get());
- scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(255));
- TestCompletionCallback completion;
- handle->ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD,
- UsbDeviceHandle::DEVICE, 0x06, 0x0301, 0x0409, buffer,
- buffer->size(), 0, completion.callback());
- completion.WaitForResult();
- ASSERT_EQ(USB_TRANSFER_COMPLETED, completion.status());
- const char expected_str[] = "\x18\x03G\0o\0o\0g\0l\0e\0 \0I\0n\0c\0.\0";
- EXPECT_EQ(sizeof(expected_str) - 1, completion.transferred());
- for (size_t i = 0; i < completion.transferred(); ++i) {
- EXPECT_EQ(expected_str[i], buffer->data()[i]) << "Mismatch at index " << i
- << ".";
- }
-
- handle->Close();
-}
-
-TEST_F(UsbDeviceHandleTest, SetInterfaceAlternateSetting) {
- if (!UsbTestGadget::IsTestEnabled()) {
- return;
- }
-
- std::unique_ptr<UsbTestGadget> gadget =
- UsbTestGadget::Claim(io_thread_->task_runner());
- ASSERT_TRUE(gadget.get());
- ASSERT_TRUE(gadget->SetType(UsbTestGadget::ECHO));
-
- TestOpenCallback open_device;
- gadget->GetDevice()->Open(open_device.callback());
- scoped_refptr<UsbDeviceHandle> handle = open_device.WaitForResult();
- ASSERT_TRUE(handle.get());
-
TestResultCallback claim_interface;
handle->ClaimInterface(2, claim_interface.callback());
ASSERT_TRUE(claim_interface.WaitForResult());
« no previous file with comments | « device/usb/usb_device_handle.h ('k') | device/usb/usb_device_handle_usbfs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698