| 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 "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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 CBPeripheral* peripheral = lowEnergyDeviceMac->GetPeripheral(); | 242 CBPeripheral* peripheral = lowEnergyDeviceMac->GetPeripheral(); |
| 243 MockCBPeripheral* mockPeripheral = (MockCBPeripheral*)peripheral; | 243 MockCBPeripheral* mockPeripheral = (MockCBPeripheral*)peripheral; |
| 244 [mockPeripheral setState:CBPeripheralStateConnected]; | 244 [mockPeripheral setState:CBPeripheralStateConnected]; |
| 245 CBCentralManager* centralManager = | 245 CBCentralManager* centralManager = |
| 246 ObjCCast<CBCentralManager>(mock_central_manager_->get()); | 246 ObjCCast<CBCentralManager>(mock_central_manager_->get()); |
| 247 [centralManager.delegate centralManager:centralManager | 247 [centralManager.delegate centralManager:centralManager |
| 248 didConnectPeripheral:peripheral]; | 248 didConnectPeripheral:peripheral]; |
| 249 } | 249 } |
| 250 | 250 |
| 251 void BluetoothTestMac::SimulateConnectedLowEnergyDevice( | 251 void BluetoothTestMac::SimulateConnectedLowEnergyDevice( |
| 252 ConnectedDeviceType device_ordinal) { | 252 ConnectedDeviceType device_type) { |
| 253 const char* identifier = nullptr; | 253 const char* identifier = nullptr; |
| 254 NSString* name = nil; | 254 NSString* name = nil; |
| 255 scoped_nsobject<NSMutableSet> cbUUIDs([[NSMutableSet alloc] init]); | 255 scoped_nsobject<NSMutableSet> cbUUIDs([[NSMutableSet alloc] init]); |
| 256 switch (device_ordinal) { | 256 switch (device_type) { |
| 257 case ConnectedDeviceType::GENERIC_DEVICE: | 257 case ConnectedDeviceType::GENERIC_DEVICE: |
| 258 name = @(kTestDeviceName.c_str()); | 258 name = @(kTestDeviceName.c_str()); |
| 259 identifier = kTestPeripheralUUID1.c_str(); | 259 identifier = kTestPeripheralUUID1.c_str(); |
| 260 [cbUUIDs | 260 [cbUUIDs |
| 261 addObject:[CBUUID UUIDWithString:@(kTestUUIDGenericAccess.c_str())]]; | 261 addObject:[CBUUID UUIDWithString:@(kTestUUIDGenericAccess.c_str())]]; |
| 262 break; | 262 break; |
| 263 case ConnectedDeviceType::HEART_RATE_DEVICE: | 263 case ConnectedDeviceType::HEART_RATE_DEVICE: |
| 264 name = @(kTestDeviceName.c_str()); | 264 name = @(kTestDeviceName.c_str()); |
| 265 identifier = kTestPeripheralUUID2.c_str(); | 265 identifier = kTestPeripheralUUID2.c_str(); |
| 266 [cbUUIDs | 266 [cbUUIDs |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); | 535 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); |
| 536 // if (base::HexEncode(raw, sizeof(raw)) == target) { | 536 // if (base::HexEncode(raw, sizeof(raw)) == target) { |
| 537 // return input_str; | 537 // return input_str; |
| 538 // } | 538 // } |
| 539 // ++input[0]; | 539 // ++input[0]; |
| 540 // } | 540 // } |
| 541 // return ""; | 541 // return ""; |
| 542 // } | 542 // } |
| 543 | 543 |
| 544 } // namespace device | 544 } // namespace device |
| OLD | NEW |