Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: device/bluetooth/test/mock_bluetooth_gatt_characteristic.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Addressing code review comments from ortuno (still working on test changes) Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
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 // dougt TODO
ortuno 2016/11/22 03:02:02 I think you are forgetting something here?
dougt 2016/11/29 22:50:48 Done.
82 ScopedVector<MockBluetoothGattDescriptor> mock_descriptors_;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698