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

Side by Side Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 2205693003: bluetooth: Replace old advertised uuids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Improve comments Created 4 years, 4 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 | « device/bluetooth/test/bluetooth_test_mac.h ('k') | no next file » | 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 "device/bluetooth/test/bluetooth_test_mac.h" 5 #include "device/bluetooth/test/bluetooth_test_mac.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 MockCBPeripheral* peripheral_mock = ObjCCast<MockCBPeripheral>(peripheral); 240 MockCBPeripheral* peripheral_mock = ObjCCast<MockCBPeripheral>(peripheral);
241 scoped_nsobject<NSMutableArray> services([[NSMutableArray alloc] init]); 241 scoped_nsobject<NSMutableArray> services([[NSMutableArray alloc] init]);
242 for (auto uuid : uuids) { 242 for (auto uuid : uuids) {
243 CBUUID* cb_service_uuid = [CBUUID UUIDWithString:@(uuid.c_str())]; 243 CBUUID* cb_service_uuid = [CBUUID UUIDWithString:@(uuid.c_str())];
244 [services addObject:cb_service_uuid]; 244 [services addObject:cb_service_uuid];
245 } 245 }
246 [peripheral_mock addServices:services]; 246 [peripheral_mock addServices:services];
247 DidDiscoverServices(peripheral_mock); 247 DidDiscoverServices(peripheral_mock);
248 } 248 }
249 249
250 void BluetoothTestMac::SimulateGattServicesChanged(BluetoothDevice* device) {
251 BluetoothLowEnergyDeviceMac* device_mac =
252 static_cast<BluetoothLowEnergyDeviceMac*>(device);
253 CBPeripheral* peripheral = device_mac->GetPeripheral();
254 MockCBPeripheral* peripheral_mock = ObjCCast<MockCBPeripheral>(peripheral);
255 [peripheral_mock didModifyServices:@[]];
256 }
257
250 void BluetoothTestMac::SimulateGattServiceRemoved( 258 void BluetoothTestMac::SimulateGattServiceRemoved(
251 BluetoothRemoteGattService* service) { 259 BluetoothRemoteGattService* service) {
252 BluetoothUUID bluetooth_service_uuid = service->GetUUID(); 260 BluetoothUUID bluetooth_service_uuid = service->GetUUID();
253 std::string service_uuid_string = bluetooth_service_uuid.canonical_value(); 261 std::string service_uuid_string = bluetooth_service_uuid.canonical_value();
254 BluetoothRemoteGattServiceMac* mac_gatt_service = 262 BluetoothRemoteGattServiceMac* mac_gatt_service =
255 static_cast<BluetoothRemoteGattServiceMac*>(service); 263 static_cast<BluetoothRemoteGattServiceMac*>(service);
256 BluetoothDevice* device = service->GetDevice(); 264 BluetoothDevice* device = service->GetDevice();
257 BluetoothLowEnergyDeviceMac* device_mac = 265 BluetoothLowEnergyDeviceMac* device_mac =
258 static_cast<BluetoothLowEnergyDeviceMac*>(device); 266 static_cast<BluetoothLowEnergyDeviceMac*>(device);
259 CBPeripheral* peripheral = device_mac->GetPeripheral(); 267 CBPeripheral* peripheral = device_mac->GetPeripheral();
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); 442 // crypto::SHA256HashString(input_str, raw, sizeof(raw));
435 // if (base::HexEncode(raw, sizeof(raw)) == target) { 443 // if (base::HexEncode(raw, sizeof(raw)) == target) {
436 // return input_str; 444 // return input_str;
437 // } 445 // }
438 // ++input[0]; 446 // ++input[0];
439 // } 447 // }
440 // return ""; 448 // return "";
441 // } 449 // }
442 450
443 } // namespace device 451 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/test/bluetooth_test_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698