| 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 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 16 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 16 #include "device/bluetooth/bluetooth_uuid.h" | 17 #include "device/bluetooth/bluetooth_uuid.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 18 | 19 |
| 19 namespace device { | 20 namespace device { |
| 20 | 21 |
| 21 class BluetoothRemoteGattDescriptor; | 22 class BluetoothRemoteGattDescriptor; |
| 22 class BluetoothRemoteGattService; | 23 class BluetoothRemoteGattService; |
| 24 class MockBluetoothGattDescriptor; |
| 23 class MockBluetoothGattService; | 25 class MockBluetoothGattService; |
| 24 | 26 |
| 25 class MockBluetoothGattCharacteristic | 27 class MockBluetoothGattCharacteristic |
| 26 : public BluetoothRemoteGattCharacteristic { | 28 : public BluetoothRemoteGattCharacteristic { |
| 27 public: | 29 public: |
| 28 MockBluetoothGattCharacteristic(MockBluetoothGattService* service, | 30 MockBluetoothGattCharacteristic(MockBluetoothGattService* service, |
| 29 const std::string& identifier, | 31 const std::string& identifier, |
| 30 const BluetoothUUID& uuid, | 32 const BluetoothUUID& uuid, |
| 31 bool is_local, | 33 bool is_local, |
| 32 Properties properties, | 34 Properties properties, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 void(const NotifySessionCallback&, const ErrorCallback&)); | 53 void(const NotifySessionCallback&, const ErrorCallback&)); |
| 52 MOCK_METHOD2(StopNotifySession, | 54 MOCK_METHOD2(StopNotifySession, |
| 53 void(BluetoothGattNotifySession*, const base::Closure&)); | 55 void(BluetoothGattNotifySession*, const base::Closure&)); |
| 54 MOCK_METHOD2(ReadRemoteCharacteristic, | 56 MOCK_METHOD2(ReadRemoteCharacteristic, |
| 55 void(const ValueCallback&, const ErrorCallback&)); | 57 void(const ValueCallback&, const ErrorCallback&)); |
| 56 MOCK_METHOD3(WriteRemoteCharacteristic, | 58 MOCK_METHOD3(WriteRemoteCharacteristic, |
| 57 void(const std::vector<uint8_t>&, | 59 void(const std::vector<uint8_t>&, |
| 58 const base::Closure&, | 60 const base::Closure&, |
| 59 const ErrorCallback&)); | 61 const ErrorCallback&)); |
| 60 | 62 |
| 63 void AddMockDescriptor( |
| 64 std::unique_ptr<MockBluetoothGattDescriptor> mock_descriptor); |
| 65 std::vector<BluetoothRemoteGattDescriptor*> GetMockDescriptors() const; |
| 66 BluetoothRemoteGattDescriptor* GetMockDescriptor( |
| 67 const std::string& identifier) const; |
| 68 |
| 61 protected: | 69 protected: |
| 62 MOCK_METHOD3(SubscribeToNotifications, | 70 MOCK_METHOD3(SubscribeToNotifications, |
| 63 void(BluetoothRemoteGattDescriptor*, | 71 void(BluetoothRemoteGattDescriptor*, |
| 64 const base::Closure&, | 72 const base::Closure&, |
| 65 const ErrorCallback&)); | 73 const ErrorCallback&)); |
| 66 MOCK_METHOD3(UnsubscribeFromNotifications, | 74 MOCK_METHOD3(UnsubscribeFromNotifications, |
| 67 void(BluetoothRemoteGattDescriptor*, | 75 void(BluetoothRemoteGattDescriptor*, |
| 68 const base::Closure&, | 76 const base::Closure&, |
| 69 const ErrorCallback&)); | 77 const ErrorCallback&)); |
| 70 | 78 |
| 71 private: | 79 private: |
| 80 std::vector<std::unique_ptr<MockBluetoothGattDescriptor>> mock_descriptors_; |
| 81 |
| 72 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); | 82 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); |
| 73 }; | 83 }; |
| 74 | 84 |
| 75 } // namespace device | 85 } // namespace device |
| 76 | 86 |
| 77 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 87 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| OLD | NEW |