Chromium Code Reviews| 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 "base/memory/scoped_vector.h" | |
| 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 16 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 17 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | |
| 16 #include "device/bluetooth/bluetooth_uuid.h" | 18 #include "device/bluetooth/bluetooth_uuid.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 18 | 20 |
| 19 namespace device { | 21 namespace device { |
| 20 | 22 |
| 21 class BluetoothRemoteGattDescriptor; | 23 class BluetoothRemoteGattDescriptor; |
| 22 class BluetoothRemoteGattService; | 24 class BluetoothRemoteGattService; |
| 25 class MockBluetoothGattDescriptor; | |
| 23 class MockBluetoothGattService; | 26 class MockBluetoothGattService; |
| 24 | 27 |
| 25 class MockBluetoothGattCharacteristic | 28 class MockBluetoothGattCharacteristic |
| 26 : public BluetoothRemoteGattCharacteristic { | 29 : public BluetoothRemoteGattCharacteristic { |
| 27 public: | 30 public: |
| 28 MockBluetoothGattCharacteristic(MockBluetoothGattService* service, | 31 MockBluetoothGattCharacteristic(MockBluetoothGattService* service, |
| 29 const std::string& identifier, | 32 const std::string& identifier, |
| 30 const BluetoothUUID& uuid, | 33 const BluetoothUUID& uuid, |
| 31 bool is_local, | 34 bool is_local, |
| 32 Properties properties, | 35 Properties properties, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 51 void(const NotifySessionCallback&, const ErrorCallback&)); | 54 void(const NotifySessionCallback&, const ErrorCallback&)); |
| 52 MOCK_METHOD2(StopNotifySession, | 55 MOCK_METHOD2(StopNotifySession, |
| 53 void(BluetoothGattNotifySession*, const base::Closure&)); | 56 void(BluetoothGattNotifySession*, const base::Closure&)); |
| 54 MOCK_METHOD2(ReadRemoteCharacteristic, | 57 MOCK_METHOD2(ReadRemoteCharacteristic, |
| 55 void(const ValueCallback&, const ErrorCallback&)); | 58 void(const ValueCallback&, const ErrorCallback&)); |
| 56 MOCK_METHOD3(WriteRemoteCharacteristic, | 59 MOCK_METHOD3(WriteRemoteCharacteristic, |
| 57 void(const std::vector<uint8_t>&, | 60 void(const std::vector<uint8_t>&, |
| 58 const base::Closure&, | 61 const base::Closure&, |
| 59 const ErrorCallback&)); | 62 const ErrorCallback&)); |
| 60 | 63 |
| 64 // Also see mock_bluetooth_gatt_service | |
|
ortuno
2016/11/21 03:34:08
Copy the comment in mock_bluetooth_gatt_service :p
dougt
2016/11/22 01:47:16
Acknowledged.
| |
| 65 void AddMockDescriptor( | |
| 66 std::unique_ptr<MockBluetoothGattDescriptor> mock_descriptor); | |
| 67 std::vector<BluetoothRemoteGattDescriptor*> GetMockDescriptors() const; | |
| 68 BluetoothRemoteGattDescriptor* GetMockDescriptor( | |
| 69 const std::string& identifier) const; | |
| 70 | |
| 61 protected: | 71 protected: |
| 62 MOCK_METHOD3(SubscribeToNotifications, | 72 MOCK_METHOD3(SubscribeToNotifications, |
| 63 void(BluetoothRemoteGattDescriptor*, | 73 void(BluetoothRemoteGattDescriptor*, |
| 64 const base::Closure&, | 74 const base::Closure&, |
| 65 const ErrorCallback&)); | 75 const ErrorCallback&)); |
| 66 MOCK_METHOD3(UnsubscribeFromNotifications, | 76 MOCK_METHOD3(UnsubscribeFromNotifications, |
| 67 void(BluetoothRemoteGattDescriptor*, | 77 void(BluetoothRemoteGattDescriptor*, |
| 68 const base::Closure&, | 78 const base::Closure&, |
| 69 const ErrorCallback&)); | 79 const ErrorCallback&)); |
| 70 | 80 |
| 71 private: | 81 private: |
| 82 ScopedVector<MockBluetoothGattDescriptor> mock_descriptors_; | |
|
ortuno
2016/11/21 03:34:08
ScopedVector is deprecated, use std::vector<std::u
dougt
2016/11/22 01:47:16
Acknowledged.
| |
| 83 | |
| 72 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); | 84 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); |
| 73 }; | 85 }; |
| 74 | 86 |
| 75 } // namespace device | 87 } // namespace device |
| 76 | 88 |
| 77 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 89 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| OLD | NEW |