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

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

Issue 1926623002: bluetooth: Remove the device info and device class fields from BluetoothDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 <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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Devices 581 // Devices
582 582
583 // static 583 // static
584 std::unique_ptr<NiceMockBluetoothDevice> 584 std::unique_ptr<NiceMockBluetoothDevice>
585 LayoutTestBluetoothAdapterProvider::GetBaseDevice( 585 LayoutTestBluetoothAdapterProvider::GetBaseDevice(
586 MockBluetoothAdapter* adapter, 586 MockBluetoothAdapter* adapter,
587 const std::string& device_name, 587 const std::string& device_name,
588 device::BluetoothDevice::UUIDList uuids, 588 device::BluetoothDevice::UUIDList uuids,
589 const std::string& address) { 589 const std::string& address) {
590 std::unique_ptr<NiceMockBluetoothDevice> device(new NiceMockBluetoothDevice( 590 std::unique_ptr<NiceMockBluetoothDevice> device(new NiceMockBluetoothDevice(
591 adapter, 0x1F00 /* Bluetooth class */, device_name, address, 591 adapter, device_name, address, true /* paired */, true /* connected */));
ortuno 2016/04/27 20:16:41 You still need these. Bluez still relies on this c
592 true /* paired */, true /* connected */));
593 592
594 ON_CALL(*device, GetUUIDs()).WillByDefault(Return(uuids)); 593 ON_CALL(*device, GetUUIDs()).WillByDefault(Return(uuids));
595 594
596 // Using Invoke allows the device returned from this method to be futher 595 // Using Invoke allows the device returned from this method to be futher
597 // modified and have more services added to it. The call to ::GetGattServices 596 // modified and have more services added to it. The call to ::GetGattServices
598 // will invoke ::GetMockServices, returning all services added up to that 597 // will invoke ::GetMockServices, returning all services added up to that
599 // time. 598 // time.
600 ON_CALL(*device, GetGattServices()) 599 ON_CALL(*device, GetGattServices())
601 .WillByDefault( 600 .WillByDefault(
602 Invoke(device.get(), &MockBluetoothDevice::GetMockServices)); 601 Invoke(device.get(), &MockBluetoothDevice::GetMockServices));
603 // The call to BluetoothDevice::GetGattService will invoke ::GetMockService 602 // The call to BluetoothDevice::GetGattService will invoke ::GetMockService
604 // which returns a service matching the identifier provided if the service 603 // which returns a service matching the identifier provided if the service
605 // was added to the mock. 604 // was added to the mock.
606 ON_CALL(*device, GetGattService(_)) 605 ON_CALL(*device, GetGattService(_))
607 .WillByDefault( 606 .WillByDefault(
608 Invoke(device.get(), &MockBluetoothDevice::GetMockService)); 607 Invoke(device.get(), &MockBluetoothDevice::GetMockService));
609 608
610 ON_CALL(*device, GetVendorIDSource())
611 .WillByDefault(Return(BluetoothDevice::VENDOR_ID_BLUETOOTH));
612 ON_CALL(*device, GetVendorID()).WillByDefault(Return(0xFFFF));
613 ON_CALL(*device, GetProductID()).WillByDefault(Return(1));
614 ON_CALL(*device, GetDeviceID()).WillByDefault(Return(2));
615
616 return device; 609 return device;
617 } 610 }
618 611
619 // static 612 // static
620 std::unique_ptr<NiceMockBluetoothDevice> 613 std::unique_ptr<NiceMockBluetoothDevice>
621 LayoutTestBluetoothAdapterProvider::GetBatteryDevice( 614 LayoutTestBluetoothAdapterProvider::GetBatteryDevice(
622 MockBluetoothAdapter* adapter) { 615 MockBluetoothAdapter* adapter) {
623 BluetoothDevice::UUIDList uuids; 616 BluetoothDevice::UUIDList uuids;
624 uuids.push_back(BluetoothUUID(kBatteryServiceUUID)); 617 uuids.push_back(BluetoothUUID(kBatteryServiceUUID));
625 618
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 return BluetoothUUID(); 1029 return BluetoothUUID();
1037 } 1030 }
1038 1031
1039 // static 1032 // static
1040 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1033 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1041 return BluetoothDevice::CanonicalizeAddress( 1034 return BluetoothDevice::CanonicalizeAddress(
1042 base::StringPrintf("%012" PRIx64, addr)); 1035 base::StringPrintf("%012" PRIx64, addr));
1043 } 1036 }
1044 1037
1045 } // namespace content 1038 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698