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

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: added check when adding uuid. 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
« no previous file with comments | « content/browser/bluetooth/bluetooth_blacklist.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5c9b67410f7e138dbef9ce681f790dca37b22fa4 100644
--- a/content/browser/bluetooth/bluetooth_blacklist_unittest.cc
+++ b/content/browser/bluetooth/bluetooth_blacklist_unittest.cc
@@ -58,6 +58,30 @@ 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.AddOrDie(empty_string_uuid, BluetoothBlacklist::Value::EXCLUDE),
+ "");
+ 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.AddOrDie(invalid_string_uuid,
+ BluetoothBlacklist::Value::EXCLUDE),
+ "");
+ 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) {
« no previous file with comments | « content/browser/bluetooth/bluetooth_blacklist.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698