| 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 // |
| 133 // |device_ordinal| selects between multiple fake device data sets to produce: | 141 // |device_ordinal| selects between multiple fake device data sets to produce: |
| 134 // 1: Name: kTestDeviceName | 142 // 1: Name: kTestDeviceName |
| 135 // Address: kTestDeviceAddress1 | 143 // Address: kTestDeviceAddress1 |
| 136 // RSSI: kTestRSSI1 | 144 // RSSI: kTestRSSI1 |
| 137 // Advertised UUIDs: {kTestUUIDGenericAccess, kTestUUIDGenericAttribute} | 145 // Advertised UUIDs: {kTestUUIDGenericAccess, kTestUUIDGenericAttribute} |
| 138 // Service Data: {kTestUUIDHeartRate: [1]} | 146 // Service Data: {kTestUUIDHeartRate: [1]} |
| 139 // Tx Power: kTestTxPower1 | 147 // Tx Power: kTestTxPower1 |
| 140 // 2: Name: kTestDeviceName | 148 // 2: Name: kTestDeviceName |
| 141 // Address: kTestDeviceAddress1 | 149 // Address: kTestDeviceAddress1 |
| 142 // RSSI: kTestRSSI2 | 150 // RSSI: kTestRSSI2 |
| 143 // Advertised UUIDs: {kTestUUIDImmediateAlert, kTestUUIDLinkLoss} | 151 // Advertised UUIDs: {kTestUUIDImmediateAlert, kTestUUIDLinkLoss} |
| 144 // Service Data: {kTestUUIDHeartRate: [2], | 152 // Service Data: {kTestUUIDHeartRate: [], |
| 145 // kTestUUIDImmediateAlert: [0]} | 153 // kTestUUIDImmediateAlert: [0, 2]} |
| 146 // Tx Power: kTestTxPower2 | 154 // Tx Power: kTestTxPower2 |
| 147 // 3: Name: kTestDeviceNameEmpty | 155 // 3: Name: kTestDeviceNameEmpty |
| 148 // Address: kTestDeviceAddress1 | 156 // Address: kTestDeviceAddress1 |
| 149 // RSSI: kTestRSSI3 | 157 // RSSI: kTestRSSI3 |
| 150 // No Advertised UUIDs | 158 // No Advertised UUIDs |
| 151 // No Service Data | 159 // No Service Data |
| 152 // No Tx Power | 160 // No Tx Power |
| 153 // 4: Name: kTestDeviceNameEmpty | 161 // 4: Name: kTestDeviceNameEmpty |
| 154 // Address: kTestDeviceAddress2 | 162 // Address: kTestDeviceAddress2 |
| 155 // RSSI: kTestRSSI4 | 163 // RSSI: kTestRSSI4 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 int actual_error_callback_calls_ = 0; | 525 int actual_error_callback_calls_ = 0; |
| 518 bool unexpected_success_callback_ = false; | 526 bool unexpected_success_callback_ = false; |
| 519 bool unexpected_error_callback_ = false; | 527 bool unexpected_error_callback_ = false; |
| 520 | 528 |
| 521 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 529 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 522 }; | 530 }; |
| 523 | 531 |
| 524 } // namespace device | 532 } // namespace device |
| 525 | 533 |
| 526 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 534 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |