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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 if (services.size() > 0) { | 461 if (services.size() > 0) { |
462 return services; | 462 return services; |
463 } | 463 } |
464 | 464 |
465 scoped_ptr<NiceMockBluetoothGattService> heart_rate( | 465 scoped_ptr<NiceMockBluetoothGattService> heart_rate( |
466 GetBaseGATTService(device_ptr, kHeartRateServiceUUID)); | 466 GetBaseGATTService(device_ptr, kHeartRateServiceUUID)); |
467 | 467 |
468 device_ptr->AddMockService(std::move(heart_rate)); | 468 device_ptr->AddMockService(std::move(heart_rate)); |
469 base::ThreadTaskRunnerHandle::Get()->PostTask( | 469 base::ThreadTaskRunnerHandle::Get()->PostTask( |
470 FROM_HERE, base::Bind(&NotifyServicesDiscovered, | 470 FROM_HERE, base::Bind(&NotifyServicesDiscovered, |
471 make_scoped_refptr(adapter_ptr), device_ptr)); | 471 base::RetainedRef(adapter_ptr), device_ptr)); |
472 | 472 |
473 DCHECK(services.size() == 0); | 473 DCHECK(services.size() == 0); |
474 return services; | 474 return services; |
475 })); | 475 })); |
476 | 476 |
477 adapter->AddMockDevice(std::move(device)); | 477 adapter->AddMockDevice(std::move(device)); |
478 | 478 |
479 return adapter; | 479 return adapter; |
480 } | 480 } |
481 | 481 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 scoped_ptr<NiceMockBluetoothDevice> device( | 648 scoped_ptr<NiceMockBluetoothDevice> device( |
649 GetBaseDevice(adapter, device_name, uuids, address)); | 649 GetBaseDevice(adapter, device_name, uuids, address)); |
650 | 650 |
651 MockBluetoothDevice* device_ptr = device.get(); | 651 MockBluetoothDevice* device_ptr = device.get(); |
652 | 652 |
653 ON_CALL(*device, CreateGattConnection(_, _)) | 653 ON_CALL(*device, CreateGattConnection(_, _)) |
654 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>( | 654 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>( |
655 [adapter, device_ptr]() { | 655 [adapter, device_ptr]() { |
656 base::ThreadTaskRunnerHandle::Get()->PostTask( | 656 base::ThreadTaskRunnerHandle::Get()->PostTask( |
657 FROM_HERE, base::Bind(&NotifyServicesDiscovered, | 657 FROM_HERE, base::Bind(&NotifyServicesDiscovered, |
658 make_scoped_refptr(adapter), device_ptr)); | 658 base::RetainedRef(adapter), device_ptr)); |
659 return make_scoped_ptr(new NiceMockBluetoothGattConnection( | 659 return make_scoped_ptr(new NiceMockBluetoothGattConnection( |
660 adapter, device_ptr->GetAddress())); | 660 adapter, device_ptr->GetAddress())); |
661 })); | 661 })); |
662 | 662 |
663 return device; | 663 return device; |
664 } | 664 } |
665 | 665 |
666 // static | 666 // static |
667 scoped_ptr<NiceMockBluetoothDevice> | 667 scoped_ptr<NiceMockBluetoothDevice> |
668 LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice( | 668 LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice( |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 return BluetoothUUID(); | 1035 return BluetoothUUID(); |
1036 } | 1036 } |
1037 | 1037 |
1038 // static | 1038 // static |
1039 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { | 1039 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { |
1040 return BluetoothDevice::CanonicalizeAddress( | 1040 return BluetoothDevice::CanonicalizeAddress( |
1041 base::StringPrintf("%012" PRIx64, addr)); | 1041 base::StringPrintf("%012" PRIx64, addr)); |
1042 } | 1042 } |
1043 | 1043 |
1044 } // namespace content | 1044 } // namespace content |
OLD | NEW |