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")); |
} |