| 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 "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid
er.h" | 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid
er.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "device/bluetooth/bluetooth_adapter.h" | 9 #include "device/bluetooth/bluetooth_adapter.h" |
| 10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 LayoutTestBluetoothAdapterProvider::GetConnectableDevice( | 444 LayoutTestBluetoothAdapterProvider::GetConnectableDevice( |
| 445 device::MockBluetoothAdapter* adapter, | 445 device::MockBluetoothAdapter* adapter, |
| 446 const std::string& device_name, | 446 const std::string& device_name, |
| 447 BluetoothDevice::UUIDList uuids) { | 447 BluetoothDevice::UUIDList uuids) { |
| 448 scoped_ptr<NiceMockBluetoothDevice> device( | 448 scoped_ptr<NiceMockBluetoothDevice> device( |
| 449 GetBaseDevice(adapter, device_name, uuids)); | 449 GetBaseDevice(adapter, device_name, uuids)); |
| 450 | 450 |
| 451 BluetoothDevice* device_ptr = device.get(); | 451 BluetoothDevice* device_ptr = device.get(); |
| 452 | 452 |
| 453 ON_CALL(*device, CreateGattConnection(_, _)) | 453 ON_CALL(*device, CreateGattConnection(_, _)) |
| 454 .WillByDefault( | 454 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>( |
| 455 RunCallbackWithResult<0 /* success_callback */>([device_ptr]() { | 455 [adapter, device_ptr]() { |
| 456 return make_scoped_ptr( | 456 return make_scoped_ptr(new NiceMockBluetoothGattConnection( |
| 457 new NiceMockBluetoothGattConnection(device_ptr->GetAddress())); | 457 adapter, device_ptr->GetAddress())); |
| 458 })); | 458 })); |
| 459 | 459 |
| 460 return device.Pass(); | 460 return device.Pass(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 // static | 463 // static |
| 464 scoped_ptr<NiceMockBluetoothDevice> | 464 scoped_ptr<NiceMockBluetoothDevice> |
| 465 LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice( | 465 LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice( |
| 466 MockBluetoothAdapter* adapter, | 466 MockBluetoothAdapter* adapter, |
| 467 BluetoothDevice::ConnectErrorCode error_code, | 467 BluetoothDevice::ConnectErrorCode error_code, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 return base::StringPrintf("%08x-97e5-4cd7-b9f1-f5a427670c59", alias); | 551 return base::StringPrintf("%08x-97e5-4cd7-b9f1-f5a427670c59", alias); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // static | 554 // static |
| 555 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { | 555 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { |
| 556 return BluetoothDevice::CanonicalizeAddress( | 556 return BluetoothDevice::CanonicalizeAddress( |
| 557 base::StringPrintf("%012" PRIx64, addr)); | 557 base::StringPrintf("%012" PRIx64, addr)); |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace content | 560 } // namespace content |
| OLD | NEW |