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

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

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Nit for the tests Created 4 years, 1 month 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
« no previous file with comments | « device/bluetooth/test/bluetooth_test.h ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 22 matching lines...) Expand all
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 BluetoothDevice* SimulateLowEnergyDevice(int device_ordinal) override; 42 BluetoothDevice* SimulateLowEnergyDevice(int device_ordinal) override;
43 void SimulateConnectedLowEnergyDevice(
44 ConnectedDeviceType device_ordinal) override;
43 void SimulateGattConnection(BluetoothDevice* device) override; 45 void SimulateGattConnection(BluetoothDevice* device) override;
44 void SimulateGattConnectionError( 46 void SimulateGattConnectionError(
45 BluetoothDevice* device, 47 BluetoothDevice* device,
46 BluetoothDevice::ConnectErrorCode errorCode) override; 48 BluetoothDevice::ConnectErrorCode errorCode) override;
47 void SimulateGattDisconnection(BluetoothDevice* device) override; 49 void SimulateGattDisconnection(BluetoothDevice* device) override;
48 void SimulateGattServicesDiscovered( 50 void SimulateGattServicesDiscovered(
49 BluetoothDevice* device, 51 BluetoothDevice* device,
50 const std::vector<std::string>& uuids) override; 52 const std::vector<std::string>& uuids) override;
51 void SimulateGattServicesChanged(BluetoothDevice* device) override; 53 void SimulateGattServicesChanged(BluetoothDevice* device) override;
52 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override; 54 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override;
(...skipping 26 matching lines...) Expand all
79 // Callback for the bluetooth central manager mock. 81 // Callback for the bluetooth central manager mock.
80 void OnFakeBluetoothDeviceConnectGattCalled(); 82 void OnFakeBluetoothDeviceConnectGattCalled();
81 void OnFakeBluetoothGattDisconnect(); 83 void OnFakeBluetoothGattDisconnect();
82 84
83 // Callback for the bluetooth peripheral mock. 85 // Callback for the bluetooth peripheral mock.
84 void OnFakeBluetoothServiceDiscovery(); 86 void OnFakeBluetoothServiceDiscovery();
85 void OnFakeBluetoothCharacteristicReadValue(); 87 void OnFakeBluetoothCharacteristicReadValue();
86 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value); 88 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value);
87 void OnFakeBluetoothGattSetCharacteristicNotification(); 89 void OnFakeBluetoothGattSetCharacteristicNotification();
88 90
91 // Returns the service UUIDs used to retrieve connected peripherals.
92 BluetoothDevice::UUIDSet RetrieveConnectedPeripheralServiceUUIDs();
93 // Reset RetrieveConnectedPeripheralServiceUUIDs set.
94 void ResetRetrieveConnectedPeripheralServiceUUIDs();
95
89 protected: 96 protected:
90 class ScopedMockCentralManager; 97 class ScopedMockCentralManager;
91 98
92 // Returns MockCBPeripheral from BluetoothRemoteGattService. 99 // Returns MockCBPeripheral from BluetoothRemoteGattService.
93 MockCBPeripheral* GetMockCBPeripheral( 100 MockCBPeripheral* GetMockCBPeripheral(
94 BluetoothRemoteGattService* service) const; 101 BluetoothRemoteGattService* service) const;
95 // Returns MockCBPeripheral from BluetoothRemoteGattService. 102 // Returns MockCBPeripheral from BluetoothRemoteGattService.
96 MockCBCharacteristic* GetCBMockCharacteristic( 103 MockCBCharacteristic* GetCBMockCharacteristic(
97 BluetoothRemoteGattCharacteristic* characteristic) const; 104 BluetoothRemoteGattCharacteristic* characteristic) const;
98 105
99 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. 106 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes.
100 std::string FindCBUUIDForHashTarget(); 107 std::string FindCBUUIDForHashTarget();
101 108
102 BluetoothAdapterMac* adapter_mac_ = nullptr; 109 BluetoothAdapterMac* adapter_mac_ = nullptr;
103 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; 110 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_;
104 }; 111 };
105 112
106 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). 113 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName).
107 typedef BluetoothTestMac BluetoothTest; 114 typedef BluetoothTestMac BluetoothTest;
108 115
109 } // namespace device 116 } // namespace device
110 117
111 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 118 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
OLDNEW
« no previous file with comments | « device/bluetooth/test/bluetooth_test.h ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698