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

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

Issue 2009753002: bluetooth: Make public BluetoothDevice::GetName method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out name/alias Created 4 years, 5 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
« no previous file with comments | « no previous file | device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 GetBaseGATTService("Generic Access", device, kGenericAccessServiceUUID)); 825 GetBaseGATTService("Generic Access", device, kGenericAccessServiceUUID));
826 826
827 { // Device Name: 827 { // Device Name:
828 std::unique_ptr<NiceMockBluetoothGattCharacteristic> device_name( 828 std::unique_ptr<NiceMockBluetoothGattCharacteristic> device_name(
829 GetBaseGATTCharacteristic( 829 GetBaseGATTCharacteristic(
830 "Device Name", generic_access.get(), kDeviceNameUUID, 830 "Device Name", generic_access.get(), kDeviceNameUUID,
831 BluetoothRemoteGattCharacteristic::PROPERTY_READ | 831 BluetoothRemoteGattCharacteristic::PROPERTY_READ |
832 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE)); 832 BluetoothRemoteGattCharacteristic::PROPERTY_WRITE));
833 833
834 // Read response. 834 // Read response.
835 std::string device_name_str = device->GetDeviceName(); 835 std::vector<uint8_t> device_name_value;
836 std::vector<uint8_t> device_name_value(device_name_str.begin(), 836 if (base::Optional<std::string> name = device->GetName())
837 device_name_str.end()); 837 device_name_value.assign(name.value().begin(), name.value().end());
838
839 ON_CALL(*device_name, ReadRemoteCharacteristic(_, _)) 838 ON_CALL(*device_name, ReadRemoteCharacteristic(_, _))
840 .WillByDefault(RunCallback<0>(device_name_value)); 839 .WillByDefault(RunCallback<0>(device_name_value));
841 840
842 // Write response. 841 // Write response.
843 ON_CALL(*device_name, WriteRemoteCharacteristic(_, _, _)) 842 ON_CALL(*device_name, WriteRemoteCharacteristic(_, _, _))
844 .WillByDefault(RunCallback<1 /* success callback */>()); 843 .WillByDefault(RunCallback<1 /* success callback */>());
845 844
846 generic_access->AddMockCharacteristic(std::move(device_name)); 845 generic_access->AddMockCharacteristic(std::move(device_name));
847 } 846 }
848 847
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 return BluetoothUUID(); 1073 return BluetoothUUID();
1075 } 1074 }
1076 1075
1077 // static 1076 // static
1078 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1077 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1079 return BluetoothDevice::CanonicalizeAddress( 1078 return BluetoothDevice::CanonicalizeAddress(
1080 base::StringPrintf("%012" PRIx64, addr)); 1079 base::StringPrintf("%012" PRIx64, addr));
1081 } 1080 }
1082 1081
1083 } // namespace content 1082 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698