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_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // Initializes the BluetoothAdapter |adapter_| with a fake adapter that can be | 124 // Initializes the BluetoothAdapter |adapter_| with a fake adapter that can be |
125 // controlled by this test fixture. | 125 // controlled by this test fixture. |
126 virtual void InitWithFakeAdapter() {} | 126 virtual void InitWithFakeAdapter() {} |
127 | 127 |
128 // Configures the fake adapter to lack the necessary permissions to scan for | 128 // Configures the fake adapter to lack the necessary permissions to scan for |
129 // devices. Returns false if the current platform always has permission. | 129 // devices. Returns false if the current platform always has permission. |
130 virtual bool DenyPermission(); | 130 virtual bool DenyPermission(); |
131 | 131 |
132 // Create a fake Low Energy device and discover it. | 132 // Create a fake Low Energy device and discover it. |
133 // |device_ordinal| with the same device address stands for the same fake | |
134 // device with different properties. | |
135 // For example: | |
136 // SimulateLowEnergyDevice(2); << First call will create a device with address | |
137 // kTestDeviceAddress1 | |
138 // SimulateLowEnergyDevice(3); << Second call will update changes to the | |
139 // device of address kTestDeviceAddress1. | |
140 // | |
141 // |device_ordinal| selects between multiple fake device data sets to produce: | 133 // |device_ordinal| selects between multiple fake device data sets to produce: |
142 // 1: Name: kTestDeviceName | 134 // 1: Name: kTestDeviceName |
143 // Address: kTestDeviceAddress1 | 135 // Address: kTestDeviceAddress1 |
144 // RSSI: kTestRSSI1 | 136 // RSSI: kTestRSSI1 |
145 // Advertised UUIDs: {kTestUUIDGenericAccess, kTestUUIDGenericAttribute} | 137 // Advertised UUIDs: {kTestUUIDGenericAccess, kTestUUIDGenericAttribute} |
146 // Service Data: {kTestUUIDHeartRate: [1]} | 138 // Service Data: {kTestUUIDHeartRate: [1]} |
147 // Tx Power: kTestTxPower1 | 139 // Tx Power: kTestTxPower1 |
148 // 2: Name: kTestDeviceName | 140 // 2: Name: kTestDeviceName |
149 // Address: kTestDeviceAddress1 | 141 // Address: kTestDeviceAddress1 |
150 // RSSI: kTestRSSI2 | 142 // RSSI: kTestRSSI2 |
151 // Advertised UUIDs: {kTestUUIDImmediateAlert, kTestUUIDLinkLoss} | 143 // Advertised UUIDs: {kTestUUIDImmediateAlert, kTestUUIDLinkLoss} |
152 // Service Data: {kTestUUIDHeartRate: [], | 144 // Service Data: {kTestUUIDHeartRate: [2], |
153 // kTestUUIDImmediateAlert: [0, 2]} | 145 // kTestUUIDImmediateAlert: [0]} |
154 // Tx Power: kTestTxPower2 | 146 // Tx Power: kTestTxPower2 |
155 // 3: Name: kTestDeviceNameEmpty | 147 // 3: Name: kTestDeviceNameEmpty |
156 // Address: kTestDeviceAddress1 | 148 // Address: kTestDeviceAddress1 |
157 // RSSI: kTestRSSI3 | 149 // RSSI: kTestRSSI3 |
158 // No Advertised UUIDs | 150 // No Advertised UUIDs |
159 // No Service Data | 151 // No Service Data |
160 // No Tx Power | 152 // No Tx Power |
161 // 4: Name: kTestDeviceNameEmpty | 153 // 4: Name: kTestDeviceNameEmpty |
162 // Address: kTestDeviceAddress2 | 154 // Address: kTestDeviceAddress2 |
163 // RSSI: kTestRSSI4 | 155 // RSSI: kTestRSSI4 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 int actual_error_callback_calls_ = 0; | 517 int actual_error_callback_calls_ = 0; |
526 bool unexpected_success_callback_ = false; | 518 bool unexpected_success_callback_ = false; |
527 bool unexpected_error_callback_ = false; | 519 bool unexpected_error_callback_ = false; |
528 | 520 |
529 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 521 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
530 }; | 522 }; |
531 | 523 |
532 } // namespace device | 524 } // namespace device |
533 | 525 |
534 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 526 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
OLD | NEW |