| 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());
|
|
|