| 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/mock_bluetooth_cbperipheral_mac.h" | 5 #include "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "device/bluetooth/test/bluetooth_test_mac.h" | 9 #include "device/bluetooth/test/bluetooth_test_mac.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h" | 10 #include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 - (void)addServices:(NSArray*)services { | 91 - (void)addServices:(NSArray*)services { |
| 92 for (CBUUID* uuid in services) { | 92 for (CBUUID* uuid in services) { |
| 93 base::scoped_nsobject<MockCBService> service( | 93 base::scoped_nsobject<MockCBService> service( |
| 94 [[MockCBService alloc] initWithCBUUID:uuid primary:YES]); | 94 [[MockCBService alloc] initWithCBUUID:uuid primary:YES]); |
| 95 [_services.get() addObject:service.get().service]; | 95 [_services.get() addObject:service.get().service]; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 - (void)didDiscoverWithError:(NSError*)error { | 99 - (void)didDiscoverServicesWithError:(NSError*)error { |
| 100 [_delegate peripheral:self.peripheral didDiscoverServices:error]; | 100 [_delegate peripheral:self.peripheral didDiscoverServices:error]; |
| 101 } | 101 } |
| 102 | 102 |
| 103 - (void)removeService:(CBService*)service { | 103 - (void)removeService:(CBService*)service { |
| 104 base::scoped_nsobject<CBService> serviceToRemove(service, | 104 base::scoped_nsobject<CBService> serviceToRemove(service, |
| 105 base::scoped_policy::RETAIN); | 105 base::scoped_policy::RETAIN); |
| 106 [_services.get() removeObject:serviceToRemove]; | 106 [_services.get() removeObject:serviceToRemove]; |
| 107 NSAssert(serviceToRemove, @"Unknown service to remove %@", service); | 107 NSAssert(serviceToRemove, @"Unknown service to remove %@", service); |
| 108 [_services.get() removeObject:serviceToRemove]; | 108 [_services.get() removeObject:serviceToRemove]; |
| 109 // -[CBPeripheralDelegate peripheral:didModifyServices:] is only available | 109 // -[CBPeripheralDelegate peripheral:didModifyServices:] is only available |
| (...skipping 17 matching lines...) Expand all Loading... |
| 127 | 127 |
| 128 - (NSArray*)services { | 128 - (NSArray*)services { |
| 129 return _services.get(); | 129 return _services.get(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 - (CBPeripheral*)peripheral { | 132 - (CBPeripheral*)peripheral { |
| 133 return ObjCCast<CBPeripheral>(self); | 133 return ObjCCast<CBPeripheral>(self); |
| 134 } | 134 } |
| 135 | 135 |
| 136 @end | 136 @end |
| OLD | NEW |