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

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

Issue 2094633003: Bluetooth: Mac: implementation for start notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write_read_characteristicscan_servicescan_cleanup
Patch Set: Addressing msarda's comments 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 61 void SimulateGattCharacteristicWrite(
62 BluetoothRemoteGattCharacteristic* characteristic) override; 62 BluetoothRemoteGattCharacteristic* characteristic) override;
63 void SimulateGattCharacteristicWriteError( 63 void SimulateGattCharacteristicWriteError(
64 BluetoothRemoteGattCharacteristic* characteristic, 64 BluetoothRemoteGattCharacteristic* characteristic,
65 BluetoothRemoteGattService::GattErrorCode error_code) override; 65 BluetoothRemoteGattService::GattErrorCode error_code) override;
66 void SimulateGattNotifySessionStarted(
67 BluetoothRemoteGattCharacteristic* characteristic) override;
68 void SimulateGattNotifySessionStartError(
69 BluetoothRemoteGattCharacteristic* characteristic,
70 BluetoothRemoteGattService::GattErrorCode error_code) override;
71 void SimulateGattCharacteristicChanged(
72 BluetoothRemoteGattCharacteristic* characteristic,
73 const std::vector<uint8_t>& value) override;
66 void SimulateGattCharacteristicRemoved( 74 void SimulateGattCharacteristicRemoved(
67 BluetoothRemoteGattService* service, 75 BluetoothRemoteGattService* service,
68 BluetoothRemoteGattCharacteristic* characteristic) override; 76 BluetoothRemoteGattCharacteristic* characteristic) override;
69 77
70 // Callback for the bluetooth central manager mock. 78 // Callback for the bluetooth central manager mock.
71 void OnFakeBluetoothDeviceConnectGattCalled(); 79 void OnFakeBluetoothDeviceConnectGattCalled();
72 void OnFakeBluetoothGattDisconnect(); 80 void OnFakeBluetoothGattDisconnect();
73 81
74 // Callback for the bluetooth peripheral mock. 82 // Callback for the bluetooth peripheral mock.
75 void OnFakeBluetoothServiceDiscovery(); 83 void OnFakeBluetoothServiceDiscovery();
76 void OnFakeBluetoothCharacteristicReadValue(); 84 void OnFakeBluetoothCharacteristicReadValue();
77 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value); 85 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value);
86 void OnFakeBluetoothGattSetCharacteristicNotification();
78 87
79 protected: 88 protected:
80 class ScopedMockCentralManager; 89 class ScopedMockCentralManager;
81 90
82 // Returns MockCBPeripheral from BluetoothRemoteGattService. 91 // Returns MockCBPeripheral from BluetoothRemoteGattService.
83 MockCBPeripheral* GetMockCBPeripheral( 92 MockCBPeripheral* GetMockCBPeripheral(
84 BluetoothRemoteGattService* service) const; 93 BluetoothRemoteGattService* service) const;
85 // Returns MockCBPeripheral from BluetoothRemoteGattService. 94 // Returns MockCBPeripheral from BluetoothRemoteGattService.
86 MockCBCharacteristic* GetCBMockCharacteristic( 95 MockCBCharacteristic* GetCBMockCharacteristic(
87 BluetoothRemoteGattCharacteristic* characteristic) const; 96 BluetoothRemoteGattCharacteristic* characteristic) const;
88 97
89 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. 98 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes.
90 std::string FindCBUUIDForHashTarget(); 99 std::string FindCBUUIDForHashTarget();
91 100
92 BluetoothAdapterMac* adapter_mac_ = nullptr; 101 BluetoothAdapterMac* adapter_mac_ = nullptr;
93 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; 102 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_;
94 }; 103 };
95 104
96 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). 105 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName).
97 typedef BluetoothTestMac BluetoothTest; 106 typedef BluetoothTestMac BluetoothTest;
98 107
99 } // namespace device 108 } // namespace device
100 109
101 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 110 #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