| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 - (void)didDiscoverCharactericsForAllServices { | 135 - (void)didDiscoverCharactericsForAllServices { |
| 136 for (CBService* service in _services.get()) { | 136 for (CBService* service in _services.get()) { |
| 137 [_delegate peripheral:self.peripheral | 137 [_delegate peripheral:self.peripheral |
| 138 didDiscoverCharacteristicsForService:service | 138 didDiscoverCharacteristicsForService:service |
| 139 error:nil]; | 139 error:nil]; |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 - (void)didModifyServices:(NSArray*)invalidatedServices { | 143 - (void)didModifyServices:(NSArray*)invalidatedServices { |
| 144 // -[CBPeripheralDelegate peripheral:didModifyServices:] is only available | |
| 145 // with 10.9. It is safe to call this method (even if chrome is running on | |
| 146 // 10.8) since WebBluetooth is enabled only with 10.10. | |
| 147 // TODO(crbug.com/653056) | |
| 148 DCHECK( | 144 DCHECK( |
| 149 [_delegate respondsToSelector:@selector(peripheral:didModifyServices:)]); | 145 [_delegate respondsToSelector:@selector(peripheral:didModifyServices:)]); |
| 150 #pragma clang diagnostic push | |
| 151 #pragma clang diagnostic ignored "-Wpartial-availability" | |
| 152 [_delegate peripheral:self.peripheral didModifyServices:invalidatedServices]; | 146 [_delegate peripheral:self.peripheral didModifyServices:invalidatedServices]; |
| 153 #pragma clang diagnostic pop | |
| 154 } | 147 } |
| 155 | 148 |
| 156 - (NSUUID*)identifier { | 149 - (NSUUID*)identifier { |
| 157 return _identifier.get(); | 150 return _identifier.get(); |
| 158 } | 151 } |
| 159 | 152 |
| 160 - (NSString*)name { | 153 - (NSString*)name { |
| 161 return _name.get(); | 154 return _name.get(); |
| 162 } | 155 } |
| 163 | 156 |
| 164 - (NSArray*)services { | 157 - (NSArray*)services { |
| 165 return _services.get(); | 158 return _services.get(); |
| 166 } | 159 } |
| 167 | 160 |
| 168 - (CBPeripheral*)peripheral { | 161 - (CBPeripheral*)peripheral { |
| 169 return ObjCCast<CBPeripheral>(self); | 162 return ObjCCast<CBPeripheral>(self); |
| 170 } | 163 } |
| 171 | 164 |
| 172 - (void)setNotifyValue:(BOOL)notification | 165 - (void)setNotifyValue:(BOOL)notification |
| 173 forCharacteristic:(CBCharacteristic*)characteristic { | 166 forCharacteristic:(CBCharacteristic*)characteristic { |
| 174 _bluetoothTestMac->OnFakeBluetoothGattSetCharacteristicNotification(); | 167 _bluetoothTestMac->OnFakeBluetoothGattSetCharacteristicNotification(); |
| 175 } | 168 } |
| 176 | 169 |
| 177 @end | 170 @end |
| OLD | NEW |