| 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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 static const std::string kTestDeviceAddress2; | 36 static const std::string kTestDeviceAddress2; |
| 37 | 37 |
| 38 static const std::string kTestUUIDGenericAccess; | 38 static const std::string kTestUUIDGenericAccess; |
| 39 static const std::string kTestUUIDGenericAttribute; | 39 static const std::string kTestUUIDGenericAttribute; |
| 40 static const std::string kTestUUIDImmediateAlert; | 40 static const std::string kTestUUIDImmediateAlert; |
| 41 static const std::string kTestUUIDLinkLoss; | 41 static const std::string kTestUUIDLinkLoss; |
| 42 | 42 |
| 43 BluetoothTestBase(); | 43 BluetoothTestBase(); |
| 44 ~BluetoothTestBase() override; | 44 ~BluetoothTestBase() override; |
| 45 | 45 |
| 46 // Calls adapter_->StartDiscoverySession with this fixture's callbacks, and | 46 // Calls adapter_->StartDiscoverySessionWithFilter with Low Energy transport, |
| 47 // then RunLoop().RunUntilIdle(). | 47 // and this fixture's callbacks. Then RunLoop().RunUntilIdle(). |
| 48 void StartDiscoverySession(); | 48 void StartLowEnergyDiscoverySession(); |
| 49 | 49 |
| 50 // Check if Low Energy is available. On Mac, we require OS X >= 10.10. | 50 // Check if Low Energy is available. On Mac, we require OS X >= 10.10. |
| 51 virtual bool PlatformSupportsLowEnergy() = 0; | 51 virtual bool PlatformSupportsLowEnergy() = 0; |
| 52 | 52 |
| 53 // Initializes the BluetoothAdapter |adapter_| with the system adapter. | 53 // Initializes the BluetoothAdapter |adapter_| with the system adapter. |
| 54 virtual void InitWithDefaultAdapter(){}; | 54 virtual void InitWithDefaultAdapter(){}; |
| 55 | 55 |
| 56 // Initializes the BluetoothAdapter |adapter_| with the system adapter forced | 56 // Initializes the BluetoothAdapter |adapter_| with the system adapter forced |
| 57 // to be ignored as if it did not exist. This enables tests for when an | 57 // to be ignored as if it did not exist. This enables tests for when an |
| 58 // adapter is not present on the system. | 58 // adapter is not present on the system. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 int error_callback_count_ = 0; | 127 int error_callback_count_ = 0; |
| 128 int gatt_connection_attempts_ = 0; | 128 int gatt_connection_attempts_ = 0; |
| 129 int gatt_disconnection_attempts_ = 0; | 129 int gatt_disconnection_attempts_ = 0; |
| 130 int gatt_discovery_attempts_ = 0; | 130 int gatt_discovery_attempts_ = 0; |
| 131 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 131 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace device | 134 } // namespace device |
| 135 | 135 |
| 136 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 136 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |