| 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 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
_H_ |
| 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
_H_ | 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // errorUUID(0xA8) | 325 // errorUUID(0xA8) |
| 326 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 326 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 327 GetFailingGATTOperationsAdapter(); | 327 GetFailingGATTOperationsAdapter(); |
| 328 | 328 |
| 329 // Discovery Sessions | 329 // Discovery Sessions |
| 330 | 330 |
| 331 // |DiscoverySession| | 331 // |DiscoverySession| |
| 332 // Mock Functions: | 332 // Mock Functions: |
| 333 // - Stop: | 333 // - Stop: |
| 334 // Run success callback. | 334 // Run success callback. |
| 335 static scoped_ptr<testing::NiceMock<device::MockBluetoothDiscoverySession>> | 335 static std::unique_ptr< |
| 336 testing::NiceMock<device::MockBluetoothDiscoverySession>> |
| 336 GetDiscoverySession(); | 337 GetDiscoverySession(); |
| 337 | 338 |
| 338 // Devices | 339 // Devices |
| 339 | 340 |
| 340 // |BaseDevice| | 341 // |BaseDevice| |
| 341 // UUIDs added: | 342 // UUIDs added: |
| 342 // None. | 343 // None. |
| 343 // Services added: | 344 // Services added: |
| 344 // None. | 345 // None. |
| 345 // MockFunctions: | 346 // MockFunctions: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 360 // - GetVendorIDSource: | 361 // - GetVendorIDSource: |
| 361 // Returns: BluetoothDevice::VENDOR_ID_BLUETOOTH. | 362 // Returns: BluetoothDevice::VENDOR_ID_BLUETOOTH. |
| 362 // - GetVendorID: | 363 // - GetVendorID: |
| 363 // Returns: 0xFFFF. | 364 // Returns: 0xFFFF. |
| 364 // - GetProductID: | 365 // - GetProductID: |
| 365 // Returns: 1. | 366 // Returns: 1. |
| 366 // - GetDeviceID: | 367 // - GetDeviceID: |
| 367 // Returns: 2. | 368 // Returns: 2. |
| 368 // - IsPaired: | 369 // - IsPaired: |
| 369 // Returns true. | 370 // Returns true. |
| 370 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 371 static std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 371 GetBaseDevice(device::MockBluetoothAdapter* adapter, | 372 GetBaseDevice(device::MockBluetoothAdapter* adapter, |
| 372 const std::string& device_name = "Base Device", | 373 const std::string& device_name = "Base Device", |
| 373 device::BluetoothDevice::UUIDList uuids = | 374 device::BluetoothDevice::UUIDList uuids = |
| 374 device::BluetoothDevice::UUIDList(), | 375 device::BluetoothDevice::UUIDList(), |
| 375 const std::string& address = "00:00:00:00:00:00"); | 376 const std::string& address = "00:00:00:00:00:00"); |
| 376 | 377 |
| 377 // |BatteryDevice| | 378 // |BatteryDevice| |
| 378 // Inherits from |BaseDevice|(adapter, "Battery Device", uuids, | 379 // Inherits from |BaseDevice|(adapter, "Battery Device", uuids, |
| 379 // "00:00:00:00:00:01") | 380 // "00:00:00:00:00:01") |
| 380 // UUIDs added: | 381 // UUIDs added: |
| 381 // - Battery Service UUID (0x180F) | 382 // - Battery Service UUID (0x180F) |
| 382 // Services added: | 383 // Services added: |
| 383 // None. | 384 // None. |
| 384 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 385 static std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 385 GetBatteryDevice(device::MockBluetoothAdapter* adapter); | 386 GetBatteryDevice(device::MockBluetoothAdapter* adapter); |
| 386 | 387 |
| 387 // |GlucoseDevice| | 388 // |GlucoseDevice| |
| 388 // Inherits from |BaseDevice|(adapter, "Glucose Device", uuids, | 389 // Inherits from |BaseDevice|(adapter, "Glucose Device", uuids, |
| 389 // "00:00:00:00:00:02") | 390 // "00:00:00:00:00:02") |
| 390 // UUIDs added: | 391 // UUIDs added: |
| 391 // - Generic Access (0x1800) | 392 // - Generic Access (0x1800) |
| 392 // - Glucose UUID (0x1808) | 393 // - Glucose UUID (0x1808) |
| 393 // - Tx Power (0x1804) | 394 // - Tx Power (0x1804) |
| 394 // Services added: | 395 // Services added: |
| 395 // None. | 396 // None. |
| 396 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 397 static std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 397 GetGlucoseDevice(device::MockBluetoothAdapter* adapter); | 398 GetGlucoseDevice(device::MockBluetoothAdapter* adapter); |
| 398 | 399 |
| 399 // |ConnectableDevice| | 400 // |ConnectableDevice| |
| 400 // Inherits from |BaseDevice|(adapter, device_name) | 401 // Inherits from |BaseDevice|(adapter, device_name) |
| 401 // UUIDs added: | 402 // UUIDs added: |
| 402 // None. | 403 // None. |
| 403 // Services added: | 404 // Services added: |
| 404 // None. | 405 // None. |
| 405 // Mock Functions: | 406 // Mock Functions: |
| 406 // - CreateGattConnection: | 407 // - CreateGattConnection: |
| 407 // - Run success callback with BaseGATTConnection | 408 // - Run success callback with BaseGATTConnection |
| 408 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 409 static std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 409 GetConnectableDevice( | 410 GetConnectableDevice( |
| 410 device::MockBluetoothAdapter* adapter, | 411 device::MockBluetoothAdapter* adapter, |
| 411 const std::string& device_name = "Connectable Device", | 412 const std::string& device_name = "Connectable Device", |
| 412 device::BluetoothDevice::UUIDList = device::BluetoothDevice::UUIDList(), | 413 device::BluetoothDevice::UUIDList = device::BluetoothDevice::UUIDList(), |
| 413 const std::string& address = "00:00:00:00:00:00"); | 414 const std::string& address = "00:00:00:00:00:00"); |
| 414 | 415 |
| 415 // |UnconnectableDevice| | 416 // |UnconnectableDevice| |
| 416 // Inherits from |BaseDevice|(adapter, device_name) | 417 // Inherits from |BaseDevice|(adapter, device_name) |
| 417 // UUIDs added: | 418 // UUIDs added: |
| 418 // - errorUUID(error_code) | 419 // - errorUUID(error_code) |
| 419 // Services added: | 420 // Services added: |
| 420 // None. | 421 // None. |
| 421 // Mock Functions: | 422 // Mock Functions: |
| 422 // - CreateGATTConnection: | 423 // - CreateGATTConnection: |
| 423 // - Run error callback with error_type | 424 // - Run error callback with error_type |
| 424 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 425 static std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 425 GetUnconnectableDevice( | 426 GetUnconnectableDevice( |
| 426 device::MockBluetoothAdapter* adapter, | 427 device::MockBluetoothAdapter* adapter, |
| 427 device::BluetoothDevice::ConnectErrorCode error_code, | 428 device::BluetoothDevice::ConnectErrorCode error_code, |
| 428 const std::string& device_name = "Unconnectable Device"); | 429 const std::string& device_name = "Unconnectable Device"); |
| 429 | 430 |
| 430 // |HeartRateDevice| | 431 // |HeartRateDevice| |
| 431 // Inherits from |ConnectableDevice|(adapter, "Heart Rate Device", uuids) | 432 // Inherits from |ConnectableDevice|(adapter, "Heart Rate Device", uuids) |
| 432 // UUIDs added: | 433 // UUIDs added: |
| 433 // - Generic Access (0x1800) | 434 // - Generic Access (0x1800) |
| 434 // - Heart Rate UUID (0x180D) | 435 // - Heart Rate UUID (0x180D) |
| 435 // Services added: | 436 // Services added: |
| 436 // None. Each user of the HeartRateDevice is in charge of adding the | 437 // None. Each user of the HeartRateDevice is in charge of adding the |
| 437 // relevant services, characteristics and descriptors. | 438 // relevant services, characteristics and descriptors. |
| 438 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 439 static std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 439 GetHeartRateDevice(device::MockBluetoothAdapter* adapter); | 440 GetHeartRateDevice(device::MockBluetoothAdapter* adapter); |
| 440 | 441 |
| 441 // Services | 442 // Services |
| 442 | 443 |
| 443 // |BaseGATTService| | 444 // |BaseGATTService| |
| 444 // Characteristics added: | 445 // Characteristics added: |
| 445 // None. | 446 // None. |
| 446 // Mock Functions: | 447 // Mock Functions: |
| 447 // - GetCharacteristics: | 448 // - GetCharacteristics: |
| 448 // Returns a list with all the characteristics added to the service | 449 // Returns a list with all the characteristics added to the service |
| 449 // - GetCharacteristic: | 450 // - GetCharacteristic: |
| 450 // Returns a characteristic matching the identifier provided if the | 451 // Returns a characteristic matching the identifier provided if the |
| 451 // characteristic was added to the mock. | 452 // characteristic was added to the mock. |
| 452 // - GetIdentifier: | 453 // - GetIdentifier: |
| 453 // Returns: uuid + “ Identifier” | 454 // Returns: uuid + “ Identifier” |
| 454 // - GetUUID: | 455 // - GetUUID: |
| 455 // Returns: uuid | 456 // Returns: uuid |
| 456 // - IsLocal: | 457 // - IsLocal: |
| 457 // Returns: false | 458 // Returns: false |
| 458 // - IsPrimary: | 459 // - IsPrimary: |
| 459 // Returns: true | 460 // Returns: true |
| 460 // - GetDevice: | 461 // - GetDevice: |
| 461 // Returns: device | 462 // Returns: device |
| 462 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> | 463 static std::unique_ptr<testing::NiceMock<device::MockBluetoothGattService>> |
| 463 GetBaseGATTService(device::MockBluetoothDevice* device, | 464 GetBaseGATTService(device::MockBluetoothDevice* device, |
| 464 const std::string& uuid); | 465 const std::string& uuid); |
| 465 | 466 |
| 466 // |DeviceInformationService| | 467 // |DeviceInformationService| |
| 467 // Internal Structure: | 468 // Internal Structure: |
| 468 // - Characteristics: | 469 // - Characteristics: |
| 469 // - Serial Number String: (0x2a25) (a blacklisted characteristic) | 470 // - Serial Number String: (0x2a25) (a blacklisted characteristic) |
| 470 // - Mock Functions: | 471 // - Mock Functions: |
| 471 // - Read: Fails test. | 472 // - Read: Fails test. |
| 472 // - GetProperties: Returns | 473 // - GetProperties: Returns |
| 473 // BluetoothGattCharacteristic::PROPERTY_READ | 474 // BluetoothGattCharacteristic::PROPERTY_READ |
| 474 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> | 475 static std::unique_ptr<testing::NiceMock<device::MockBluetoothGattService>> |
| 475 GetDeviceInformationService(device::MockBluetoothDevice* device); | 476 GetDeviceInformationService(device::MockBluetoothDevice* device); |
| 476 | 477 |
| 477 // |BlacklistTestService| | 478 // |BlacklistTestService| |
| 478 // Internal Structure: | 479 // Internal Structure: |
| 479 // - Characteristics: | 480 // - Characteristics: |
| 480 // - Blacklist Exclude Reads Characteristic: | 481 // - Blacklist Exclude Reads Characteristic: |
| 481 // (bad1c9a2-9a5b-4015-8b60-1579bbbf2135) | 482 // (bad1c9a2-9a5b-4015-8b60-1579bbbf2135) |
| 482 // - Mock Functions: | 483 // - Mock Functions: |
| 483 // - Read: Fails test. | 484 // - Read: Fails test. |
| 484 // - Write: Calls success callback. | 485 // - Write: Calls success callback. |
| 485 // - GetProperties: Returns | 486 // - GetProperties: Returns |
| 486 // BluetoothGattCharacteristic::PROPERTY_READ | | 487 // BluetoothGattCharacteristic::PROPERTY_READ | |
| 487 // BluetoothGattCharacteristic::PROPERTY_WRITE | 488 // BluetoothGattCharacteristic::PROPERTY_WRITE |
| 488 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> | 489 static std::unique_ptr<testing::NiceMock<device::MockBluetoothGattService>> |
| 489 GetBlacklistTestService(device::MockBluetoothDevice* device); | 490 GetBlacklistTestService(device::MockBluetoothDevice* device); |
| 490 | 491 |
| 491 // |GenericAccessService| | 492 // |GenericAccessService| |
| 492 // Internal Structure: | 493 // Internal Structure: |
| 493 // - Characteristics: | 494 // - Characteristics: |
| 494 // - Device Name: (0x2A00) | 495 // - Device Name: (0x2A00) |
| 495 // - Mock Functions: | 496 // - Mock Functions: |
| 496 // - Read: Calls success callback with device's name. | 497 // - Read: Calls success callback with device's name. |
| 497 // - Write: Calls success callback. | 498 // - Write: Calls success callback. |
| 498 // - GetProperties: Returns | 499 // - GetProperties: Returns |
| 499 // BluetoothGattCharacteristic::PROPERTY_READ | | 500 // BluetoothGattCharacteristic::PROPERTY_READ | |
| 500 // BluetoothGattCharacteristic::PROPERTY_WRITE | 501 // BluetoothGattCharacteristic::PROPERTY_WRITE |
| 501 // - Peripheral Privacy Flag: (0x2A02) (blacklisted for writes) | 502 // - Peripheral Privacy Flag: (0x2A02) (blacklisted for writes) |
| 502 // - Mock Functions: | 503 // - Mock Functions: |
| 503 // - Read: Calls success callback with boolean value 'false'. | 504 // - Read: Calls success callback with boolean value 'false'. |
| 504 // - Write: Fails test. | 505 // - Write: Fails test. |
| 505 // - GetProperties: Returns | 506 // - GetProperties: Returns |
| 506 // BluetoothGattCharacteristic::PROPERTY_READ | | 507 // BluetoothGattCharacteristic::PROPERTY_READ | |
| 507 // BluetoothGattCharacteristic::PROPERTY_WRITE | 508 // BluetoothGattCharacteristic::PROPERTY_WRITE |
| 508 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> | 509 static std::unique_ptr<testing::NiceMock<device::MockBluetoothGattService>> |
| 509 GetGenericAccessService(device::MockBluetoothDevice* device); | 510 GetGenericAccessService(device::MockBluetoothDevice* device); |
| 510 | 511 |
| 511 // |HeartRateService| | 512 // |HeartRateService| |
| 512 // Internal Structure: | 513 // Internal Structure: |
| 513 // - Characteristics: | 514 // - Characteristics: |
| 514 // - Heart Rate Measurement (0x2a37) | 515 // - Heart Rate Measurement (0x2a37) |
| 515 // - Mock Functions: | 516 // - Mock Functions: |
| 516 // - StartNotifySession: Sets a timer to call | 517 // - StartNotifySession: Sets a timer to call |
| 517 // GattCharacteristicValueChanged every 10ms and calls | 518 // GattCharacteristicValueChanged every 10ms and calls |
| 518 // success callback with a | 519 // success callback with a |
| 519 // BaseGATTNotifySession(characteristic_instance_id) | 520 // BaseGATTNotifySession(characteristic_instance_id) |
| 520 // TODO: Instead of a timer we should be able to tell the fake | 521 // TODO: Instead of a timer we should be able to tell the fake |
| 521 // to call GattCharacteristicValueChanged from js. | 522 // to call GattCharacteristicValueChanged from js. |
| 522 // https://crbug.com/543884 | 523 // https://crbug.com/543884 |
| 523 // - GetProperties: Returns | 524 // - GetProperties: Returns |
| 524 // BluetoothGattCharacteristic::PROPERTY_NOTIFY | 525 // BluetoothGattCharacteristic::PROPERTY_NOTIFY |
| 525 // - Body Sensor Location (0x2a38) | 526 // - Body Sensor Location (0x2a38) |
| 526 // - Mock Functions: | 527 // - Mock Functions: |
| 527 // - Read: Calls GattCharacteristicValueChanged and success | 528 // - Read: Calls GattCharacteristicValueChanged and success |
| 528 // callback with [1] which corresponds to chest. | 529 // callback with [1] which corresponds to chest. |
| 529 // - GetProperties: Returns | 530 // - GetProperties: Returns |
| 530 // BluetoothGattCharacteristic::PROPERTY_READ | 531 // BluetoothGattCharacteristic::PROPERTY_READ |
| 531 // - Body Sensor Location (0x2a38) | 532 // - Body Sensor Location (0x2a38) |
| 532 // - Mock Functions: | 533 // - Mock Functions: |
| 533 // - Read: Calls GattCharacteristicValueChanged and success | 534 // - Read: Calls GattCharacteristicValueChanged and success |
| 534 // callback with [2] which corresponds to wrist. | 535 // callback with [2] which corresponds to wrist. |
| 535 // - GetProperties: Returns | 536 // - GetProperties: Returns |
| 536 // BluetoothGattCharacteristic::PROPERTY_READ | 537 // BluetoothGattCharacteristic::PROPERTY_READ |
| 537 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> | 538 static std::unique_ptr<testing::NiceMock<device::MockBluetoothGattService>> |
| 538 GetHeartRateService(device::MockBluetoothAdapter* adapter, | 539 GetHeartRateService(device::MockBluetoothAdapter* adapter, |
| 539 device::MockBluetoothDevice* device); | 540 device::MockBluetoothDevice* device); |
| 540 | 541 |
| 541 // Characteristics | 542 // Characteristics |
| 542 | 543 |
| 543 // |BaseCharacteristic|(identifier, service, uuid) | 544 // |BaseCharacteristic|(identifier, service, uuid) |
| 544 // Descriptors added: | 545 // Descriptors added: |
| 545 // None. | 546 // None. |
| 546 // Mock Functions: | 547 // Mock Functions: |
| 547 // - TODO(ortuno): http://crbug.com/483347 GetDescriptors: | 548 // - TODO(ortuno): http://crbug.com/483347 GetDescriptors: |
| 548 // Returns: all descriptors added to the characteristic | 549 // Returns: all descriptors added to the characteristic |
| 549 // - TODO(ortuno): http://crbug.com/483347 GetDescriptor: | 550 // - TODO(ortuno): http://crbug.com/483347 GetDescriptor: |
| 550 // Returns the descriptor matching the identifier provided if the | 551 // Returns the descriptor matching the identifier provided if the |
| 551 // descriptor was added to the characteristic. | 552 // descriptor was added to the characteristic. |
| 552 // - GetIdentifier: | 553 // - GetIdentifier: |
| 553 // Returns: identifier | 554 // Returns: identifier |
| 554 // - GetUUID: | 555 // - GetUUID: |
| 555 // Returns: uuid | 556 // Returns: uuid |
| 556 // - IsLocal: | 557 // - IsLocal: |
| 557 // Returns: false | 558 // Returns: false |
| 558 // - GetService: | 559 // - GetService: |
| 559 // Returns: service | 560 // Returns: service |
| 560 // - GetProperties: | 561 // - GetProperties: |
| 561 // Returns: NULL | 562 // Returns: NULL |
| 562 // - GetPermissions: | 563 // - GetPermissions: |
| 563 // Returns: NULL | 564 // Returns: NULL |
| 564 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattCharacteristic>> | 565 static std::unique_ptr< |
| 566 testing::NiceMock<device::MockBluetoothGattCharacteristic>> |
| 565 GetBaseGATTCharacteristic( | 567 GetBaseGATTCharacteristic( |
| 566 const std::string& identifier, | 568 const std::string& identifier, |
| 567 device::MockBluetoothGattService* service, | 569 device::MockBluetoothGattService* service, |
| 568 const std::string& uuid, | 570 const std::string& uuid, |
| 569 device::BluetoothGattCharacteristic::Properties properties); | 571 device::BluetoothGattCharacteristic::Properties properties); |
| 570 | 572 |
| 571 // |ErrorCharacteristic|(service, error_type) | 573 // |ErrorCharacteristic|(service, error_type) |
| 572 // Inherits from BaseCharacteristic(service, errorUUID(error_type + 0xA1)) | 574 // Inherits from BaseCharacteristic(service, errorUUID(error_type + 0xA1)) |
| 573 // Descriptors added: | 575 // Descriptors added: |
| 574 // None. | 576 // None. |
| 575 // Mock Functions: | 577 // Mock Functions: |
| 576 // - ReadRemoteCharacteristic: | 578 // - ReadRemoteCharacteristic: |
| 577 // Run error callback with error_type | 579 // Run error callback with error_type |
| 578 // - WriteRemoteCharacteristic: | 580 // - WriteRemoteCharacteristic: |
| 579 // Run error callback with error_type | 581 // Run error callback with error_type |
| 580 // - StartNotifySession: | 582 // - StartNotifySession: |
| 581 // Run error callback with error_type | 583 // Run error callback with error_type |
| 582 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattCharacteristic>> | 584 static std::unique_ptr< |
| 585 testing::NiceMock<device::MockBluetoothGattCharacteristic>> |
| 583 GetErrorCharacteristic( | 586 GetErrorCharacteristic( |
| 584 device::MockBluetoothGattService* service, | 587 device::MockBluetoothGattService* service, |
| 585 device::BluetoothGattService::GattErrorCode error_code); | 588 device::BluetoothGattService::GattErrorCode error_code); |
| 586 | 589 |
| 587 // Notify Sessions | 590 // Notify Sessions |
| 588 | 591 |
| 589 // |BaseGATTNotifySession|(characteristic_identifier) | 592 // |BaseGATTNotifySession|(characteristic_identifier) |
| 590 // Mock Functions: | 593 // Mock Functions: |
| 591 // - GetCharacteristicIdentifier: | 594 // - GetCharacteristicIdentifier: |
| 592 // Returns: characteristic_identifier | 595 // Returns: characteristic_identifier |
| 593 // - IsActive: | 596 // - IsActive: |
| 594 // Returns: true | 597 // Returns: true |
| 595 // - Stop: | 598 // - Stop: |
| 596 // Stops calling GattCharacteristicValueChanged and runs callback. | 599 // Stops calling GattCharacteristicValueChanged and runs callback. |
| 597 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>> | 600 static std::unique_ptr< |
| 601 testing::NiceMock<device::MockBluetoothGattNotifySession>> |
| 598 GetBaseGATTNotifySession(const std::string& characteristic_identifier); | 602 GetBaseGATTNotifySession(const std::string& characteristic_identifier); |
| 599 | 603 |
| 600 // Helper functions: | 604 // Helper functions: |
| 601 | 605 |
| 602 // DEPRECATED: This is a poor practice as it exposes the specific | 606 // DEPRECATED: This is a poor practice as it exposes the specific |
| 603 // enum values of this code base into the UUIDs used | 607 // enum values of this code base into the UUIDs used |
| 604 // by the test data. Prefer methods such as | 608 // by the test data. Prefer methods such as |
| 605 // connectErrorUUID. | 609 // connectErrorUUID. |
| 606 // errorUUID(alias) returns a UUID with the top 32 bits of | 610 // errorUUID(alias) returns a UUID with the top 32 bits of |
| 607 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. | 611 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. |
| 608 // For example, errorUUID(0xDEADBEEF) returns | 612 // For example, errorUUID(0xDEADBEEF) returns |
| 609 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs | 613 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs |
| 610 // were generated as a type 4 (random) UUID. | 614 // were generated as a type 4 (random) UUID. |
| 611 static std::string errorUUID(uint32_t alias); | 615 static std::string errorUUID(uint32_t alias); |
| 612 | 616 |
| 613 // Returns a stable test data UUID associated with a given | 617 // Returns a stable test data UUID associated with a given |
| 614 // BluetoothDevice::ConnectErrorCode. | 618 // BluetoothDevice::ConnectErrorCode. |
| 615 static device::BluetoothUUID connectErrorUUID( | 619 static device::BluetoothUUID connectErrorUUID( |
| 616 device::BluetoothDevice::ConnectErrorCode error_code); | 620 device::BluetoothDevice::ConnectErrorCode error_code); |
| 617 | 621 |
| 618 // Function to turn an integer into an MAC address of the form | 622 // Function to turn an integer into an MAC address of the form |
| 619 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) | 623 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) |
| 620 // returns "00:00:DE:AD:BE:EF". | 624 // returns "00:00:DE:AD:BE:EF". |
| 621 static std::string makeMACAddress(uint64_t addr); | 625 static std::string makeMACAddress(uint64_t addr); |
| 622 }; | 626 }; |
| 623 | 627 |
| 624 } // namespace content | 628 } // namespace content |
| 625 | 629 |
| 626 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
DER_H_ | 630 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
DER_H_ |
| OLD | NEW |