| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/test/usb_test_gadget.h" | 5 #include "device/test/usb_test_gadget.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 struct UsbTestGadgetConfiguration { | 54 struct UsbTestGadgetConfiguration { |
| 55 UsbTestGadget::Type type; | 55 UsbTestGadget::Type type; |
| 56 const char* http_resource; | 56 const char* http_resource; |
| 57 uint16 product_id; | 57 uint16 product_id; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 static const struct UsbTestGadgetConfiguration kConfigurations[] = { | 60 static const struct UsbTestGadgetConfiguration kConfigurations[] = { |
| 61 { UsbTestGadget::DEFAULT, "/unconfigure", 0x2000 }, | 61 { UsbTestGadget::DEFAULT, "/unconfigure", 0x2000 }, |
| 62 { UsbTestGadget::KEYBOARD, "/keyboard/configure", 0x2001 }, | 62 { UsbTestGadget::KEYBOARD, "/keyboard/configure", 0x2001 }, |
| 63 { UsbTestGadget::MOUSE, "/mouse/configure", 0x2002 }, | 63 { UsbTestGadget::MOUSE, "/mouse/configure", 0x2002 }, |
| 64 { UsbTestGadget::HID_ECHO, "/hid_echo/configure", 0x2003 }, |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 class UsbTestGadgetImpl : public UsbTestGadget { | 67 class UsbTestGadgetImpl : public UsbTestGadget { |
| 67 public: | 68 public: |
| 68 virtual ~UsbTestGadgetImpl(); | 69 virtual ~UsbTestGadgetImpl(); |
| 69 | 70 |
| 70 virtual bool Unclaim() OVERRIDE; | 71 virtual bool Unclaim() OVERRIDE; |
| 71 virtual bool Disconnect() OVERRIDE; | 72 virtual bool Disconnect() OVERRIDE; |
| 72 virtual bool Reconnect() OVERRIDE; | 73 virtual bool Reconnect() OVERRIDE; |
| 73 virtual bool SetType(Type type) OVERRIDE; | 74 virtual bool SetType(Type type) OVERRIDE; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 526 } |
| 526 PlatformThread::Sleep(TimeDelta::FromMilliseconds(kRetryPeriod)); | 527 PlatformThread::Sleep(TimeDelta::FromMilliseconds(kRetryPeriod)); |
| 527 } | 528 } |
| 528 VLOG(1) << "It took " << (kDisconnectRetries - retries) | 529 VLOG(1) << "It took " << (kDisconnectRetries - retries) |
| 529 << " retries for the device to reconnect."; | 530 << " retries for the device to reconnect."; |
| 530 | 531 |
| 531 return true; | 532 return true; |
| 532 } | 533 } |
| 533 | 534 |
| 534 } // namespace device | 535 } // namespace device |
| OLD | NEW |