| Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| index 930f9dd4c454c0c53cf6a8ea676639e09c304f95..4065b558589b93f5bb0f1a641ade6adfb867fa67 100644
|
| --- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| +++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| @@ -501,8 +501,15 @@ scoped_refptr<NiceMockBluetoothAdapter>
|
| LayoutTestBluetoothAdapterProvider::GetDisconnectingHeartRateAdapter() {
|
| scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
|
| NiceMockBluetoothAdapter* adapter_ptr = adapter.get();
|
| +
|
| + BluetoothDevice::UUIDList uuids;
|
| + uuids.push_back(BluetoothUUID(kGenericAccessServiceUUID));
|
| + uuids.push_back(BluetoothUUID(kHeartRateServiceUUID));
|
| + uuids.push_back(BluetoothUUID(kRequestDisconnectionServiceUUID));
|
| +
|
| std::unique_ptr<NiceMockBluetoothDevice> device(
|
| - GetHeartRateDevice(adapter.get()));
|
| + GetConnectableDevice(adapter.get(), "Disconnecting Device", uuids));
|
| +
|
| NiceMockBluetoothDevice* device_ptr = device.get();
|
|
|
| // TODO(ortuno): Implement the rest of the service's characteristics
|
| @@ -869,16 +876,6 @@ LayoutTestBluetoothAdapterProvider::GetGenericAccessService(
|
| ON_CALL(*peripheral_privacy_flag, ReadRemoteCharacteristic(_, _))
|
| .WillByDefault(RunCallback<0>(value));
|
|
|
| - // Crash if WriteRemoteCharacteristic called. Not using GoogleMock's Expect
|
| - // because this is used in layout tests that may not report a mock
|
| - // expectation error correctly as a layout test failure.
|
| - ON_CALL(*peripheral_privacy_flag, WriteRemoteCharacteristic(_, _, _))
|
| - .WillByDefault(
|
| - Invoke([](const std::vector<uint8_t>&, const base::Closure&,
|
| - const BluetoothRemoteGattCharacteristic::ErrorCallback&) {
|
| - NOTREACHED();
|
| - }));
|
| -
|
| generic_access->AddMockCharacteristic(std::move(peripheral_privacy_flag));
|
| }
|
|
|
| @@ -976,9 +973,26 @@ LayoutTestBluetoothAdapterProvider::GetBaseGATTCharacteristic(
|
| MockBluetoothGattService* service,
|
| const std::string& uuid,
|
| BluetoothRemoteGattCharacteristic::Properties properties) {
|
| - return base::WrapUnique(new NiceMockBluetoothGattCharacteristic(
|
| - service, identifier, BluetoothUUID(uuid), false /* is_local */,
|
| - properties, NULL /* permissions */));
|
| + std::unique_ptr<NiceMockBluetoothGattCharacteristic> characteristic(
|
| + new NiceMockBluetoothGattCharacteristic(
|
| + service, identifier, BluetoothUUID(uuid), false /* is_local */,
|
| + properties, NULL /* permissions */));
|
| +
|
| + device::BluetoothGattService::GattErrorCode default_error =
|
| + device::BluetoothGattService::GATT_ERROR_NOT_SUPPORTED;
|
| +
|
| + // Default Write response.
|
| + ON_CALL(*characteristic, WriteRemoteCharacteristic(_, _, _))
|
| + .WillByDefault(RunCallback<2>(default_error));
|
| +
|
| + // Read response.
|
| + ON_CALL(*characteristic, ReadRemoteCharacteristic(_, _))
|
| + .WillByDefault(RunCallback<1>(default_error));
|
| +
|
| + ON_CALL(*characteristic, StartNotifySession(_, _))
|
| + .WillByDefault(RunCallback<1>(default_error));
|
| +
|
| + return characteristic;
|
| }
|
|
|
| // static
|
|
|