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

Unified Diff: device/usb/usb_device_filter_unittest.cc

Issue 1337413003: Match against all configurations in UsbDeviceFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update printer detector tests. Created 5 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 | « device/usb/usb_device_filter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f1d501237fe38dcc69e432cd8f3b26f626c4c64b..303ffa76ce26869a5faffc4fd75de3ebb231e9d7 100644
--- a/device/usb/usb_device_filter_unittest.cc
+++ b/device/usb/usb_device_filter_unittest.cc
@@ -26,13 +26,14 @@ class UsbFilterTest : public testing::Test {
interface.interface_class = 0xFF;
interface.interface_subclass = 0x42;
interface.interface_protocol = 0x01;
- config_.interfaces.push_back(interface);
- android_phone_ = new MockUsbDevice(0x18d1, 0x4ee2);
+ UsbConfigDescriptor config;
+ config.interfaces.push_back(interface);
+
+ android_phone_ = new MockUsbDevice(0x18d1, 0x4ee2, config);
}
protected:
- UsbConfigDescriptor config_;
scoped_refptr<MockUsbDevice> android_phone_;
};
@@ -70,16 +71,12 @@ TEST_F(UsbFilterTest, MatchProductIdNegative) {
TEST_F(UsbFilterTest, MatchInterfaceClass) {
UsbDeviceFilter filter;
filter.SetInterfaceClass(0xff);
- EXPECT_CALL(*android_phone_.get(), GetActiveConfiguration())
- .WillOnce(Return(&config_));
ASSERT_TRUE(filter.Matches(android_phone_));
}
TEST_F(UsbFilterTest, MatchInterfaceClassNegative) {
UsbDeviceFilter filter;
filter.SetInterfaceClass(0xe0);
- EXPECT_CALL(*android_phone_.get(), GetActiveConfiguration())
- .WillOnce(Return(&config_));
ASSERT_FALSE(filter.Matches(android_phone_));
}
@@ -87,8 +84,6 @@ TEST_F(UsbFilterTest, MatchInterfaceSubclass) {
UsbDeviceFilter filter;
filter.SetInterfaceClass(0xff);
filter.SetInterfaceSubclass(0x42);
- EXPECT_CALL(*android_phone_.get(), GetActiveConfiguration())
- .WillOnce(Return(&config_));
ASSERT_TRUE(filter.Matches(android_phone_));
}
@@ -96,8 +91,6 @@ TEST_F(UsbFilterTest, MatchInterfaceSubclassNegative) {
UsbDeviceFilter filter;
filter.SetInterfaceClass(0xff);
filter.SetInterfaceSubclass(0x01);
- EXPECT_CALL(*android_phone_.get(), GetActiveConfiguration())
- .WillOnce(Return(&config_));
ASSERT_FALSE(filter.Matches(android_phone_));
}
@@ -106,8 +99,6 @@ TEST_F(UsbFilterTest, MatchInterfaceProtocol) {
filter.SetInterfaceClass(0xff);
filter.SetInterfaceSubclass(0x42);
filter.SetInterfaceProtocol(0x01);
- EXPECT_CALL(*android_phone_.get(), GetActiveConfiguration())
- .WillOnce(Return(&config_));
ASSERT_TRUE(filter.Matches(android_phone_));
}
@@ -116,8 +107,6 @@ TEST_F(UsbFilterTest, MatchInterfaceProtocolNegative) {
filter.SetInterfaceClass(0xff);
filter.SetInterfaceSubclass(0x42);
filter.SetInterfaceProtocol(0x02);
- EXPECT_CALL(*android_phone_.get(), GetActiveConfiguration())
- .WillOnce(Return(&config_));
ASSERT_FALSE(filter.Matches(android_phone_));
}
« no previous file with comments | « device/usb/usb_device_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698