| 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_ANDROID_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 bool DenyPermission() override; | 32 bool DenyPermission() override; |
| 33 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; | 33 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; |
| 34 void SimulateGattConnection(BluetoothDevice* device) override; | 34 void SimulateGattConnection(BluetoothDevice* device) override; |
| 35 void SimulateGattConnectionError(BluetoothDevice* device, | 35 void SimulateGattConnectionError(BluetoothDevice* device, |
| 36 BluetoothDevice::ConnectErrorCode) override; | 36 BluetoothDevice::ConnectErrorCode) override; |
| 37 void SimulateGattDisconnection(BluetoothDevice* device) override; | 37 void SimulateGattDisconnection(BluetoothDevice* device) override; |
| 38 void SimulateGattServicesDiscovered( | 38 void SimulateGattServicesDiscovered( |
| 39 BluetoothDevice* device, | 39 BluetoothDevice* device, |
| 40 const std::vector<std::string>& uuids) override; | 40 const std::vector<std::string>& uuids) override; |
| 41 void SimulateGattServicesDiscoveryError(BluetoothDevice* device) override; | 41 void SimulateGattServicesDiscoveryError(BluetoothDevice* device) override; |
| 42 void SimulateGattCharacteristic(BluetoothGattService* service, | 42 void SimulateGattCharacteristic(BluetoothRemoteGattService* service, |
| 43 const std::string& uuid, | 43 const std::string& uuid, |
| 44 int properties) override; | 44 int properties) override; |
| 45 void RememberCharacteristicForSubsequentAction( | 45 void RememberCharacteristicForSubsequentAction( |
| 46 BluetoothGattCharacteristic* characteristic) override; | 46 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 47 void RememberCCCDescriptorForSubsequentAction( | 47 void RememberCCCDescriptorForSubsequentAction( |
| 48 BluetoothGattCharacteristic* characteristic) override; | 48 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 49 void SimulateGattNotifySessionStarted( | 49 void SimulateGattNotifySessionStarted( |
| 50 BluetoothGattCharacteristic* characteristic) override; | 50 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 51 void SimulateGattNotifySessionStartError( | 51 void SimulateGattNotifySessionStartError( |
| 52 BluetoothGattCharacteristic* characteristic, | 52 BluetoothRemoteGattCharacteristic* characteristic, |
| 53 BluetoothGattService::GattErrorCode error_code) override; | 53 BluetoothRemoteGattService::GattErrorCode error_code) override; |
| 54 void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 54 void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
| 55 BluetoothGattCharacteristic* characteristic) override; | 55 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 56 void SimulateGattCharacteristicChanged( | 56 void SimulateGattCharacteristicChanged( |
| 57 BluetoothGattCharacteristic* characteristic, | 57 BluetoothRemoteGattCharacteristic* characteristic, |
| 58 const std::vector<uint8_t>& value) override; | 58 const std::vector<uint8_t>& value) override; |
| 59 | 59 |
| 60 void SimulateGattCharacteristicRead( | 60 void SimulateGattCharacteristicRead( |
| 61 BluetoothGattCharacteristic* characteristic, | 61 BluetoothRemoteGattCharacteristic* characteristic, |
| 62 const std::vector<uint8_t>& value) override; | 62 const std::vector<uint8_t>& value) override; |
| 63 void SimulateGattCharacteristicReadError( | 63 void SimulateGattCharacteristicReadError( |
| 64 BluetoothGattCharacteristic* characteristic, | 64 BluetoothRemoteGattCharacteristic* characteristic, |
| 65 BluetoothGattService::GattErrorCode) override; | 65 BluetoothRemoteGattService::GattErrorCode) override; |
| 66 void SimulateGattCharacteristicReadWillFailSynchronouslyOnce( | 66 void SimulateGattCharacteristicReadWillFailSynchronouslyOnce( |
| 67 BluetoothGattCharacteristic* characteristic) override; | 67 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 68 | 68 |
| 69 void SimulateGattCharacteristicWrite( | 69 void SimulateGattCharacteristicWrite( |
| 70 BluetoothGattCharacteristic* characteristic) override; | 70 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 71 void SimulateGattCharacteristicWriteError( | 71 void SimulateGattCharacteristicWriteError( |
| 72 BluetoothGattCharacteristic* characteristic, | 72 BluetoothRemoteGattCharacteristic* characteristic, |
| 73 BluetoothGattService::GattErrorCode) override; | 73 BluetoothRemoteGattService::GattErrorCode) override; |
| 74 void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( | 74 void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( |
| 75 BluetoothGattCharacteristic* characteristic) override; | 75 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 76 | 76 |
| 77 void SimulateGattDescriptor(BluetoothGattCharacteristic* characteristic, | 77 void SimulateGattDescriptor(BluetoothRemoteGattCharacteristic* characteristic, |
| 78 const std::string& uuid) override; | 78 const std::string& uuid) override; |
| 79 void RememberDescriptorForSubsequentAction( | 79 void RememberDescriptorForSubsequentAction( |
| 80 BluetoothGattDescriptor* descriptor) override; | 80 BluetoothRemoteGattDescriptor* descriptor) override; |
| 81 | 81 |
| 82 void SimulateGattDescriptorRead(BluetoothGattDescriptor* descriptor, | 82 void SimulateGattDescriptorRead(BluetoothRemoteGattDescriptor* descriptor, |
| 83 const std::vector<uint8_t>& value) override; | 83 const std::vector<uint8_t>& value) override; |
| 84 void SimulateGattDescriptorReadError( | 84 void SimulateGattDescriptorReadError( |
| 85 BluetoothGattDescriptor* descriptor, | 85 BluetoothRemoteGattDescriptor* descriptor, |
| 86 BluetoothGattService::GattErrorCode) override; | 86 BluetoothRemoteGattService::GattErrorCode) override; |
| 87 void SimulateGattDescriptorReadWillFailSynchronouslyOnce( | 87 void SimulateGattDescriptorReadWillFailSynchronouslyOnce( |
| 88 BluetoothGattDescriptor* descriptor) override; | 88 BluetoothRemoteGattDescriptor* descriptor) override; |
| 89 | 89 |
| 90 void SimulateGattDescriptorWrite( | 90 void SimulateGattDescriptorWrite( |
| 91 BluetoothGattDescriptor* descriptor) override; | 91 BluetoothRemoteGattDescriptor* descriptor) override; |
| 92 void SimulateGattDescriptorWriteError( | 92 void SimulateGattDescriptorWriteError( |
| 93 BluetoothGattDescriptor* descriptor, | 93 BluetoothRemoteGattDescriptor* descriptor, |
| 94 BluetoothGattService::GattErrorCode) override; | 94 BluetoothRemoteGattService::GattErrorCode) override; |
| 95 void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( | 95 void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( |
| 96 BluetoothGattDescriptor* descriptor) override; | 96 BluetoothRemoteGattDescriptor* descriptor) override; |
| 97 | 97 |
| 98 // Instruct the fake adapter to throw an IllegalStateException for | 98 // Instruct the fake adapter to throw an IllegalStateException for |
| 99 // startScan and stopScan. | 99 // startScan and stopScan. |
| 100 void ForceIllegalStateException(); | 100 void ForceIllegalStateException(); |
| 101 | 101 |
| 102 // Records that Java FakeBluetoothDevice connectGatt was called. | 102 // Records that Java FakeBluetoothDevice connectGatt was called. |
| 103 void OnFakeBluetoothDeviceConnectGattCalled( | 103 void OnFakeBluetoothDeviceConnectGattCalled( |
| 104 JNIEnv* env, | 104 JNIEnv* env, |
| 105 const base::android::JavaParamRef<jobject>& caller); | 105 const base::android::JavaParamRef<jobject>& caller); |
| 106 | 106 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 // Records that Java FakeBluetoothAdapter onAdapterStateChanged was called. | 150 // Records that Java FakeBluetoothAdapter onAdapterStateChanged was called. |
| 151 void OnFakeAdapterStateChanged( | 151 void OnFakeAdapterStateChanged( |
| 152 JNIEnv* env, | 152 JNIEnv* env, |
| 153 const base::android::JavaParamRef<jobject>& caller, | 153 const base::android::JavaParamRef<jobject>& caller, |
| 154 const bool powered); | 154 const bool powered); |
| 155 | 155 |
| 156 base::android::ScopedJavaGlobalRef<jobject> j_fake_bluetooth_adapter_; | 156 base::android::ScopedJavaGlobalRef<jobject> j_fake_bluetooth_adapter_; |
| 157 | 157 |
| 158 int gatt_open_connections_ = 0; | 158 int gatt_open_connections_ = 0; |
| 159 BluetoothGattDescriptor* remembered_ccc_descriptor_ = nullptr; | 159 BluetoothRemoteGattDescriptor* remembered_ccc_descriptor_ = nullptr; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 162 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
| 163 typedef BluetoothTestAndroid BluetoothTest; | 163 typedef BluetoothTestAndroid BluetoothTest; |
| 164 | 164 |
| 165 } // namespace device | 165 } // namespace device |
| 166 | 166 |
| 167 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ | 167 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ |
| OLD | NEW |