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

Unified Diff: extensions/browser/api/usb/usb_apitest.cc

Issue 567003002: Revert of Convert device::UsbConfigDescriptor and friends to structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « extensions/browser/api/usb/usb_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/usb/usb_apitest.cc
diff --git a/extensions/browser/api/usb/usb_apitest.cc b/extensions/browser/api/usb/usb_apitest.cc
index eea26c57c06f37420864506b3a420ed4b15ce87f..c3cd1a137324f1b1141eafe45659e563e1cf6271 100644
--- a/extensions/browser/api/usb/usb_apitest.cc
+++ b/extensions/browser/api/usb/usb_apitest.cc
@@ -14,7 +14,6 @@
using testing::AnyNumber;
using testing::_;
using testing::Return;
-using testing::ReturnRef;
using content::BrowserThread;
using device::UsbConfigDescriptor;
using device::UsbDevice;
@@ -107,6 +106,16 @@
virtual ~MockUsbDeviceHandle() {}
};
+class MockUsbConfigDescriptor : public UsbConfigDescriptor {
+ public:
+ MOCK_CONST_METHOD0(GetNumInterfaces, size_t());
+ MOCK_CONST_METHOD1(GetInterface,
+ scoped_refptr<const UsbInterfaceDescriptor>(size_t index));
+
+ protected:
+ virtual ~MockUsbConfigDescriptor() {}
+};
+
class MockUsbDevice : public UsbDevice {
public:
explicit MockUsbDevice(MockUsbDeviceHandle* mock_handle)
@@ -132,7 +141,7 @@
}
#endif // OS_CHROMEOS
- MOCK_METHOD0(GetConfiguration, const UsbConfigDescriptor&());
+ MOCK_METHOD0(ListInterfaces, scoped_refptr<UsbConfigDescriptor>());
private:
MockUsbDeviceHandle* mock_handle_;
@@ -216,10 +225,12 @@
}
IN_PROC_BROWSER_TEST_F(UsbApiTest, ListInterfaces) {
- UsbConfigDescriptor config_descriptor;
- EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber());
- EXPECT_CALL(*mock_device_.get(), GetConfiguration())
- .WillOnce(ReturnRef(config_descriptor));
+ scoped_refptr<MockUsbConfigDescriptor> mock_descriptor =
+ new MockUsbConfigDescriptor();
+ EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber());
+ EXPECT_CALL(*mock_descriptor.get(), GetNumInterfaces()).WillOnce(Return(0));
+ EXPECT_CALL(*mock_device_.get(), ListInterfaces())
+ .WillOnce(Return(mock_descriptor));
ASSERT_TRUE(RunExtensionTest("usb/list_interfaces"));
}
« no previous file with comments | « extensions/browser/api/usb/usb_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698