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

Side by Side Diff: content/browser/bluetooth/bluetooth_blocklist_unittest.cc

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Updating cross-origin-objects-exceptions.html Created 4 years 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 unified diff | Download patch
OLDNEW
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_blocklist.h" 5 #include "content/browser/bluetooth/bluetooth_blocklist.h"
6 6
7 #include "device/bluetooth/bluetooth_uuid.h" 7 #include "device/bluetooth/bluetooth_uuid.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using device::BluetoothUUID; 10 using device::BluetoothUUID;
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 std::vector<BluetoothUUID> expected; 417 std::vector<BluetoothUUID> expected;
418 418
419 list_.RemoveExcludedUUIDs(&options); 419 list_.RemoveExcludedUUIDs(&options);
420 EXPECT_EQ(expected, options.optional_services); 420 EXPECT_EQ(expected, options.optional_services);
421 } 421 }
422 } 422 }
423 423
424 TEST_F(BluetoothBlocklistTest, VerifyDefaultBlocklistSize) { 424 TEST_F(BluetoothBlocklistTest, VerifyDefaultBlocklistSize) {
425 // REMINDER: ADD new blocklist items to tests below for each exclusion type. 425 // REMINDER: ADD new blocklist items to tests below for each exclusion type.
426 EXPECT_EQ(13u, list_.size()); 426 EXPECT_EQ(14u, list_.size());
427 } 427 }
428 428
429 TEST_F(BluetoothBlocklistTest, VerifyDefaultExcludeList) { 429 TEST_F(BluetoothBlocklistTest, VerifyDefaultExcludeList) {
430 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("1800"))); 430 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("1800")));
431 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("1801"))); 431 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("1801")));
432 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("1812"))); 432 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("1812")));
433 EXPECT_TRUE( 433 EXPECT_TRUE(
434 list_.IsExcluded(BluetoothUUID("00001530-1212-efde-1523-785feabcd123"))); 434 list_.IsExcluded(BluetoothUUID("00001530-1212-efde-1523-785feabcd123")));
435 EXPECT_TRUE( 435 EXPECT_TRUE(
436 list_.IsExcluded(BluetoothUUID("f000ffc0-0451-4000-b000-000000000000"))); 436 list_.IsExcluded(BluetoothUUID("f000ffc0-0451-4000-b000-000000000000")));
437 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("00060000"))); 437 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("00060000")));
438 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("fffd"))); 438 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("fffd")));
439 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("2a02"))); 439 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("2a02")));
440 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("2a03"))); 440 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("2a03")));
441 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("2a25"))); 441 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("2a25")));
442 EXPECT_FALSE( 442 EXPECT_FALSE(
443 list_.IsExcluded(BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135"))); 443 list_.IsExcluded(BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135")));
444 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("2902"))); 444 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("2902")));
445 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("2903"))); 445 EXPECT_FALSE(list_.IsExcluded(BluetoothUUID("2903")));
446 EXPECT_TRUE( 446 EXPECT_TRUE(
447 list_.IsExcluded(BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"))); 447 list_.IsExcluded(BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c")));
448 EXPECT_FALSE( 448 EXPECT_FALSE(
449 list_.IsExcluded(BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114"))); 449 list_.IsExcluded(BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114")));
450 EXPECT_TRUE(list_.IsExcluded(BluetoothUUID("bad0")));
450 } 451 }
451 452
452 TEST_F(BluetoothBlocklistTest, VerifyDefaultExcludeReadList) { 453 TEST_F(BluetoothBlocklistTest, VerifyDefaultExcludeReadList) {
453 EXPECT_FALSE(list_.IsExcludedFromReads(BluetoothUUID("1800"))); 454 EXPECT_FALSE(list_.IsExcludedFromReads(BluetoothUUID("1800")));
454 EXPECT_FALSE(list_.IsExcludedFromReads(BluetoothUUID("1801"))); 455 EXPECT_FALSE(list_.IsExcludedFromReads(BluetoothUUID("1801")));
455 EXPECT_TRUE(list_.IsExcludedFromReads(BluetoothUUID("1812"))); 456 EXPECT_TRUE(list_.IsExcludedFromReads(BluetoothUUID("1812")));
456 EXPECT_TRUE(list_.IsExcludedFromReads( 457 EXPECT_TRUE(list_.IsExcludedFromReads(
457 BluetoothUUID("00001530-1212-efde-1523-785feabcd123"))); 458 BluetoothUUID("00001530-1212-efde-1523-785feabcd123")));
458 EXPECT_TRUE(list_.IsExcludedFromReads( 459 EXPECT_TRUE(list_.IsExcludedFromReads(
459 BluetoothUUID("f000ffc0-0451-4000-b000-000000000000"))); 460 BluetoothUUID("f000ffc0-0451-4000-b000-000000000000")));
(...skipping 29 matching lines...) Expand all
489 BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135"))); 490 BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135")));
490 EXPECT_TRUE(list_.IsExcludedFromWrites(BluetoothUUID("2902"))); 491 EXPECT_TRUE(list_.IsExcludedFromWrites(BluetoothUUID("2902")));
491 EXPECT_TRUE(list_.IsExcludedFromWrites(BluetoothUUID("2903"))); 492 EXPECT_TRUE(list_.IsExcludedFromWrites(BluetoothUUID("2903")));
492 EXPECT_TRUE(list_.IsExcludedFromWrites( 493 EXPECT_TRUE(list_.IsExcludedFromWrites(
493 BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"))); 494 BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c")));
494 EXPECT_FALSE(list_.IsExcludedFromWrites( 495 EXPECT_FALSE(list_.IsExcludedFromWrites(
495 BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114"))); 496 BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114")));
496 } 497 }
497 498
498 } // namespace content 499 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698