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

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

Issue 2074563002: bluetooth: mac: write characteristic implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@read_characteristicscan_servicescan_cleanup
Patch Set: Merge from top of tree 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"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override; 51 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override;
52 void SimulateGattCharacteristic(BluetoothRemoteGattService* service, 52 void SimulateGattCharacteristic(BluetoothRemoteGattService* service,
53 const std::string& uuid, 53 const std::string& uuid,
54 int properties) override; 54 int properties) override;
55 void SimulateGattCharacteristicRead( 55 void SimulateGattCharacteristicRead(
56 BluetoothRemoteGattCharacteristic* characteristic, 56 BluetoothRemoteGattCharacteristic* characteristic,
57 const std::vector<uint8_t>& value) override; 57 const std::vector<uint8_t>& value) override;
58 void SimulateGattCharacteristicReadError( 58 void SimulateGattCharacteristicReadError(
59 BluetoothRemoteGattCharacteristic* characteristic, 59 BluetoothRemoteGattCharacteristic* characteristic,
60 BluetoothRemoteGattService::GattErrorCode) override; 60 BluetoothRemoteGattService::GattErrorCode) override;
61 void SimulateGattCharacteristicWrite(
62 BluetoothRemoteGattCharacteristic* characteristic) override;
63 void SimulateGattCharacteristicWriteError(
64 BluetoothRemoteGattCharacteristic* characteristic,
65 BluetoothRemoteGattService::GattErrorCode error_code) override;
61 void SimulateGattCharacteristicRemoved( 66 void SimulateGattCharacteristicRemoved(
62 BluetoothRemoteGattService* service, 67 BluetoothRemoteGattService* service,
63 BluetoothRemoteGattCharacteristic* characteristic) override; 68 BluetoothRemoteGattCharacteristic* characteristic) override;
64 69
65 // Callback for the bluetooth central manager mock. 70 // Callback for the bluetooth central manager mock.
66 void OnFakeBluetoothDeviceConnectGattCalled(); 71 void OnFakeBluetoothDeviceConnectGattCalled();
67 void OnFakeBluetoothGattDisconnect(); 72 void OnFakeBluetoothGattDisconnect();
68 73
69 // Callback for the bluetooth peripheral mock. 74 // Callback for the bluetooth peripheral mock.
70 void OnFakeBluetoothServiceDiscovery(); 75 void OnFakeBluetoothServiceDiscovery();
71 void OnFakeBluetoothCharacteristicReadValue(); 76 void OnFakeBluetoothCharacteristicReadValue();
77 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value);
72 78
73 protected: 79 protected:
74 class ScopedMockCentralManager; 80 class ScopedMockCentralManager;
75 81
76 // Returns MockCBPeripheral from BluetoothRemoteGattService. 82 // Returns MockCBPeripheral from BluetoothRemoteGattService.
77 MockCBPeripheral* GetMockCBPeripheral( 83 MockCBPeripheral* GetMockCBPeripheral(
78 BluetoothRemoteGattService* service) const; 84 BluetoothRemoteGattService* service) const;
79 // Returns MockCBPeripheral from BluetoothRemoteGattService. 85 // Returns MockCBPeripheral from BluetoothRemoteGattService.
80 MockCBCharacteristic* GetCBMockCharacteristic( 86 MockCBCharacteristic* GetCBMockCharacteristic(
81 BluetoothRemoteGattCharacteristic* characteristic) const; 87 BluetoothRemoteGattCharacteristic* characteristic) const;
82 88
83 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. 89 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes.
84 std::string FindCBUUIDForHashTarget(); 90 std::string FindCBUUIDForHashTarget();
85 91
86 BluetoothAdapterMac* adapter_mac_ = nullptr; 92 BluetoothAdapterMac* adapter_mac_ = nullptr;
87 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; 93 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_;
88 }; 94 };
89 95
90 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). 96 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName).
91 typedef BluetoothTestMac BluetoothTest; 97 typedef BluetoothTestMac BluetoothTest;
92 98
93 } // namespace device 99 } // namespace device
94 100
95 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 101 #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