OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_gatt_notify_session.h" | 5 #include "device/bluetooth/test/mock_bluetooth_gatt_notify_session.h" |
6 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 6 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
7 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" | 7 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" |
8 | 8 |
9 using testing::Return; | 9 using testing::Return; |
10 | 10 |
11 namespace device { | 11 namespace device { |
12 | 12 |
13 MockBluetoothGattNotifySession::MockBluetoothGattNotifySession( | 13 MockBluetoothGattNotifySession::MockBluetoothGattNotifySession( |
14 base::WeakPtr<BluetoothRemoteGattCharacteristic> characteristic) | 14 const std::string& characteristic_identifier) { |
15 : BluetoothGattNotifySession(characteristic) { | 15 ON_CALL(*this, GetCharacteristicIdentifier()) |
| 16 .WillByDefault(Return(characteristic_identifier)); |
16 ON_CALL(*this, IsActive()).WillByDefault(Return(true)); | 17 ON_CALL(*this, IsActive()).WillByDefault(Return(true)); |
17 } | 18 } |
18 | 19 |
19 MockBluetoothGattNotifySession::~MockBluetoothGattNotifySession() { | 20 MockBluetoothGattNotifySession::~MockBluetoothGattNotifySession() { |
20 } | 21 } |
21 | 22 |
22 void MockBluetoothGattNotifySession::StartTestNotifications( | 23 void MockBluetoothGattNotifySession::StartTestNotifications( |
23 MockBluetoothAdapter* adapter, | 24 MockBluetoothAdapter* adapter, |
24 MockBluetoothGattCharacteristic* characteristic, | 25 MockBluetoothGattCharacteristic* characteristic, |
25 const std::vector<uint8_t>& value) { | 26 const std::vector<uint8_t>& value) { |
(...skipping 13 matching lines...) Loading... |
39 void MockBluetoothGattNotifySession::DoNotify( | 40 void MockBluetoothGattNotifySession::DoNotify( |
40 MockBluetoothAdapter* adapter, | 41 MockBluetoothAdapter* adapter, |
41 MockBluetoothGattCharacteristic* characteristic, | 42 MockBluetoothGattCharacteristic* characteristic, |
42 const std::vector<uint8_t>& value) { | 43 const std::vector<uint8_t>& value) { |
43 FOR_EACH_OBSERVER( | 44 FOR_EACH_OBSERVER( |
44 BluetoothAdapter::Observer, adapter->GetObservers(), | 45 BluetoothAdapter::Observer, adapter->GetObservers(), |
45 GattCharacteristicValueChanged(adapter, characteristic, value)); | 46 GattCharacteristicValueChanged(adapter, characteristic, value)); |
46 } | 47 } |
47 | 48 |
48 } // namespace device | 49 } // namespace device |
OLD | NEW |