| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 310 |
| 311 // Duplicate read reported from OS shouldn't cause a problem: | 311 // Duplicate read reported from OS shouldn't cause a problem: |
| 312 SimulateGattCharacteristicRead(characteristic1_, empty_vector); | 312 SimulateGattCharacteristicRead(characteristic1_, empty_vector); |
| 313 | 313 |
| 314 EXPECT_EQ(1, gatt_read_characteristic_attempts_); | 314 EXPECT_EQ(1, gatt_read_characteristic_attempts_); |
| 315 EXPECT_EQ(empty_vector, last_read_value_); | 315 EXPECT_EQ(empty_vector, last_read_value_); |
| 316 EXPECT_EQ(empty_vector, characteristic1_->GetValue()); | 316 EXPECT_EQ(empty_vector, characteristic1_->GetValue()); |
| 317 } | 317 } |
| 318 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 318 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 319 | 319 |
| 320 #if defined(OS_ANDROID) || defined(OS_WIN) | 320 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 321 // Tests WriteRemoteCharacteristic with empty value buffer. | 321 // Tests WriteRemoteCharacteristic with empty value buffer. |
| 322 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic_Empty) { | 322 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic_Empty) { |
| 323 if (!PlatformSupportsLowEnergy()) { |
| 324 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 325 return; |
| 326 } |
| 323 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 327 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 324 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 328 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 325 | 329 |
| 326 std::vector<uint8_t> empty_vector; | 330 std::vector<uint8_t> empty_vector; |
| 327 characteristic1_->WriteRemoteCharacteristic( | 331 characteristic1_->WriteRemoteCharacteristic( |
| 328 empty_vector, GetCallback(Call::EXPECTED), | 332 empty_vector, GetCallback(Call::EXPECTED), |
| 329 GetGattErrorCallback(Call::NOT_EXPECTED)); | 333 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 330 SimulateGattCharacteristicWrite(characteristic1_); | 334 SimulateGattCharacteristicWrite(characteristic1_); |
| 331 EXPECT_EQ(1, gatt_write_characteristic_attempts_); | 335 EXPECT_EQ(1, gatt_write_characteristic_attempts_); |
| 332 | 336 |
| 333 // Duplicate write reported from OS shouldn't cause a problem: | 337 // Duplicate write reported from OS shouldn't cause a problem: |
| 334 SimulateGattCharacteristicWrite(characteristic1_); | 338 SimulateGattCharacteristicWrite(characteristic1_); |
| 335 | 339 |
| 336 EXPECT_EQ(empty_vector, last_write_value_); | 340 EXPECT_EQ(empty_vector, last_write_value_); |
| 337 } | 341 } |
| 338 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 342 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 339 | 343 |
| 340 #if defined(OS_ANDROID) || defined(OS_WIN) | 344 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 341 // Tests ReadRemoteCharacteristic completing after Chrome objects are deleted. | 345 // Tests ReadRemoteCharacteristic completing after Chrome objects are deleted. |
| 342 // This test is not relevant for macOS. This can never happen if CBPeripheral | 346 // This test is not relevant for macOS. This can never happen if CBPeripheral |
| 343 // delegate is set to nil. | 347 // delegate is set to nil. |
| 344 TEST_F(BluetoothRemoteGattCharacteristicTest, | 348 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 345 ReadRemoteCharacteristic_AfterDeleted) { | 349 ReadRemoteCharacteristic_AfterDeleted) { |
| 346 if (!PlatformSupportsLowEnergy()) { | 350 if (!PlatformSupportsLowEnergy()) { |
| 347 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; | 351 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 348 return; | 352 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 363 EXPECT_TRUE("Did not crash!"); | 367 EXPECT_TRUE("Did not crash!"); |
| 364 } | 368 } |
| 365 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 369 #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| 366 | 370 |
| 367 #if defined(OS_ANDROID) || defined(OS_WIN) | 371 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 368 // Tests WriteRemoteCharacteristic completing after Chrome objects are deleted. | 372 // Tests WriteRemoteCharacteristic completing after Chrome objects are deleted. |
| 369 // This test is not relevant for macOS. This can never happen if CBPeripheral | 373 // This test is not relevant for macOS. This can never happen if CBPeripheral |
| 370 // delegate is set to nil. | 374 // delegate is set to nil. |
| 371 TEST_F(BluetoothRemoteGattCharacteristicTest, | 375 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 372 WriteRemoteCharacteristic_AfterDeleted) { | 376 WriteRemoteCharacteristic_AfterDeleted) { |
| 377 if (!PlatformSupportsLowEnergy()) { |
| 378 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 379 return; |
| 380 } |
| 373 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 381 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 374 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 382 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 375 | 383 |
| 376 std::vector<uint8_t> empty_vector; | 384 std::vector<uint8_t> empty_vector; |
| 377 characteristic1_->WriteRemoteCharacteristic( | 385 characteristic1_->WriteRemoteCharacteristic( |
| 378 empty_vector, GetCallback(Call::NOT_EXPECTED), | 386 empty_vector, GetCallback(Call::NOT_EXPECTED), |
| 379 GetGattErrorCallback(Call::NOT_EXPECTED)); | 387 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 380 | 388 |
| 381 RememberCharacteristicForSubsequentAction(characteristic1_); | 389 RememberCharacteristicForSubsequentAction(characteristic1_); |
| 382 DeleteDevice(device_); // TODO(576906) delete only the characteristic. | 390 DeleteDevice(device_); // TODO(576906) delete only the characteristic. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 451 |
| 444 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); | 452 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); |
| 445 EXPECT_EQ(characteristic1_->GetIdentifier(), | 453 EXPECT_EQ(characteristic1_->GetIdentifier(), |
| 446 observer.last_gatt_characteristic_id()); | 454 observer.last_gatt_characteristic_id()); |
| 447 EXPECT_EQ(characteristic1_->GetUUID(), | 455 EXPECT_EQ(characteristic1_->GetUUID(), |
| 448 observer.last_gatt_characteristic_uuid()); | 456 observer.last_gatt_characteristic_uuid()); |
| 449 EXPECT_EQ(test_vector, observer.last_changed_characteristic_value()); | 457 EXPECT_EQ(test_vector, observer.last_changed_characteristic_value()); |
| 450 } | 458 } |
| 451 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 459 #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| 452 | 460 |
| 453 #if defined(OS_ANDROID) || defined(OS_WIN) | 461 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 454 // Tests WriteRemoteCharacteristic with non-empty value buffer. | 462 // Tests WriteRemoteCharacteristic with non-empty value buffer. |
| 455 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic) { | 463 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic) { |
| 464 if (!PlatformSupportsLowEnergy()) { |
| 465 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 466 return; |
| 467 } |
| 456 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 468 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 457 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 469 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 458 | 470 |
| 459 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; | 471 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; |
| 460 std::vector<uint8_t> test_vector(values, values + arraysize(values)); | 472 std::vector<uint8_t> test_vector(values, values + arraysize(values)); |
| 461 characteristic1_->WriteRemoteCharacteristic( | 473 characteristic1_->WriteRemoteCharacteristic( |
| 462 test_vector, GetCallback(Call::EXPECTED), | 474 test_vector, GetCallback(Call::EXPECTED), |
| 463 GetGattErrorCallback(Call::NOT_EXPECTED)); | 475 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 464 | 476 |
| 465 SimulateGattCharacteristicWrite(characteristic1_); | 477 SimulateGattCharacteristicWrite(characteristic1_); |
| 466 | 478 |
| 467 EXPECT_EQ(1, gatt_write_characteristic_attempts_); | 479 EXPECT_EQ(1, gatt_write_characteristic_attempts_); |
| 468 EXPECT_EQ(test_vector, last_write_value_); | 480 EXPECT_EQ(test_vector, last_write_value_); |
| 469 } | 481 } |
| 470 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 482 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 471 | 483 |
| 472 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 484 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 473 // Tests ReadRemoteCharacteristic and GetValue multiple times. | 485 // Tests ReadRemoteCharacteristic and GetValue multiple times. |
| 474 TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic_Twice) { | 486 TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic_Twice) { |
| 475 if (!PlatformSupportsLowEnergy()) { | 487 if (!PlatformSupportsLowEnergy()) { |
| 476 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; | 488 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 477 return; | 489 return; |
| 478 } | 490 } |
| 479 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 491 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 480 BluetoothRemoteGattCharacteristic::PROPERTY_READ)); | 492 BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 500 std::vector<uint8_t> empty_vector; | 512 std::vector<uint8_t> empty_vector; |
| 501 SimulateGattCharacteristicRead(characteristic1_, empty_vector); | 513 SimulateGattCharacteristicRead(characteristic1_, empty_vector); |
| 502 EXPECT_EQ(1, gatt_read_characteristic_attempts_); | 514 EXPECT_EQ(1, gatt_read_characteristic_attempts_); |
| 503 EXPECT_EQ(1, callback_count_); | 515 EXPECT_EQ(1, callback_count_); |
| 504 EXPECT_EQ(0, error_callback_count_); | 516 EXPECT_EQ(0, error_callback_count_); |
| 505 EXPECT_EQ(empty_vector, last_read_value_); | 517 EXPECT_EQ(empty_vector, last_read_value_); |
| 506 EXPECT_EQ(empty_vector, characteristic1_->GetValue()); | 518 EXPECT_EQ(empty_vector, characteristic1_->GetValue()); |
| 507 } | 519 } |
| 508 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 520 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 509 | 521 |
| 510 #if defined(OS_ANDROID) || defined(OS_WIN) | 522 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 511 // Tests WriteRemoteCharacteristic multiple times. | 523 // Tests WriteRemoteCharacteristic multiple times. |
| 512 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic_Twice) { | 524 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic_Twice) { |
| 525 if (!PlatformSupportsLowEnergy()) { |
| 526 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 527 return; |
| 528 } |
| 513 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 529 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 514 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 530 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 515 | 531 |
| 516 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; | 532 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; |
| 517 std::vector<uint8_t> test_vector(values, values + arraysize(values)); | 533 std::vector<uint8_t> test_vector(values, values + arraysize(values)); |
| 518 characteristic1_->WriteRemoteCharacteristic( | 534 characteristic1_->WriteRemoteCharacteristic( |
| 519 test_vector, GetCallback(Call::EXPECTED), | 535 test_vector, GetCallback(Call::EXPECTED), |
| 520 GetGattErrorCallback(Call::NOT_EXPECTED)); | 536 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 521 | 537 |
| 522 SimulateGattCharacteristicWrite(characteristic1_); | 538 SimulateGattCharacteristicWrite(characteristic1_); |
| 523 EXPECT_EQ(1, gatt_write_characteristic_attempts_); | 539 EXPECT_EQ(1, gatt_write_characteristic_attempts_); |
| 524 EXPECT_EQ(1, callback_count_); | 540 EXPECT_EQ(1, callback_count_); |
| 525 EXPECT_EQ(0, error_callback_count_); | 541 EXPECT_EQ(0, error_callback_count_); |
| 526 EXPECT_EQ(test_vector, last_write_value_); | 542 EXPECT_EQ(test_vector, last_write_value_); |
| 527 | 543 |
| 528 // Write again, with different value: | 544 // Write again, with different value: |
| 529 ResetEventCounts(); | 545 ResetEventCounts(); |
| 530 std::vector<uint8_t> empty_vector; | 546 std::vector<uint8_t> empty_vector; |
| 531 characteristic1_->WriteRemoteCharacteristic( | 547 characteristic1_->WriteRemoteCharacteristic( |
| 532 empty_vector, GetCallback(Call::EXPECTED), | 548 empty_vector, GetCallback(Call::EXPECTED), |
| 533 GetGattErrorCallback(Call::NOT_EXPECTED)); | 549 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 534 | 550 |
| 535 SimulateGattCharacteristicWrite(characteristic1_); | 551 SimulateGattCharacteristicWrite(characteristic1_); |
| 536 EXPECT_EQ(1, gatt_write_characteristic_attempts_); | 552 EXPECT_EQ(1, gatt_write_characteristic_attempts_); |
| 537 EXPECT_EQ(1, callback_count_); | 553 EXPECT_EQ(1, callback_count_); |
| 538 EXPECT_EQ(0, error_callback_count_); | 554 EXPECT_EQ(0, error_callback_count_); |
| 539 EXPECT_EQ(empty_vector, last_write_value_); | 555 EXPECT_EQ(empty_vector, last_write_value_); |
| 540 } | 556 } |
| 541 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 557 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 542 | 558 |
| 543 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 559 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 544 // Tests ReadRemoteCharacteristic on two characteristics. | 560 // Tests ReadRemoteCharacteristic on two characteristics. |
| 545 TEST_F(BluetoothRemoteGattCharacteristicTest, | 561 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 546 ReadRemoteCharacteristic_MultipleCharacteristics) { | 562 ReadRemoteCharacteristic_MultipleCharacteristics) { |
| 547 if (!PlatformSupportsLowEnergy()) { | 563 if (!PlatformSupportsLowEnergy()) { |
| 548 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; | 564 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 549 return; | 565 return; |
| 550 } | 566 } |
| 551 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 567 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 571 EXPECT_EQ(test_vector2, last_read_value_); | 587 EXPECT_EQ(test_vector2, last_read_value_); |
| 572 | 588 |
| 573 EXPECT_EQ(2, gatt_read_characteristic_attempts_); | 589 EXPECT_EQ(2, gatt_read_characteristic_attempts_); |
| 574 EXPECT_EQ(2, callback_count_); | 590 EXPECT_EQ(2, callback_count_); |
| 575 EXPECT_EQ(0, error_callback_count_); | 591 EXPECT_EQ(0, error_callback_count_); |
| 576 EXPECT_EQ(test_vector1, characteristic1_->GetValue()); | 592 EXPECT_EQ(test_vector1, characteristic1_->GetValue()); |
| 577 EXPECT_EQ(test_vector2, characteristic2_->GetValue()); | 593 EXPECT_EQ(test_vector2, characteristic2_->GetValue()); |
| 578 } | 594 } |
| 579 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 595 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 580 | 596 |
| 581 #if defined(OS_ANDROID) || defined(OS_WIN) | 597 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 582 // Tests WriteRemoteCharacteristic on two characteristics. | 598 // Tests WriteRemoteCharacteristic on two characteristics. |
| 583 TEST_F(BluetoothRemoteGattCharacteristicTest, | 599 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 584 WriteRemoteCharacteristic_MultipleCharacteristics) { | 600 WriteRemoteCharacteristic_MultipleCharacteristics) { |
| 601 if (!PlatformSupportsLowEnergy()) { |
| 602 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 603 return; |
| 604 } |
| 585 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 605 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 586 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 606 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 587 | 607 |
| 588 std::vector<uint8_t> test_vector1; | 608 std::vector<uint8_t> test_vector1; |
| 589 test_vector1.push_back(111); | 609 test_vector1.push_back(111); |
| 590 characteristic1_->WriteRemoteCharacteristic( | 610 characteristic1_->WriteRemoteCharacteristic( |
| 591 test_vector1, GetCallback(Call::EXPECTED), | 611 test_vector1, GetCallback(Call::EXPECTED), |
| 592 GetGattErrorCallback(Call::NOT_EXPECTED)); | 612 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 593 #ifdef OS_ANDROID | 613 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
| 594 EXPECT_EQ(test_vector1, last_write_value_); | 614 EXPECT_EQ(test_vector1, last_write_value_); |
| 595 #endif | 615 #endif |
| 596 | 616 |
| 597 std::vector<uint8_t> test_vector2; | 617 std::vector<uint8_t> test_vector2; |
| 598 test_vector2.push_back(222); | 618 test_vector2.push_back(222); |
| 599 characteristic2_->WriteRemoteCharacteristic( | 619 characteristic2_->WriteRemoteCharacteristic( |
| 600 test_vector2, GetCallback(Call::EXPECTED), | 620 test_vector2, GetCallback(Call::EXPECTED), |
| 601 GetGattErrorCallback(Call::NOT_EXPECTED)); | 621 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 602 #ifdef OS_ANDROID | 622 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
| 603 EXPECT_EQ(test_vector2, last_write_value_); | 623 EXPECT_EQ(test_vector2, last_write_value_); |
| 604 #endif | 624 #endif |
| 605 | 625 |
| 606 EXPECT_EQ(0, callback_count_); | 626 EXPECT_EQ(0, callback_count_); |
| 607 EXPECT_EQ(0, error_callback_count_); | 627 EXPECT_EQ(0, error_callback_count_); |
| 608 | 628 |
| 609 SimulateGattCharacteristicWrite(characteristic1_); | 629 SimulateGattCharacteristicWrite(characteristic1_); |
| 610 #ifndef OS_ANDROID | 630 #if !(defined(OS_ANDROID) || defined(OS_MACOSX)) |
| 611 EXPECT_EQ(test_vector1, last_write_value_); | 631 EXPECT_EQ(test_vector1, last_write_value_); |
| 612 #endif | 632 #endif |
| 613 | 633 |
| 614 SimulateGattCharacteristicWrite(characteristic2_); | 634 SimulateGattCharacteristicWrite(characteristic2_); |
| 615 #ifndef OS_ANDROID | 635 #if !(defined(OS_ANDROID) || defined(OS_MACOSX)) |
| 616 EXPECT_EQ(test_vector2, last_write_value_); | 636 EXPECT_EQ(test_vector2, last_write_value_); |
| 617 #endif | 637 #endif |
| 618 | 638 |
| 619 EXPECT_EQ(2, gatt_write_characteristic_attempts_); | 639 EXPECT_EQ(2, gatt_write_characteristic_attempts_); |
| 620 EXPECT_EQ(2, callback_count_); | 640 EXPECT_EQ(2, callback_count_); |
| 621 EXPECT_EQ(0, error_callback_count_); | 641 EXPECT_EQ(0, error_callback_count_); |
| 622 | 642 |
| 623 // TODO(591740): Remove if define for OS_ANDROID in this test. | 643 // TODO(591740): Remove if define for OS_ANDROID in this test. |
| 624 } | 644 } |
| 625 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 645 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 626 | 646 |
| 627 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 647 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 628 // Tests ReadRemoteCharacteristic asynchronous error. | 648 // Tests ReadRemoteCharacteristic asynchronous error. |
| 629 TEST_F(BluetoothRemoteGattCharacteristicTest, ReadError) { | 649 TEST_F(BluetoothRemoteGattCharacteristicTest, ReadError) { |
| 630 if (!PlatformSupportsLowEnergy()) { | 650 if (!PlatformSupportsLowEnergy()) { |
| 631 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; | 651 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 632 return; | 652 return; |
| 633 } | 653 } |
| 634 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 654 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 635 BluetoothRemoteGattCharacteristic::PROPERTY_READ)); | 655 BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| 636 | 656 |
| 637 TestBluetoothAdapterObserver observer(adapter_); | 657 TestBluetoothAdapterObserver observer(adapter_); |
| 638 | 658 |
| 639 characteristic1_->ReadRemoteCharacteristic( | 659 characteristic1_->ReadRemoteCharacteristic( |
| 640 GetReadValueCallback(Call::NOT_EXPECTED), | 660 GetReadValueCallback(Call::NOT_EXPECTED), |
| 641 GetGattErrorCallback(Call::EXPECTED)); | 661 GetGattErrorCallback(Call::EXPECTED)); |
| 642 SimulateGattCharacteristicReadError( | 662 SimulateGattCharacteristicReadError( |
| 643 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH); | 663 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH); |
| 644 SimulateGattCharacteristicReadError( | 664 SimulateGattCharacteristicReadError( |
| 645 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_FAILED); | 665 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_FAILED); |
| 646 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH, | 666 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH, |
| 647 last_gatt_error_code_); | 667 last_gatt_error_code_); |
| 648 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 668 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
| 649 } | 669 } |
| 650 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 670 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 651 | 671 |
| 652 #if defined(OS_ANDROID) || defined(OS_WIN) | 672 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 653 // Tests WriteRemoteCharacteristic asynchronous error. | 673 // Tests WriteRemoteCharacteristic asynchronous error. |
| 654 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteError) { | 674 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteError) { |
| 675 if (!PlatformSupportsLowEnergy()) { |
| 676 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 677 return; |
| 678 } |
| 655 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 679 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 656 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 680 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 657 | 681 |
| 658 std::vector<uint8_t> empty_vector; | 682 std::vector<uint8_t> empty_vector; |
| 659 characteristic1_->WriteRemoteCharacteristic( | 683 characteristic1_->WriteRemoteCharacteristic( |
| 660 empty_vector, GetCallback(Call::NOT_EXPECTED), | 684 empty_vector, GetCallback(Call::NOT_EXPECTED), |
| 661 GetGattErrorCallback(Call::EXPECTED)); | 685 GetGattErrorCallback(Call::EXPECTED)); |
| 662 SimulateGattCharacteristicWriteError( | 686 SimulateGattCharacteristicWriteError( |
| 663 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH); | 687 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH); |
| 664 SimulateGattCharacteristicWriteError( | 688 SimulateGattCharacteristicWriteError( |
| 665 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_FAILED); | 689 characteristic1_, BluetoothRemoteGattService::GATT_ERROR_FAILED); |
| 666 | 690 |
| 667 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH, | 691 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH, |
| 668 last_gatt_error_code_); | 692 last_gatt_error_code_); |
| 669 } | 693 } |
| 670 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 694 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 671 | 695 |
| 672 #if defined(OS_ANDROID) | 696 #if defined(OS_ANDROID) |
| 673 // Tests ReadRemoteCharacteristic synchronous error. | 697 // Tests ReadRemoteCharacteristic synchronous error. |
| 674 // Test not relevant for macOS since characteristic read cannot generate | 698 // Test not relevant for macOS since characteristic read cannot generate |
| 675 // synchronous error. | 699 // synchronous error. |
| 676 TEST_F(BluetoothRemoteGattCharacteristicTest, ReadSynchronousError) { | 700 TEST_F(BluetoothRemoteGattCharacteristicTest, ReadSynchronousError) { |
| 677 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate()); | 701 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate()); |
| 678 | 702 |
| 679 SimulateGattCharacteristicReadWillFailSynchronouslyOnce(characteristic1_); | 703 SimulateGattCharacteristicReadWillFailSynchronouslyOnce(characteristic1_); |
| 680 characteristic1_->ReadRemoteCharacteristic( | 704 characteristic1_->ReadRemoteCharacteristic( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 695 EXPECT_EQ(1, gatt_read_characteristic_attempts_); | 719 EXPECT_EQ(1, gatt_read_characteristic_attempts_); |
| 696 std::vector<uint8_t> empty_vector; | 720 std::vector<uint8_t> empty_vector; |
| 697 SimulateGattCharacteristicRead(characteristic1_, empty_vector); | 721 SimulateGattCharacteristicRead(characteristic1_, empty_vector); |
| 698 EXPECT_EQ(1, callback_count_); | 722 EXPECT_EQ(1, callback_count_); |
| 699 EXPECT_EQ(0, error_callback_count_); | 723 EXPECT_EQ(0, error_callback_count_); |
| 700 } | 724 } |
| 701 #endif // defined(OS_ANDROID) | 725 #endif // defined(OS_ANDROID) |
| 702 | 726 |
| 703 #if defined(OS_ANDROID) | 727 #if defined(OS_ANDROID) |
| 704 // Tests WriteRemoteCharacteristic synchronous error. | 728 // Tests WriteRemoteCharacteristic synchronous error. |
| 729 // This test doesn't apply to macOS synchronous API does exist. |
| 705 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteSynchronousError) { | 730 TEST_F(BluetoothRemoteGattCharacteristicTest, WriteSynchronousError) { |
| 706 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate()); | 731 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate()); |
| 707 | 732 |
| 708 SimulateGattCharacteristicWriteWillFailSynchronouslyOnce(characteristic1_); | 733 SimulateGattCharacteristicWriteWillFailSynchronouslyOnce(characteristic1_); |
| 709 std::vector<uint8_t> empty_vector; | 734 std::vector<uint8_t> empty_vector; |
| 710 characteristic1_->WriteRemoteCharacteristic( | 735 characteristic1_->WriteRemoteCharacteristic( |
| 711 empty_vector, GetCallback(Call::NOT_EXPECTED), | 736 empty_vector, GetCallback(Call::NOT_EXPECTED), |
| 712 GetGattErrorCallback(Call::EXPECTED)); | 737 GetGattErrorCallback(Call::EXPECTED)); |
| 713 EXPECT_EQ(0, gatt_write_characteristic_attempts_); | 738 EXPECT_EQ(0, gatt_write_characteristic_attempts_); |
| 714 base::RunLoop().RunUntilIdle(); | 739 base::RunLoop().RunUntilIdle(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 | 781 |
| 757 // Initial read should still succeed: | 782 // Initial read should still succeed: |
| 758 ResetEventCounts(); | 783 ResetEventCounts(); |
| 759 std::vector<uint8_t> empty_vector; | 784 std::vector<uint8_t> empty_vector; |
| 760 SimulateGattCharacteristicRead(characteristic1_, empty_vector); | 785 SimulateGattCharacteristicRead(characteristic1_, empty_vector); |
| 761 EXPECT_EQ(1, callback_count_); | 786 EXPECT_EQ(1, callback_count_); |
| 762 EXPECT_EQ(0, error_callback_count_); | 787 EXPECT_EQ(0, error_callback_count_); |
| 763 } | 788 } |
| 764 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) | 789 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 765 | 790 |
| 766 #if defined(OS_ANDROID) || defined(OS_WIN) | 791 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 767 // Tests WriteRemoteCharacteristic error with a pending write operation. | 792 // Tests WriteRemoteCharacteristic error with a pending write operation. |
| 768 TEST_F(BluetoothRemoteGattCharacteristicTest, | 793 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 769 WriteRemoteCharacteristic_WritePending) { | 794 WriteRemoteCharacteristic_WritePending) { |
| 795 if (!PlatformSupportsLowEnergy()) { |
| 796 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 797 return; |
| 798 } |
| 770 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 799 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 771 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 800 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 772 | 801 |
| 773 std::vector<uint8_t> empty_vector; | 802 std::vector<uint8_t> empty_vector; |
| 774 characteristic1_->WriteRemoteCharacteristic( | 803 characteristic1_->WriteRemoteCharacteristic( |
| 775 empty_vector, GetCallback(Call::EXPECTED), | 804 empty_vector, GetCallback(Call::EXPECTED), |
| 776 GetGattErrorCallback(Call::NOT_EXPECTED)); | 805 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 777 characteristic1_->WriteRemoteCharacteristic( | 806 characteristic1_->WriteRemoteCharacteristic( |
| 778 empty_vector, GetCallback(Call::NOT_EXPECTED), | 807 empty_vector, GetCallback(Call::NOT_EXPECTED), |
| 779 GetGattErrorCallback(Call::EXPECTED)); | 808 GetGattErrorCallback(Call::EXPECTED)); |
| 780 | 809 |
| 781 base::RunLoop().RunUntilIdle(); | 810 base::RunLoop().RunUntilIdle(); |
| 782 | 811 |
| 783 EXPECT_EQ(0, callback_count_); | 812 EXPECT_EQ(0, callback_count_); |
| 784 EXPECT_EQ(1, error_callback_count_); | 813 EXPECT_EQ(1, error_callback_count_); |
| 785 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, | 814 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, |
| 786 last_gatt_error_code_); | 815 last_gatt_error_code_); |
| 787 | 816 |
| 788 // Initial write should still succeed: | 817 // Initial write should still succeed: |
| 789 ResetEventCounts(); | 818 ResetEventCounts(); |
| 790 SimulateGattCharacteristicWrite(characteristic1_); | 819 SimulateGattCharacteristicWrite(characteristic1_); |
| 791 EXPECT_EQ(1, callback_count_); | 820 EXPECT_EQ(1, callback_count_); |
| 792 EXPECT_EQ(0, error_callback_count_); | 821 EXPECT_EQ(0, error_callback_count_); |
| 793 } | 822 } |
| 794 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 823 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 795 | 824 |
| 796 #if defined(OS_ANDROID) || defined(OS_WIN) | 825 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 797 // Tests ReadRemoteCharacteristic error with a pending write operation. | 826 // Tests ReadRemoteCharacteristic error with a pending write operation. |
| 798 TEST_F(BluetoothRemoteGattCharacteristicTest, | 827 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 799 ReadRemoteCharacteristic_WritePending) { | 828 ReadRemoteCharacteristic_WritePending) { |
| 829 if (!PlatformSupportsLowEnergy()) { |
| 830 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 831 return; |
| 832 } |
| 800 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 833 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 801 BluetoothRemoteGattCharacteristic::PROPERTY_READ | | 834 BluetoothRemoteGattCharacteristic::PROPERTY_READ | |
| 802 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 835 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 803 | 836 |
| 804 std::vector<uint8_t> empty_vector; | 837 std::vector<uint8_t> empty_vector; |
| 805 characteristic1_->WriteRemoteCharacteristic( | 838 characteristic1_->WriteRemoteCharacteristic( |
| 806 empty_vector, GetCallback(Call::EXPECTED), | 839 empty_vector, GetCallback(Call::EXPECTED), |
| 807 GetGattErrorCallback(Call::NOT_EXPECTED)); | 840 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 808 characteristic1_->ReadRemoteCharacteristic( | 841 characteristic1_->ReadRemoteCharacteristic( |
| 809 GetReadValueCallback(Call::NOT_EXPECTED), | 842 GetReadValueCallback(Call::NOT_EXPECTED), |
| 810 GetGattErrorCallback(Call::EXPECTED)); | 843 GetGattErrorCallback(Call::EXPECTED)); |
| 811 | 844 |
| 812 base::RunLoop().RunUntilIdle(); | 845 base::RunLoop().RunUntilIdle(); |
| 813 | 846 |
| 814 EXPECT_EQ(0, callback_count_); | 847 EXPECT_EQ(0, callback_count_); |
| 815 EXPECT_EQ(1, error_callback_count_); | 848 EXPECT_EQ(1, error_callback_count_); |
| 816 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, | 849 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, |
| 817 last_gatt_error_code_); | 850 last_gatt_error_code_); |
| 818 | 851 |
| 819 // Initial write should still succeed: | 852 // Initial write should still succeed: |
| 820 ResetEventCounts(); | 853 ResetEventCounts(); |
| 821 SimulateGattCharacteristicWrite(characteristic1_); | 854 SimulateGattCharacteristicWrite(characteristic1_); |
| 822 EXPECT_EQ(1, callback_count_); | 855 EXPECT_EQ(1, callback_count_); |
| 823 EXPECT_EQ(0, error_callback_count_); | 856 EXPECT_EQ(0, error_callback_count_); |
| 824 } | 857 } |
| 825 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 858 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 826 | 859 |
| 827 #if defined(OS_ANDROID) || defined(OS_WIN) | 860 #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 828 // Tests WriteRemoteCharacteristic error with a pending Read operation. | 861 // Tests WriteRemoteCharacteristic error with a pending Read operation. |
| 829 TEST_F(BluetoothRemoteGattCharacteristicTest, | 862 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 830 WriteRemoteCharacteristic_ReadPending) { | 863 WriteRemoteCharacteristic_ReadPending) { |
| 864 if (!PlatformSupportsLowEnergy()) { |
| 865 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 866 return; |
| 867 } |
| 831 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( | 868 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| 832 BluetoothRemoteGattCharacteristic::PROPERTY_READ | | 869 BluetoothRemoteGattCharacteristic::PROPERTY_READ | |
| 833 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); | 870 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); |
| 834 | 871 |
| 835 std::vector<uint8_t> empty_vector; | 872 std::vector<uint8_t> empty_vector; |
| 836 characteristic1_->ReadRemoteCharacteristic( | 873 characteristic1_->ReadRemoteCharacteristic( |
| 837 GetReadValueCallback(Call::EXPECTED), | 874 GetReadValueCallback(Call::EXPECTED), |
| 838 GetGattErrorCallback(Call::NOT_EXPECTED)); | 875 GetGattErrorCallback(Call::NOT_EXPECTED)); |
| 839 characteristic1_->WriteRemoteCharacteristic( | 876 characteristic1_->WriteRemoteCharacteristic( |
| 840 empty_vector, GetCallback(Call::NOT_EXPECTED), | 877 empty_vector, GetCallback(Call::NOT_EXPECTED), |
| 841 GetGattErrorCallback(Call::EXPECTED)); | 878 GetGattErrorCallback(Call::EXPECTED)); |
| 842 base::RunLoop().RunUntilIdle(); | 879 base::RunLoop().RunUntilIdle(); |
| 843 | 880 |
| 844 EXPECT_EQ(0, callback_count_); | 881 EXPECT_EQ(0, callback_count_); |
| 845 EXPECT_EQ(1, error_callback_count_); | 882 EXPECT_EQ(1, error_callback_count_); |
| 846 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, | 883 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, |
| 847 last_gatt_error_code_); | 884 last_gatt_error_code_); |
| 848 | 885 |
| 849 // Initial read should still succeed: | 886 // Initial read should still succeed: |
| 850 ResetEventCounts(); | 887 ResetEventCounts(); |
| 851 SimulateGattCharacteristicRead(characteristic1_, empty_vector); | 888 SimulateGattCharacteristicRead(characteristic1_, empty_vector); |
| 852 EXPECT_EQ(1, callback_count_); | 889 EXPECT_EQ(1, callback_count_); |
| 853 EXPECT_EQ(0, error_callback_count_); | 890 EXPECT_EQ(0, error_callback_count_); |
| 854 } | 891 } |
| 855 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 892 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| 856 | 893 |
| 857 #if defined(OS_ANDROID) || defined(OS_WIN) | 894 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 858 // StartNotifySession fails if characteristic doesn't have Notify or Indicate | 895 // StartNotifySession fails if characteristic doesn't have Notify or Indicate |
| 859 // property. | 896 // property. |
| 860 TEST_F(BluetoothRemoteGattCharacteristicTest, | 897 TEST_F(BluetoothRemoteGattCharacteristicTest, |
| 861 StartNotifySession_NoNotifyOrIndicate) { | 898 StartNotifySession_NoNotifyOrIndicate) { |
| 862 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( | 899 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( |
| 863 /* properties: NOTIFY */ 0x10, | 900 /* properties: NOTIFY */ 0x10, |
| 864 /* expected_config_descriptor_value: NOTIFY */ 1, | 901 /* expected_config_descriptor_value: NOTIFY */ 1, |
| 865 StartNotifySetupError::CHARACTERISTIC_PROPERTIES)); | 902 StartNotifySetupError::CHARACTERISTIC_PROPERTIES)); |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 EXPECT_EQ(1u, characteristic1_->GetDescriptorsByUUID(id2).size()); | 1351 EXPECT_EQ(1u, characteristic1_->GetDescriptorsByUUID(id2).size()); |
| 1315 EXPECT_EQ(2u, characteristic2_->GetDescriptorsByUUID(id3).size()); | 1352 EXPECT_EQ(2u, characteristic2_->GetDescriptorsByUUID(id3).size()); |
| 1316 | 1353 |
| 1317 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id1).size()); | 1354 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id1).size()); |
| 1318 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id2).size()); | 1355 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id2).size()); |
| 1319 EXPECT_EQ(0u, characteristic1_->GetDescriptorsByUUID(id3).size()); | 1356 EXPECT_EQ(0u, characteristic1_->GetDescriptorsByUUID(id3).size()); |
| 1320 } | 1357 } |
| 1321 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 1358 #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| 1322 | 1359 |
| 1323 } // namespace device | 1360 } // namespace device |
| OLD | NEW |