Index: device/usb/usb_device_filter_unittest.cc |
diff --git a/device/usb/usb_device_filter_unittest.cc b/device/usb/usb_device_filter_unittest.cc |
index d66a46289e8eda2ef3c4a90641c44127b1900e58..beb12dfa1c251e9962d00189dd54b207a30ad55f 100644 |
--- a/device/usb/usb_device_filter_unittest.cc |
+++ b/device/usb/usb_device_filter_unittest.cc |
@@ -21,14 +21,16 @@ using testing::Return; |
class MockUsbDevice : public UsbDevice { |
public: |
MockUsbDevice(uint16 vendor_id, uint16 product_id, uint32 unique_id) |
- : UsbDevice(vendor_id, product_id, unique_id) {} |
- |
- MOCK_METHOD0(Open, scoped_refptr<UsbDeviceHandle>()); |
+ : UsbDevice(vendor_id, |
+ product_id, |
+ unique_id, |
+ base::string16(), |
+ base::string16(), |
+ base::string16()) {} |
+ |
+ MOCK_METHOD1(Open, void(const OpenCallback&)); |
MOCK_METHOD1(Close, bool(scoped_refptr<UsbDeviceHandle>)); |
MOCK_METHOD0(GetConfiguration, const device::UsbConfigDescriptor*()); |
- MOCK_METHOD1(GetManufacturer, bool(base::string16*)); |
- MOCK_METHOD1(GetProduct, bool(base::string16*)); |
- MOCK_METHOD1(GetSerialNumber, bool(base::string16*)); |
private: |
virtual ~MockUsbDevice() {} |
@@ -46,8 +48,6 @@ class UsbFilterTest : public testing::Test { |
config_.interfaces.push_back(interface); |
android_phone_ = new MockUsbDevice(0x18d1, 0x4ee2, 0); |
- ON_CALL(*android_phone_.get(), GetConfiguration()) |
- .WillByDefault(Return(&config_)); |
} |
protected: |
@@ -89,12 +89,16 @@ TEST_F(UsbFilterTest, MatchProductIdNegative) { |
TEST_F(UsbFilterTest, MatchInterfaceClass) { |
UsbDeviceFilter filter; |
filter.SetInterfaceClass(0xff); |
+ EXPECT_CALL(*android_phone_.get(), GetConfiguration()) |
+ .WillOnce(Return(&config_)); |
ASSERT_TRUE(filter.Matches(android_phone_)); |
} |
TEST_F(UsbFilterTest, MatchInterfaceClassNegative) { |
UsbDeviceFilter filter; |
filter.SetInterfaceClass(0xe0); |
+ EXPECT_CALL(*android_phone_.get(), GetConfiguration()) |
+ .WillOnce(Return(&config_)); |
ASSERT_FALSE(filter.Matches(android_phone_)); |
} |
@@ -102,6 +106,8 @@ TEST_F(UsbFilterTest, MatchInterfaceSubclass) { |
UsbDeviceFilter filter; |
filter.SetInterfaceClass(0xff); |
filter.SetInterfaceSubclass(0x42); |
+ EXPECT_CALL(*android_phone_.get(), GetConfiguration()) |
+ .WillOnce(Return(&config_)); |
ASSERT_TRUE(filter.Matches(android_phone_)); |
} |
@@ -109,6 +115,8 @@ TEST_F(UsbFilterTest, MatchInterfaceSubclassNegative) { |
UsbDeviceFilter filter; |
filter.SetInterfaceClass(0xff); |
filter.SetInterfaceSubclass(0x01); |
+ EXPECT_CALL(*android_phone_.get(), GetConfiguration()) |
+ .WillOnce(Return(&config_)); |
ASSERT_FALSE(filter.Matches(android_phone_)); |
} |
@@ -117,6 +125,8 @@ TEST_F(UsbFilterTest, MatchInterfaceProtocol) { |
filter.SetInterfaceClass(0xff); |
filter.SetInterfaceSubclass(0x42); |
filter.SetInterfaceProtocol(0x01); |
+ EXPECT_CALL(*android_phone_.get(), GetConfiguration()) |
+ .WillOnce(Return(&config_)); |
ASSERT_TRUE(filter.Matches(android_phone_)); |
} |
@@ -125,6 +135,8 @@ TEST_F(UsbFilterTest, MatchInterfaceProtocolNegative) { |
filter.SetInterfaceClass(0xff); |
filter.SetInterfaceSubclass(0x42); |
filter.SetInterfaceProtocol(0x02); |
+ EXPECT_CALL(*android_phone_.get(), GetConfiguration()) |
+ .WillOnce(Return(&config_)); |
ASSERT_FALSE(filter.Matches(android_phone_)); |
} |