| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/bluetooth/bluetooth_blacklist.h" | 5 #include "content/browser/bluetooth/bluetooth_blacklist.h" |
| 6 | 6 |
| 7 #include "content/common/bluetooth/bluetooth_scan_filter.h" | 7 #include "content/common/bluetooth/bluetooth_scan_filter.h" |
| 8 #include "device/bluetooth/bluetooth_uuid.h" | 8 #include "device/bluetooth/bluetooth_uuid.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 blacklist.RemoveExcludedUuids(&all_matching_of_many); | 237 blacklist.RemoveExcludedUuids(&all_matching_of_many); |
| 238 EXPECT_EQ(expected_empty, all_matching_of_many); | 238 EXPECT_EQ(expected_empty, all_matching_of_many); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 TEST_F(BluetoothBlacklistTest, VerifyDefaultBlacklistSize) { | 242 TEST_F(BluetoothBlacklistTest, VerifyDefaultBlacklistSize) { |
| 243 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); | 243 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); |
| 244 // When adding items to the blacklist the new values should be added in the | 244 // When adding items to the blacklist the new values should be added in the |
| 245 // tests below for each exclusion type. | 245 // tests below for each exclusion type. |
| 246 EXPECT_EQ(6u, blacklist.size()); | 246 EXPECT_EQ(9u, blacklist.size()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 TEST_F(BluetoothBlacklistTest, VerifyDefaultExcludeList) { | 249 TEST_F(BluetoothBlacklistTest, VerifyDefaultExcludeList) { |
| 250 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); | 250 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); |
| 251 EXPECT_FALSE(blacklist.IsExcluded(BluetoothUUID("1800"))); | 251 EXPECT_FALSE(blacklist.IsExcluded(BluetoothUUID("1800"))); |
| 252 EXPECT_FALSE(blacklist.IsExcluded(BluetoothUUID("1801"))); | 252 EXPECT_FALSE(blacklist.IsExcluded(BluetoothUUID("1801"))); |
| 253 EXPECT_TRUE(blacklist.IsExcluded(BluetoothUUID("1812"))); | 253 EXPECT_TRUE(blacklist.IsExcluded(BluetoothUUID("1812"))); |
| 254 EXPECT_TRUE(blacklist.IsExcluded(BluetoothUUID("2a03"))); | 254 EXPECT_TRUE(blacklist.IsExcluded(BluetoothUUID("2a03"))); |
| 255 EXPECT_TRUE(blacklist.IsExcluded(BluetoothUUID("2a25"))); | 255 EXPECT_TRUE(blacklist.IsExcluded(BluetoothUUID("2a25"))); |
| 256 EXPECT_TRUE(blacklist.IsExcluded( |
| 257 BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"))); |
| 256 } | 258 } |
| 257 | 259 |
| 258 TEST_F(BluetoothBlacklistTest, VerifyDefaultExcludeReadList) { | 260 TEST_F(BluetoothBlacklistTest, VerifyDefaultExcludeReadList) { |
| 259 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); | 261 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); |
| 260 EXPECT_FALSE(blacklist.IsExcludedFromReads(BluetoothUUID("1800"))); | 262 EXPECT_FALSE(blacklist.IsExcludedFromReads(BluetoothUUID("1800"))); |
| 261 EXPECT_FALSE(blacklist.IsExcludedFromReads(BluetoothUUID("1801"))); | 263 EXPECT_FALSE(blacklist.IsExcludedFromReads(BluetoothUUID("1801"))); |
| 262 EXPECT_TRUE(blacklist.IsExcludedFromReads(BluetoothUUID("1812"))); | 264 EXPECT_TRUE(blacklist.IsExcludedFromReads(BluetoothUUID("1812"))); |
| 263 EXPECT_TRUE(blacklist.IsExcludedFromReads(BluetoothUUID("2a03"))); | 265 EXPECT_TRUE(blacklist.IsExcludedFromReads(BluetoothUUID("2a03"))); |
| 264 EXPECT_TRUE(blacklist.IsExcludedFromReads(BluetoothUUID("2a25"))); | 266 EXPECT_TRUE(blacklist.IsExcludedFromReads(BluetoothUUID("2a25"))); |
| 267 EXPECT_TRUE(blacklist.IsExcludedFromReads( |
| 268 BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135"))); |
| 269 EXPECT_TRUE(blacklist.IsExcludedFromReads( |
| 270 BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"))); |
| 271 EXPECT_TRUE(blacklist.IsExcludedFromReads( |
| 272 BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114"))); |
| 265 } | 273 } |
| 266 | 274 |
| 267 TEST_F(BluetoothBlacklistTest, VerifyDefaultExcludeWriteList) { | 275 TEST_F(BluetoothBlacklistTest, VerifyDefaultExcludeWriteList) { |
| 268 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); | 276 BluetoothBlacklist& blacklist = BluetoothBlacklist::Get(); |
| 269 EXPECT_FALSE(blacklist.IsExcludedFromWrites(BluetoothUUID("1800"))); | 277 EXPECT_FALSE(blacklist.IsExcludedFromWrites(BluetoothUUID("1800"))); |
| 270 EXPECT_FALSE(blacklist.IsExcludedFromWrites(BluetoothUUID("1801"))); | 278 EXPECT_FALSE(blacklist.IsExcludedFromWrites(BluetoothUUID("1801"))); |
| 271 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("1812"))); | 279 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("1812"))); |
| 272 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2a02"))); | 280 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2a02"))); |
| 273 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2a03"))); | 281 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2a03"))); |
| 274 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2a25"))); | 282 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2a25"))); |
| 275 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2902"))); | 283 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2902"))); |
| 276 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2903"))); | 284 EXPECT_TRUE(blacklist.IsExcludedFromWrites(BluetoothUUID("2903"))); |
| 285 EXPECT_TRUE(blacklist.IsExcludedFromWrites( |
| 286 BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"))); |
| 277 } | 287 } |
| 278 | 288 |
| 279 } // namespace content | 289 } // namespace content |
| OLD | NEW |