| Index: device/hid/hid_connection_unittest.cc | 
| diff --git a/device/hid/hid_connection_unittest.cc b/device/hid/hid_connection_unittest.cc | 
| index e474a6259c875d903adfb0e528ac2ed28455b3e2..b0361982a15391643f09eac22ac9af95a7a8b221 100644 | 
| --- a/device/hid/hid_connection_unittest.cc | 
| +++ b/device/hid/hid_connection_unittest.cc | 
| @@ -10,10 +10,12 @@ | 
| #include "base/memory/scoped_ptr.h" | 
| #include "base/run_loop.h" | 
| #include "base/scoped_observer.h" | 
| +#include "base/strings/utf_string_conversions.h" | 
| #include "base/test/test_io_thread.h" | 
| #include "device/hid/hid_connection.h" | 
| #include "device/hid/hid_service.h" | 
| #include "device/test/usb_test_gadget.h" | 
| +#include "device/usb/usb_device.h" | 
| #include "net/base/io_buffer.h" | 
| #include "testing/gtest/include/gtest/gtest.h" | 
|  | 
| @@ -23,20 +25,6 @@ namespace { | 
|  | 
| using net::IOBufferWithSize; | 
|  | 
| -void ClaimTestDevice(scoped_ptr<UsbTestGadget>* gadget) { | 
| -  base::MessageLoop::ScopedNestableTaskAllower allow( | 
| -      base::MessageLoop::current()); | 
| -  *gadget = UsbTestGadget::Claim(); | 
| -  ASSERT_TRUE(*gadget); | 
| -  ASSERT_TRUE((*gadget)->SetType(UsbTestGadget::HID_ECHO)); | 
| -} | 
| - | 
| -void UnclaimTestDevice(scoped_ptr<UsbTestGadget> gadget) { | 
| -  base::MessageLoop::ScopedNestableTaskAllower allow( | 
| -      base::MessageLoop::current()); | 
| -  ASSERT_TRUE(gadget->Unclaim()); | 
| -} | 
| - | 
| // Helper class that can be used to block until a HID device with a particular | 
| // serial number is available. Example usage: | 
| // | 
| @@ -46,10 +34,8 @@ void UnclaimTestDevice(scoped_ptr<UsbTestGadget> gadget) { | 
| // | 
| class DeviceCatcher : HidService::Observer { | 
| public: | 
| -  DeviceCatcher(const std::string& serial_number) | 
| -      : serial_number_(serial_number), observer_(this) { | 
| -    HidService* hid_service = HidService::GetInstance( | 
| -        base::MessageLoop::current()->message_loop_proxy()); | 
| +  DeviceCatcher(HidService* hid_service, const base::string16& serial_number) | 
| +      : serial_number_(base::UTF16ToUTF8(serial_number)), observer_(this) { | 
| observer_.Add(hid_service); | 
| hid_service->GetDevices(base::Bind(&DeviceCatcher::OnEnumerationComplete, | 
| base::Unretained(this))); | 
| @@ -168,23 +154,16 @@ class HidConnectionTest : public testing::Test { | 
| service_ = HidService::GetInstance(io_thread_->task_runner()); | 
| ASSERT_TRUE(service_); | 
|  | 
| -    io_thread_->PostTaskAndWait(FROM_HERE, | 
| -                                base::Bind(&ClaimTestDevice, &test_gadget_)); | 
| +    test_gadget_ = UsbTestGadget::Claim(io_thread_->task_runner()); | 
| ASSERT_TRUE(test_gadget_); | 
| +    ASSERT_TRUE(test_gadget_->SetType(UsbTestGadget::HID_ECHO)); | 
|  | 
| -    DeviceCatcher device_catcher(test_gadget_->GetSerialNumber()); | 
| +    DeviceCatcher device_catcher(service_, | 
| +                                 test_gadget_->GetDevice()->serial_number()); | 
| device_id_ = device_catcher.WaitForDevice(); | 
| ASSERT_NE(device_id_, kInvalidHidDeviceId); | 
| } | 
|  | 
| -  void TearDown() override { | 
| -    if (io_thread_) { | 
| -      io_thread_->PostTaskAndWait( | 
| -          FROM_HERE, | 
| -          base::Bind(&UnclaimTestDevice, base::Passed(&test_gadget_))); | 
| -    } | 
| -  } | 
| - | 
| scoped_ptr<base::MessageLoopForUI> message_loop_; | 
| scoped_ptr<base::TestIOThread> io_thread_; | 
| HidService* service_; | 
|  |