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

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

Issue 2052513002: Read characteristic implementation on macOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@characteristicscan_servicescan_cleanup
Patch Set: Addressing msarda's comment Created 4 years, 5 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_BLUETOOTH_TEST_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
11 #include "device/bluetooth/test/bluetooth_test.h" 11 #include "device/bluetooth/test/bluetooth_test.h"
12 12
13 #if __OBJC__ 13 #if __OBJC__
14 @class MockCBCharacteristic;
14 @class MockCBPeripheral; 15 @class MockCBPeripheral;
15 #else // __OBJC__ 16 #else // __OBJC__
17 class MockCBCharacteristic;
16 class MockCBPeripheral; 18 class MockCBPeripheral;
17 #endif // __OBJC__ 19 #endif // __OBJC__
18 20
19 namespace device { 21 namespace device {
20 22
21 class BluetoothAdapterMac; 23 class BluetoothAdapterMac;
22 24
23 // Mac implementation of BluetoothTestBase. 25 // Mac implementation of BluetoothTestBase.
24 class BluetoothTestMac : public BluetoothTestBase { 26 class BluetoothTestMac : public BluetoothTestBase {
25 public: 27 public:
(...skipping 17 matching lines...) Expand all
43 BluetoothDevice* device, 45 BluetoothDevice* device,
44 BluetoothDevice::ConnectErrorCode errorCode) override; 46 BluetoothDevice::ConnectErrorCode errorCode) override;
45 void SimulateGattDisconnection(BluetoothDevice* device) override; 47 void SimulateGattDisconnection(BluetoothDevice* device) override;
46 void SimulateGattServicesDiscovered( 48 void SimulateGattServicesDiscovered(
47 BluetoothDevice* device, 49 BluetoothDevice* device,
48 const std::vector<std::string>& uuids) override; 50 const std::vector<std::string>& uuids) override;
49 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override; 51 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override;
50 void SimulateGattCharacteristic(BluetoothRemoteGattService* service, 52 void SimulateGattCharacteristic(BluetoothRemoteGattService* service,
51 const std::string& uuid, 53 const std::string& uuid,
52 int properties) override; 54 int properties) override;
55 void SimulateGattCharacteristicRead(
56 BluetoothRemoteGattCharacteristic* characteristic,
57 const std::vector<uint8_t>& value) override;
58 void SimulateGattCharacteristicReadError(
59 BluetoothRemoteGattCharacteristic* characteristic,
60 BluetoothRemoteGattService::GattErrorCode) override;
53 void SimulateGattCharacteristicRemoved( 61 void SimulateGattCharacteristicRemoved(
54 BluetoothRemoteGattService* service, 62 BluetoothRemoteGattService* service,
55 BluetoothRemoteGattCharacteristic* characteristic) override; 63 BluetoothRemoteGattCharacteristic* characteristic) override;
56 64
57 // Callback for the bluetooth central manager mock. 65 // Callback for the bluetooth central manager mock.
58 void OnFakeBluetoothDeviceConnectGattCalled(); 66 void OnFakeBluetoothDeviceConnectGattCalled();
59 void OnFakeBluetoothGattDisconnect(); 67 void OnFakeBluetoothGattDisconnect();
60 68
61 // Callback for the bluetooth peripheral mock. 69 // Callback for the bluetooth peripheral mock.
62 void OnFakeBluetoothServiceDiscovery(); 70 void OnFakeBluetoothServiceDiscovery();
71 void OnFakeBluetoothCharacteristicReadValue();
63 72
64 protected: 73 protected:
65 class ScopedMockCentralManager; 74 class ScopedMockCentralManager;
66 75
67 // Returns MockCBPeripheral from BluetoothRemoteGattService. 76 // Returns MockCBPeripheral from BluetoothRemoteGattService.
68 MockCBPeripheral* GetMockCBPeripheral( 77 MockCBPeripheral* GetMockCBPeripheral(
69 BluetoothRemoteGattService* service) const; 78 BluetoothRemoteGattService* service) const;
79 // Returns MockCBPeripheral from BluetoothRemoteGattService.
80 MockCBCharacteristic* GetCBMockCharacteristic(
81 BluetoothRemoteGattCharacteristic* characteristic) const;
70 82
71 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. 83 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes.
72 std::string FindCBUUIDForHashTarget(); 84 std::string FindCBUUIDForHashTarget();
73 85
74 BluetoothAdapterMac* adapter_mac_ = NULL; 86 BluetoothAdapterMac* adapter_mac_ = nullptr;
75 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; 87 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_;
76 }; 88 };
77 89
78 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). 90 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName).
79 typedef BluetoothTestMac BluetoothTest; 91 typedef BluetoothTestMac BluetoothTest;
80 92
81 } // namespace device 93 } // namespace device
82 94
83 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 95 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_mac.mm ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698