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_gatt_characteristic.h" | 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
16 #include "device/bluetooth/bluetooth_uuid.h" | 16 #include "device/bluetooth/bluetooth_uuid.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 | 18 |
19 namespace device { | 19 namespace device { |
20 | 20 |
21 class BluetoothGattDescriptor; | 21 class BluetoothRemoteGattDescriptor; |
22 class BluetoothGattService; | 22 class BluetoothRemoteGattService; |
23 class MockBluetoothGattService; | 23 class MockBluetoothGattService; |
24 | 24 |
25 class MockBluetoothGattCharacteristic : public BluetoothGattCharacteristic { | 25 class MockBluetoothGattCharacteristic |
| 26 : public BluetoothRemoteGattCharacteristic { |
26 public: | 27 public: |
27 MockBluetoothGattCharacteristic(MockBluetoothGattService* service, | 28 MockBluetoothGattCharacteristic(MockBluetoothGattService* service, |
28 const std::string& identifier, | 29 const std::string& identifier, |
29 const BluetoothUUID& uuid, | 30 const BluetoothUUID& uuid, |
30 bool is_local, | 31 bool is_local, |
31 Properties properties, | 32 Properties properties, |
32 Permissions permissions); | 33 Permissions permissions); |
33 virtual ~MockBluetoothGattCharacteristic(); | 34 virtual ~MockBluetoothGattCharacteristic(); |
34 | 35 |
35 MOCK_CONST_METHOD0(GetIdentifier, std::string()); | 36 MOCK_CONST_METHOD0(GetIdentifier, std::string()); |
36 MOCK_CONST_METHOD0(GetUUID, BluetoothUUID()); | 37 MOCK_CONST_METHOD0(GetUUID, BluetoothUUID()); |
37 MOCK_CONST_METHOD0(IsLocal, bool()); | 38 MOCK_CONST_METHOD0(IsLocal, bool()); |
38 MOCK_CONST_METHOD0(GetValue, const std::vector<uint8_t>&()); | 39 MOCK_CONST_METHOD0(GetValue, const std::vector<uint8_t>&()); |
39 MOCK_CONST_METHOD0(GetService, BluetoothGattService*()); | 40 MOCK_CONST_METHOD0(GetService, BluetoothRemoteGattService*()); |
40 MOCK_CONST_METHOD0(GetProperties, Properties()); | 41 MOCK_CONST_METHOD0(GetProperties, Properties()); |
41 MOCK_CONST_METHOD0(GetPermissions, Permissions()); | 42 MOCK_CONST_METHOD0(GetPermissions, Permissions()); |
42 MOCK_CONST_METHOD0(IsNotifying, bool()); | 43 MOCK_CONST_METHOD0(IsNotifying, bool()); |
43 MOCK_CONST_METHOD0(GetDescriptors, std::vector<BluetoothGattDescriptor*>()); | 44 MOCK_CONST_METHOD0(GetDescriptors, |
| 45 std::vector<BluetoothRemoteGattDescriptor*>()); |
44 MOCK_CONST_METHOD1(GetDescriptor, | 46 MOCK_CONST_METHOD1(GetDescriptor, |
45 BluetoothGattDescriptor*(const std::string&)); | 47 BluetoothRemoteGattDescriptor*(const std::string&)); |
46 MOCK_METHOD1(AddDescriptor, bool(BluetoothGattDescriptor*)); | 48 MOCK_METHOD1(AddDescriptor, bool(BluetoothRemoteGattDescriptor*)); |
47 MOCK_METHOD1(UpdateValue, bool(const std::vector<uint8_t>&)); | 49 MOCK_METHOD1(UpdateValue, bool(const std::vector<uint8_t>&)); |
48 MOCK_METHOD2(StartNotifySession, | 50 MOCK_METHOD2(StartNotifySession, |
49 void(const NotifySessionCallback&, const ErrorCallback&)); | 51 void(const NotifySessionCallback&, const ErrorCallback&)); |
50 MOCK_METHOD2(ReadRemoteCharacteristic, | 52 MOCK_METHOD2(ReadRemoteCharacteristic, |
51 void(const ValueCallback&, const ErrorCallback&)); | 53 void(const ValueCallback&, const ErrorCallback&)); |
52 MOCK_METHOD3(WriteRemoteCharacteristic, | 54 MOCK_METHOD3(WriteRemoteCharacteristic, |
53 void(const std::vector<uint8_t>&, | 55 void(const std::vector<uint8_t>&, |
54 const base::Closure&, | 56 const base::Closure&, |
55 const ErrorCallback&)); | 57 const ErrorCallback&)); |
56 | 58 |
57 private: | 59 private: |
58 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); | 60 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattCharacteristic); |
59 }; | 61 }; |
60 | 62 |
61 } // namespace device | 63 } // namespace device |
62 | 64 |
63 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 65 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
OLD | NEW |