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

Unified Diff: content/browser/bluetooth/bluetooth_blacklist_unittest.cc

Issue 1699673002: bluetooth: Require valid UUIDs when testing against Web Bluetooth Blacklist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-blacklist-integration-
Patch Set: Created 4 years, 10 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
Index: content/browser/bluetooth/bluetooth_blacklist_unittest.cc
diff --git a/content/browser/bluetooth/bluetooth_blacklist_unittest.cc b/content/browser/bluetooth/bluetooth_blacklist_unittest.cc
index bc30ff8a823499bd0ae38d399407b895752b50f8..71affaa8cc7d7927ef66d1d50e23f7efa712f5ed 100644
--- a/content/browser/bluetooth/bluetooth_blacklist_unittest.cc
+++ b/content/browser/bluetooth/bluetooth_blacklist_unittest.cc
@@ -58,6 +58,23 @@ TEST_F(BluetoothBlacklistTest, ExcludeWritesUUID) {
EXPECT_TRUE(blacklist.IsExcludedFromWrites(exclude_writes_uuid));
}
+TEST_F(BluetoothBlacklistTest, InvalidUUID) {
+ BluetoothBlacklist& blacklist = BluetoothBlacklist::Get();
+ BluetoothUUID empty_string_uuid("");
+ EXPECT_DEATH_IF_SUPPORTED(blacklist.IsExcluded(empty_string_uuid), "");
+ EXPECT_DEATH_IF_SUPPORTED(blacklist.IsExcludedFromReads(empty_string_uuid),
+ "");
+ EXPECT_DEATH_IF_SUPPORTED(blacklist.IsExcludedFromWrites(empty_string_uuid),
+ "");
+
+ BluetoothUUID invalid_string_uuid("Not a valid UUID string.");
+ EXPECT_DEATH_IF_SUPPORTED(blacklist.IsExcluded(invalid_string_uuid), "");
+ EXPECT_DEATH_IF_SUPPORTED(blacklist.IsExcludedFromReads(invalid_string_uuid),
+ "");
+ EXPECT_DEATH_IF_SUPPORTED(blacklist.IsExcludedFromWrites(invalid_string_uuid),
+ "");
+}
+
// Abreviated UUIDs used to create, or test against, the blacklist work
// correctly compared to full UUIDs.
TEST_F(BluetoothBlacklistTest, AbreviatedUUIDs) {

Powered by Google App Engine
This is Rietveld 408576698