| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 static const std::string kTestDeviceNameEmpty; | 48 static const std::string kTestDeviceNameEmpty; |
| 49 | 49 |
| 50 static const std::string kTestDeviceAddress1; | 50 static const std::string kTestDeviceAddress1; |
| 51 static const std::string kTestDeviceAddress2; | 51 static const std::string kTestDeviceAddress2; |
| 52 static const std::string kTestDeviceAddress3; | 52 static const std::string kTestDeviceAddress3; |
| 53 | 53 |
| 54 static const std::string kTestUUIDGenericAccess; | 54 static const std::string kTestUUIDGenericAccess; |
| 55 static const std::string kTestUUIDGenericAttribute; | 55 static const std::string kTestUUIDGenericAttribute; |
| 56 static const std::string kTestUUIDImmediateAlert; | 56 static const std::string kTestUUIDImmediateAlert; |
| 57 static const std::string kTestUUIDLinkLoss; | 57 static const std::string kTestUUIDLinkLoss; |
| 58 static const std::string kTestUUIDHeartRate; |
| 58 | 59 |
| 59 BluetoothTestBase(); | 60 BluetoothTestBase(); |
| 60 ~BluetoothTestBase() override; | 61 ~BluetoothTestBase() override; |
| 61 | 62 |
| 62 // Checks that no unexpected calls have been made to callbacks. | 63 // Checks that no unexpected calls have been made to callbacks. |
| 63 // Overrides of this method should always call the parent's class method. | 64 // Overrides of this method should always call the parent's class method. |
| 64 void TearDown() override; | 65 void TearDown() override; |
| 65 | 66 |
| 66 // Calls adapter_->StartDiscoverySessionWithFilter with Low Energy transport, | 67 // Calls adapter_->StartDiscoverySessionWithFilter with Low Energy transport, |
| 67 // and this fixture's callbacks expecting success. | 68 // and this fixture's callbacks expecting success. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 88 // controlled by this test fixture. | 89 // controlled by this test fixture. |
| 89 virtual void InitWithFakeAdapter() {} | 90 virtual void InitWithFakeAdapter() {} |
| 90 | 91 |
| 91 // Configures the fake adapter to lack the necessary permissions to scan for | 92 // Configures the fake adapter to lack the necessary permissions to scan for |
| 92 // devices. Returns false if the current platform always has permission. | 93 // devices. Returns false if the current platform always has permission. |
| 93 virtual bool DenyPermission(); | 94 virtual bool DenyPermission(); |
| 94 | 95 |
| 95 // Create a fake Low Energy device and discover it. | 96 // Create a fake Low Energy device and discover it. |
| 96 // |device_ordinal| selects between multiple fake device data sets to produce: | 97 // |device_ordinal| selects between multiple fake device data sets to produce: |
| 97 // 1: kTestDeviceName with advertised UUIDs kTestUUIDGenericAccess, | 98 // 1: kTestDeviceName with advertised UUIDs kTestUUIDGenericAccess, |
| 98 // kTestUUIDGenericAttribute and address kTestDeviceAddress1. | 99 // kTestUUIDGenericAttribute, address kTestDeviceAddress1 and service |
| 100 // data of {kTestUUIDHeartRate: [1]}. |
| 99 // 2: kTestDeviceName with advertised UUIDs kTestUUIDImmediateAlert, | 101 // 2: kTestDeviceName with advertised UUIDs kTestUUIDImmediateAlert, |
| 100 // kTestUUIDLinkLoss and address kTestDeviceAddress1. | 102 // kTestUUIDLinkLoss, address kTestDeviceAddress1 and service data of |
| 103 // {kTestUUIDHeartRate: [2], kTestUUIDImmediateAlert: [0]}. |
| 101 // 3: kTestDeviceNameEmpty with no advertised UUIDs and address | 104 // 3: kTestDeviceNameEmpty with no advertised UUIDs and address |
| 102 // kTestDeviceAddress1. | 105 // kTestDeviceAddress1. |
| 103 // 4: kTestDeviceNameEmpty with no advertised UUIDs and address | 106 // 4: kTestDeviceNameEmpty with no advertised UUIDs and address |
| 104 // kTestDeviceAddress2. | 107 // kTestDeviceAddress2. |
| 105 // 5: Device with no name, with no advertised UUIDs and address | 108 // 5: Device with no name, with no advertised UUIDs and address |
| 106 // kTestDeviceAddress1. | 109 // kTestDeviceAddress1. |
| 107 // 6: kTestDeviceName with no advertised UUIDs and address | 110 // 6: kTestDeviceName with no advertised UUIDs and address |
| 108 // kTestDeviceAddress2, but which also supports BR/EDR. | 111 // kTestDeviceAddress2, but which also supports BR/EDR. |
| 109 virtual BluetoothDevice* SimulateLowEnergyDevice(int device_ordinal); | 112 virtual BluetoothDevice* SimulateLowEnergyDevice(int device_ordinal); |
| 110 | 113 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 int actual_error_callback_calls_ = 0; | 443 int actual_error_callback_calls_ = 0; |
| 441 bool unexpected_success_callback_ = false; | 444 bool unexpected_success_callback_ = false; |
| 442 bool unexpected_error_callback_ = false; | 445 bool unexpected_error_callback_ = false; |
| 443 | 446 |
| 444 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 447 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 445 }; | 448 }; |
| 446 | 449 |
| 447 } // namespace device | 450 } // namespace device |
| 448 | 451 |
| 449 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 452 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |