Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 1284073002: bluetooth: Add adapter to BluetoothDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-drop-callback-
Patch Set: Merge TOT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698