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

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

Issue 2634873002: Bluetooth: macOS: Implement BluetoothRemoteGattCharacteristicMac::UnsubscribeFromNotifications (Closed)
Patch Set: Correctly adding #if !defined(OS_MACOSX) Created 3 years, 10 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 "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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 void BluetoothTestMac::SimulateGattNotifySessionStartError( 415 void BluetoothTestMac::SimulateGattNotifySessionStartError(
416 BluetoothRemoteGattCharacteristic* characteristic, 416 BluetoothRemoteGattCharacteristic* characteristic,
417 BluetoothRemoteGattService::GattErrorCode error_code) { 417 BluetoothRemoteGattService::GattErrorCode error_code) {
418 MockCBCharacteristic* characteristic_mock = 418 MockCBCharacteristic* characteristic_mock =
419 GetCBMockCharacteristic(characteristic); 419 GetCBMockCharacteristic(characteristic);
420 NSError* error = BluetoothDeviceMac::GetNSErrorFromGattErrorCode(error_code); 420 NSError* error = BluetoothDeviceMac::GetNSErrorFromGattErrorCode(error_code);
421 [characteristic_mock simulateGattNotifySessionFailedWithError:error]; 421 [characteristic_mock simulateGattNotifySessionFailedWithError:error];
422 } 422 }
423 423
424 void BluetoothTestMac::SimulateGattNotifySessionStopped(
425 BluetoothRemoteGattCharacteristic* characteristic) {
426 MockCBCharacteristic* characteristic_mock =
427 GetCBMockCharacteristic(characteristic);
428 [characteristic_mock simulateGattNotifySessionStopped];
429 }
430
431 void BluetoothTestMac::SimulateGattNotifySessionStopError(
432 BluetoothRemoteGattCharacteristic* characteristic,
433 BluetoothRemoteGattService::GattErrorCode error_code) {
434 MockCBCharacteristic* characteristic_mock =
435 GetCBMockCharacteristic(characteristic);
436 NSError* error = BluetoothDeviceMac::GetNSErrorFromGattErrorCode(error_code);
437 [characteristic_mock simulateGattNotifySessionStoppedWithError:error];
438 }
439
424 void BluetoothTestMac::SimulateGattCharacteristicChanged( 440 void BluetoothTestMac::SimulateGattCharacteristicChanged(
425 BluetoothRemoteGattCharacteristic* characteristic, 441 BluetoothRemoteGattCharacteristic* characteristic,
426 const std::vector<uint8_t>& value) { 442 const std::vector<uint8_t>& value) {
427 MockCBCharacteristic* characteristic_mock = 443 MockCBCharacteristic* characteristic_mock =
428 GetCBMockCharacteristic(characteristic); 444 GetCBMockCharacteristic(characteristic);
429 scoped_nsobject<NSData> data( 445 scoped_nsobject<NSData> data(
430 [[NSData alloc] initWithBytes:value.data() length:value.size()]); 446 [[NSData alloc] initWithBytes:value.data() length:value.size()]);
431 [characteristic_mock simulateGattCharacteristicChangedWithValue:data]; 447 [characteristic_mock simulateGattCharacteristicChangedWithValue:data];
432 } 448 }
433 449
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); 558 // crypto::SHA256HashString(input_str, raw, sizeof(raw));
543 // if (base::HexEncode(raw, sizeof(raw)) == target) { 559 // if (base::HexEncode(raw, sizeof(raw)) == target) {
544 // return input_str; 560 // return input_str;
545 // } 561 // }
546 // ++input[0]; 562 // ++input[0];
547 // } 563 // }
548 // return ""; 564 // return "";
549 // } 565 // }
550 566
551 } // namespace device 567 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698