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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 int properties) override; | 44 int properties) override; |
45 void RememberCharacteristicForSubsequentAction( | 45 void RememberCharacteristicForSubsequentAction( |
46 BluetoothGattCharacteristic* characteristic) override; | 46 BluetoothGattCharacteristic* characteristic) override; |
47 void SimulateGattNotifySessionStarted( | 47 void SimulateGattNotifySessionStarted( |
48 BluetoothGattCharacteristic* characteristic) override; | 48 BluetoothGattCharacteristic* characteristic) override; |
49 void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 49 void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
50 BluetoothGattCharacteristic* characteristic) override; | 50 BluetoothGattCharacteristic* characteristic) override; |
51 void SimulateGattCharacteristicChanged( | 51 void SimulateGattCharacteristicChanged( |
52 BluetoothGattCharacteristic* characteristic, | 52 BluetoothGattCharacteristic* characteristic, |
53 const std::vector<uint8_t>& value) override; | 53 const std::vector<uint8_t>& value) override; |
| 54 |
54 void SimulateGattCharacteristicRead( | 55 void SimulateGattCharacteristicRead( |
55 BluetoothGattCharacteristic* characteristic, | 56 BluetoothGattCharacteristic* characteristic, |
56 const std::vector<uint8_t>& value) override; | 57 const std::vector<uint8_t>& value) override; |
57 void SimulateGattCharacteristicReadError( | 58 void SimulateGattCharacteristicReadError( |
58 BluetoothGattCharacteristic* characteristic, | 59 BluetoothGattCharacteristic* characteristic, |
59 BluetoothGattService::GattErrorCode) override; | 60 BluetoothGattService::GattErrorCode) override; |
60 void SimulateGattCharacteristicReadWillFailSynchronouslyOnce( | 61 void SimulateGattCharacteristicReadWillFailSynchronouslyOnce( |
61 BluetoothGattCharacteristic* characteristic) override; | 62 BluetoothGattCharacteristic* characteristic) override; |
| 63 |
62 void SimulateGattCharacteristicWrite( | 64 void SimulateGattCharacteristicWrite( |
63 BluetoothGattCharacteristic* characteristic) override; | 65 BluetoothGattCharacteristic* characteristic) override; |
64 void SimulateGattCharacteristicWriteError( | 66 void SimulateGattCharacteristicWriteError( |
65 BluetoothGattCharacteristic* characteristic, | 67 BluetoothGattCharacteristic* characteristic, |
66 BluetoothGattService::GattErrorCode) override; | 68 BluetoothGattService::GattErrorCode) override; |
67 void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( | 69 void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( |
68 BluetoothGattCharacteristic* characteristic) override; | 70 BluetoothGattCharacteristic* characteristic) override; |
| 71 |
69 void SimulateGattDescriptor(BluetoothGattCharacteristic* characteristic, | 72 void SimulateGattDescriptor(BluetoothGattCharacteristic* characteristic, |
70 const std::string& uuid) override; | 73 const std::string& uuid) override; |
| 74 void RememberDescriptorForSubsequentAction( |
| 75 BluetoothGattDescriptor* descriptor) override; |
| 76 |
| 77 void SimulateGattDescriptorRead(BluetoothGattDescriptor* descriptor, |
| 78 const std::vector<uint8_t>& value) override; |
| 79 void SimulateGattDescriptorReadError( |
| 80 BluetoothGattDescriptor* descriptor, |
| 81 BluetoothGattService::GattErrorCode) override; |
| 82 void SimulateGattDescriptorReadWillFailSynchronouslyOnce( |
| 83 BluetoothGattDescriptor* descriptor) override; |
| 84 |
| 85 void SimulateGattDescriptorWrite( |
| 86 BluetoothGattDescriptor* descriptor) override; |
| 87 void SimulateGattDescriptorWriteError( |
| 88 BluetoothGattDescriptor* descriptor, |
| 89 BluetoothGattService::GattErrorCode) override; |
71 void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( | 90 void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( |
72 BluetoothGattDescriptor* descriptor) override; | 91 BluetoothGattDescriptor* descriptor) override; |
73 | 92 |
74 // Instruct the fake adapter to throw an IllegalStateException for | 93 // Instruct the fake adapter to throw an IllegalStateException for |
75 // startScan and stopScan. | 94 // startScan and stopScan. |
76 void ForceIllegalStateException(); | 95 void ForceIllegalStateException(); |
77 | 96 |
78 // Records that Java FakeBluetoothDevice connectGatt was called. | 97 // Records that Java FakeBluetoothDevice connectGatt was called. |
79 void OnFakeBluetoothDeviceConnectGattCalled( | 98 void OnFakeBluetoothDeviceConnectGattCalled( |
80 JNIEnv* env, | 99 JNIEnv* env, |
(...skipping 24 matching lines...) Expand all Loading... |
105 void OnFakeBluetoothGattReadCharacteristic( | 124 void OnFakeBluetoothGattReadCharacteristic( |
106 JNIEnv* env, | 125 JNIEnv* env, |
107 const base::android::JavaParamRef<jobject>& caller); | 126 const base::android::JavaParamRef<jobject>& caller); |
108 | 127 |
109 // Records that Java FakeBluetoothGatt writeCharacteristic was called. | 128 // Records that Java FakeBluetoothGatt writeCharacteristic was called. |
110 void OnFakeBluetoothGattWriteCharacteristic( | 129 void OnFakeBluetoothGattWriteCharacteristic( |
111 JNIEnv* env, | 130 JNIEnv* env, |
112 const base::android::JavaParamRef<jobject>& caller, | 131 const base::android::JavaParamRef<jobject>& caller, |
113 const base::android::JavaParamRef<jbyteArray>& value); | 132 const base::android::JavaParamRef<jbyteArray>& value); |
114 | 133 |
| 134 // Records that Java FakeBluetoothGatt readDescriptor was called. |
| 135 void OnFakeBluetoothGattReadDescriptor( |
| 136 JNIEnv* env, |
| 137 const base::android::JavaParamRef<jobject>& caller); |
| 138 |
115 // Records that Java FakeBluetoothGatt writeDescriptor was called. | 139 // Records that Java FakeBluetoothGatt writeDescriptor was called. |
116 void OnFakeBluetoothGattWriteDescriptor( | 140 void OnFakeBluetoothGattWriteDescriptor( |
117 JNIEnv* env, | 141 JNIEnv* env, |
118 const base::android::JavaParamRef<jobject>& caller, | 142 const base::android::JavaParamRef<jobject>& caller, |
119 const base::android::JavaParamRef<jbyteArray>& value); | 143 const base::android::JavaParamRef<jbyteArray>& value); |
120 | 144 |
121 base::android::ScopedJavaGlobalRef<jobject> j_fake_bluetooth_adapter_; | 145 base::android::ScopedJavaGlobalRef<jobject> j_fake_bluetooth_adapter_; |
122 | 146 |
123 int gatt_open_connections_ = 0; | 147 int gatt_open_connections_ = 0; |
124 }; | 148 }; |
125 | 149 |
126 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 150 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
127 typedef BluetoothTestAndroid BluetoothTest; | 151 typedef BluetoothTestAndroid BluetoothTest; |
128 | 152 |
129 } // namespace device | 153 } // namespace device |
130 | 154 |
131 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ | 155 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ |
OLD | NEW |