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

Unified Diff: apps/saved_devices_service_unittest.cc

Issue 601073002: Move string descriptor getters from UsbDeviceHandle to UsbDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix function order. Created 6 years, 3 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 | « apps/saved_devices_service.cc ('k') | chrome/browser/devtools/device/usb/android_usb_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/saved_devices_service_unittest.cc
diff --git a/apps/saved_devices_service_unittest.cc b/apps/saved_devices_service_unittest.cc
index b2ed54451b006c6c7b0157cfea15ed172af3a983..b48e8a67e908780cd709ef78d689d9c131bf0777 100644
--- a/apps/saved_devices_service_unittest.cc
+++ b/apps/saved_devices_service_unittest.cc
@@ -25,88 +25,27 @@ using device::UsbEndpointDirection;
using device::UsbTransferCallback;
using testing::Return;
-class MockUsbDeviceHandle : public UsbDeviceHandle {
- public:
- MockUsbDeviceHandle(const std::string& serial_number)
- : UsbDeviceHandle(), serial_number_(serial_number) {}
-
- MOCK_CONST_METHOD0(GetDevice, scoped_refptr<UsbDevice>());
- MOCK_METHOD0(Close, void());
-
- MOCK_METHOD10(ControlTransfer,
- void(UsbEndpointDirection direction,
- TransferRequestType request_type,
- TransferRecipient recipient,
- uint8 request,
- uint16 value,
- uint16 index,
- net::IOBuffer* buffer,
- size_t length,
- unsigned int timeout,
- const UsbTransferCallback& callback));
-
- MOCK_METHOD6(BulkTransfer,
- void(UsbEndpointDirection direction,
- uint8 endpoint,
- net::IOBuffer* buffer,
- size_t length,
- unsigned int timeout,
- const UsbTransferCallback& callback));
-
- MOCK_METHOD6(InterruptTransfer,
- void(UsbEndpointDirection direction,
- uint8 endpoint,
- net::IOBuffer* buffer,
- size_t length,
- unsigned int timeout,
- const UsbTransferCallback& callback));
-
- MOCK_METHOD8(IsochronousTransfer,
- void(UsbEndpointDirection direction,
- uint8 endpoint,
- net::IOBuffer* buffer,
- size_t length,
- unsigned int packets,
- unsigned int packet_length,
- unsigned int timeout,
- const UsbTransferCallback& callback));
-
- MOCK_METHOD0(ResetDevice, bool());
- MOCK_METHOD1(ClaimInterface, bool(int interface_number));
- MOCK_METHOD1(ReleaseInterface, bool(int interface_number));
- MOCK_METHOD2(SetInterfaceAlternateSetting,
- bool(int interface_number, int alternate_setting));
- MOCK_METHOD1(GetManufacturer, bool(base::string16* manufacturer));
- MOCK_METHOD1(GetProduct, bool(base::string16* product));
-
- bool GetSerial(base::string16* serial) OVERRIDE {
- if (serial_number_.empty()) {
- return false;
- }
-
- *serial = base::UTF8ToUTF16(serial_number_);
- return true;
- }
-
- private:
- virtual ~MockUsbDeviceHandle() {}
-
- const std::string serial_number_;
-};
-
class MockUsbDevice : public UsbDevice {
public:
MockUsbDevice(const std::string& serial_number, uint32 unique_id)
: UsbDevice(0, 0, unique_id), serial_number_(serial_number) {}
+ MOCK_METHOD0(Open, scoped_refptr<UsbDeviceHandle>());
MOCK_METHOD1(Close, bool(scoped_refptr<UsbDeviceHandle>));
#if defined(OS_CHROMEOS)
MOCK_METHOD2(RequestUsbAccess, void(int, const base::Callback<void(bool)>&));
#endif
MOCK_METHOD0(GetConfiguration, const device::UsbConfigDescriptor&());
+ MOCK_METHOD1(GetManufacturer, bool(base::string16*));
+ MOCK_METHOD1(GetProduct, bool(base::string16*));
+
+ bool GetSerialNumber(base::string16* serial) OVERRIDE {
+ if (serial_number_.empty()) {
+ return false;
+ }
- scoped_refptr<UsbDeviceHandle> Open() OVERRIDE {
- return new MockUsbDeviceHandle(serial_number_);
+ *serial = base::UTF8ToUTF16(serial_number_);
+ return true;
}
void NotifyDisconnect() { UsbDevice::NotifyDisconnect(); }
« no previous file with comments | « apps/saved_devices_service.cc ('k') | chrome/browser/devtools/device/usb/android_usb_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698