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

Unified Diff: components/usb_service/usb_device_filter_unittest.cc

Issue 517923002: Add more generic filters to the chrome.usb.getDevices API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Function comments are descriptive. 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 | « components/usb_service/usb_device_filter.cc ('k') | extensions/browser/api/usb/usb_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/usb_service/usb_device_filter_unittest.cc
diff --git a/components/usb_service/usb_device_filter_unittest.cc b/components/usb_service/usb_device_filter_unittest.cc
index a8120682a32ce74aa71086479ec0963094b0a506..c4789ea4b3364e18d8a0b92d1b3b867b75d2877f 100644
--- a/components/usb_service/usb_device_filter_unittest.cc
+++ b/components/usb_service/usb_device_filter_unittest.cc
@@ -237,3 +237,20 @@ TEST_F(UsbFilterTest, MatchInterfaceProtocolNegative) {
filter.SetInterfaceProtocol(0x02);
ASSERT_FALSE(filter.Matches(android_phone_));
}
+
+TEST_F(UsbFilterTest, MatchAnyEmptyListNegative) {
+ std::vector<UsbDeviceFilter> filters;
+ ASSERT_FALSE(UsbDeviceFilter::MatchesAny(android_phone_, filters));
+}
+
+TEST_F(UsbFilterTest, MatchesAnyVendorId) {
+ std::vector<UsbDeviceFilter> filters(1);
+ filters.back().SetVendorId(0x18d1);
+ ASSERT_TRUE(UsbDeviceFilter::MatchesAny(android_phone_, filters));
+}
+
+TEST_F(UsbFilterTest, MatchesAnyVendorIdNegative) {
+ std::vector<UsbDeviceFilter> filters(1);
+ filters.back().SetVendorId(0x1d6b);
+ ASSERT_FALSE(UsbDeviceFilter::MatchesAny(android_phone_, filters));
+}
« no previous file with comments | « components/usb_service/usb_device_filter.cc ('k') | extensions/browser/api/usb/usb_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698