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 void AddMockDescriptor( | |
ortuno
2016/12/02 06:14:50
nit: Comment, similar to AddMockCharacteristic in
| |
65 std::unique_ptr<MockBluetoothGattDescriptor> mock_descriptor); | |
66 std::vector<BluetoothRemoteGattDescriptor*> GetMockDescriptors() const; | |
67 BluetoothRemoteGattDescriptor* GetMockDescriptor( | |
68 const std::string& identifier) const; | |
69 | |
61 protected: | 70 protected: |
62 MOCK_METHOD3(SubscribeToNotifications, | 71 MOCK_METHOD3(SubscribeToNotifications, |
63 void(BluetoothRemoteGattDescriptor*, | 72 void(BluetoothRemoteGattDescriptor*, |
64 const base::Closure&, | 73 const base::Closure&, |
65 const ErrorCallback&)); | 74 const ErrorCallback&)); |
66 MOCK_METHOD3(UnsubscribeFromNotifications, | 75 MOCK_METHOD3(UnsubscribeFromNotifications, |
67 void(BluetoothRemoteGattDescriptor*, | 76 void(BluetoothRemoteGattDescriptor*, |
68 const base::Closure&, | 77 const base::Closure&, |
69 const ErrorCallback&)); | 78 const ErrorCallback&)); |
70 | 79 |
71 private: | 80 private: |
81 ScopedVector<MockBluetoothGattDescriptor> mock_descriptors_; | |
82 | |
72 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); | 83 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); |
73 }; | 84 }; |
74 | 85 |
75 } // namespace device | 86 } // namespace device |
76 | 87 |
77 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 88 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
OLD | NEW |