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 const std::string& characteristic_identifier) { | 14 base::WeakPtr<BluetoothRemoteGattCharacteristic> characteristic) |
15 ON_CALL(*this, GetCharacteristicIdentifier()) | 15 : BluetoothGattNotifySession(characteristic) { |
16 .WillByDefault(Return(characteristic_identifier)); | |
17 ON_CALL(*this, IsActive()).WillByDefault(Return(true)); | 16 ON_CALL(*this, IsActive()).WillByDefault(Return(true)); |
18 } | 17 } |
19 | 18 |
20 MockBluetoothGattNotifySession::~MockBluetoothGattNotifySession() { | 19 MockBluetoothGattNotifySession::~MockBluetoothGattNotifySession() { |
21 } | 20 } |
22 | 21 |
23 void MockBluetoothGattNotifySession::StartTestNotifications( | 22 void MockBluetoothGattNotifySession::StartTestNotifications( |
24 MockBluetoothAdapter* adapter, | 23 MockBluetoothAdapter* adapter, |
25 MockBluetoothGattCharacteristic* characteristic, | 24 MockBluetoothGattCharacteristic* characteristic, |
26 const std::vector<uint8_t>& value) { | 25 const std::vector<uint8_t>& value) { |
(...skipping 13 matching lines...) Expand all Loading... |
40 void MockBluetoothGattNotifySession::DoNotify( | 39 void MockBluetoothGattNotifySession::DoNotify( |
41 MockBluetoothAdapter* adapter, | 40 MockBluetoothAdapter* adapter, |
42 MockBluetoothGattCharacteristic* characteristic, | 41 MockBluetoothGattCharacteristic* characteristic, |
43 const std::vector<uint8_t>& value) { | 42 const std::vector<uint8_t>& value) { |
44 FOR_EACH_OBSERVER( | 43 FOR_EACH_OBSERVER( |
45 BluetoothAdapter::Observer, adapter->GetObservers(), | 44 BluetoothAdapter::Observer, adapter->GetObservers(), |
46 GattCharacteristicValueChanged(adapter, characteristic, value)); | 45 GattCharacteristicValueChanged(adapter, characteristic, value)); |
47 } | 46 } |
48 | 47 |
49 } // namespace device | 48 } // namespace device |
OLD | NEW |