OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 ~BluetoothTestMac() override; | 32 ~BluetoothTestMac() override; |
33 | 33 |
34 // Test overrides: | 34 // Test overrides: |
35 void SetUp() override; | 35 void SetUp() override; |
36 | 36 |
37 // BluetoothTestBase overrides: | 37 // BluetoothTestBase overrides: |
38 bool PlatformSupportsLowEnergy() override; | 38 bool PlatformSupportsLowEnergy() override; |
39 void InitWithDefaultAdapter() override; | 39 void InitWithDefaultAdapter() override; |
40 void InitWithoutDefaultAdapter() override; | 40 void InitWithoutDefaultAdapter() override; |
41 void InitWithFakeAdapter() override; | 41 void InitWithFakeAdapter() override; |
| 42 void ResetEventCounts() override; |
42 BluetoothDevice* SimulateLowEnergyDevice(int device_ordinal) override; | 43 BluetoothDevice* SimulateLowEnergyDevice(int device_ordinal) override; |
43 void SimulateConnectedLowEnergyDevice( | 44 void SimulateConnectedLowEnergyDevice( |
44 ConnectedDeviceType device_ordinal) override; | 45 ConnectedDeviceType device_ordinal) override; |
45 void SimulateGattConnection(BluetoothDevice* device) override; | 46 void SimulateGattConnection(BluetoothDevice* device) override; |
46 void SimulateGattConnectionError( | 47 void SimulateGattConnectionError( |
47 BluetoothDevice* device, | 48 BluetoothDevice* device, |
48 BluetoothDevice::ConnectErrorCode errorCode) override; | 49 BluetoothDevice::ConnectErrorCode errorCode) override; |
49 void SimulateGattDisconnection(BluetoothDevice* device) override; | 50 void SimulateGattDisconnection(BluetoothDevice* device) override; |
50 void SimulateGattServicesDiscovered( | 51 void SimulateGattServicesDiscovered( |
51 BluetoothDevice* device, | 52 BluetoothDevice* device, |
(...skipping 25 matching lines...) Expand all Loading... |
77 BluetoothRemoteGattCharacteristic* characteristic) override; | 78 BluetoothRemoteGattCharacteristic* characteristic) override; |
78 void SimulateGattNotifySessionStopError( | 79 void SimulateGattNotifySessionStopError( |
79 BluetoothRemoteGattCharacteristic* characteristic, | 80 BluetoothRemoteGattCharacteristic* characteristic, |
80 BluetoothRemoteGattService::GattErrorCode error_code) override; | 81 BluetoothRemoteGattService::GattErrorCode error_code) override; |
81 void SimulateGattCharacteristicChanged( | 82 void SimulateGattCharacteristicChanged( |
82 BluetoothRemoteGattCharacteristic* characteristic, | 83 BluetoothRemoteGattCharacteristic* characteristic, |
83 const std::vector<uint8_t>& value) override; | 84 const std::vector<uint8_t>& value) override; |
84 void SimulateGattCharacteristicRemoved( | 85 void SimulateGattCharacteristicRemoved( |
85 BluetoothRemoteGattService* service, | 86 BluetoothRemoteGattService* service, |
86 BluetoothRemoteGattCharacteristic* characteristic) override; | 87 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 88 void ExpectedChangeNotifyValueAttempts(int attempts) override; |
| 89 void ExpectedNotifyValue(NotifyValueState expected_value_state) override; |
87 | 90 |
88 // Callback for the bluetooth central manager mock. | 91 // Callback for the bluetooth central manager mock. |
89 void OnFakeBluetoothDeviceConnectGattCalled(); | 92 void OnFakeBluetoothDeviceConnectGattCalled(); |
90 void OnFakeBluetoothGattDisconnect(); | 93 void OnFakeBluetoothGattDisconnect(); |
91 | 94 |
92 // Callback for the bluetooth peripheral mock. | 95 // Callback for the bluetooth peripheral mock. |
93 void OnFakeBluetoothServiceDiscovery(); | 96 void OnFakeBluetoothServiceDiscovery(); |
94 void OnFakeBluetoothCharacteristicReadValue(); | 97 void OnFakeBluetoothCharacteristicReadValue(); |
95 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value); | 98 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value); |
96 void OnFakeBluetoothGattSetCharacteristicNotification(bool notify_value); | 99 void OnFakeBluetoothGattSetCharacteristicNotification(bool notify_value); |
(...skipping 16 matching lines...) Expand all Loading... |
113 MockCBCharacteristic* GetCBMockCharacteristic( | 116 MockCBCharacteristic* GetCBMockCharacteristic( |
114 BluetoothRemoteGattCharacteristic* characteristic) const; | 117 BluetoothRemoteGattCharacteristic* characteristic) const; |
115 | 118 |
116 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. | 119 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. |
117 std::string FindCBUUIDForHashTarget(); | 120 std::string FindCBUUIDForHashTarget(); |
118 | 121 |
119 BluetoothAdapterMac* adapter_mac_ = nullptr; | 122 BluetoothAdapterMac* adapter_mac_ = nullptr; |
120 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; | 123 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; |
121 | 124 |
122 // Value set by -[CBPeripheral setNotifyValue:forCharacteristic:] call. | 125 // Value set by -[CBPeripheral setNotifyValue:forCharacteristic:] call. |
123 bool last_notify_value = false; | 126 bool last_notify_value_ = false; |
124 }; | 127 }; |
125 | 128 |
126 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 129 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
127 typedef BluetoothTestMac BluetoothTest; | 130 typedef BluetoothTestMac BluetoothTest; |
128 | 131 |
129 } // namespace device | 132 } // namespace device |
130 | 133 |
131 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ | 134 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ |
OLD | NEW |