| 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" |
| 11 #include "device/bluetooth/test/bluetooth_test.h" | 11 #include "device/bluetooth/test/bluetooth_test.h" |
| 12 | 12 |
| 13 namespace device { | 13 namespace device { |
| 14 | 14 |
| 15 class BluetoothAdapterAndroid; | 15 class BluetoothAdapterAndroid; |
| 16 | 16 |
| 17 // Android implementation of BluetoothTestBase. | 17 // Android implementation of BluetoothTestBase. |
| 18 class BluetoothTestAndroid : public BluetoothTestBase { | 18 class BluetoothTestAndroid : public BluetoothTestBase { |
| 19 public: | 19 public: |
| 20 BluetoothTestAndroid(); | 20 BluetoothTestAndroid(); |
| 21 ~BluetoothTestAndroid() override; | 21 ~BluetoothTestAndroid() override; |
| 22 | 22 |
| 23 // Test overrides: | 23 // Test overrides: |
| 24 void SetUp() override; | 24 void SetUp() override; |
| 25 void TearDown() override; |
| 25 | 26 |
| 26 // BluetoothTestBase overrides: | 27 // BluetoothTestBase overrides: |
| 27 bool PlatformSupportsLowEnergy() override; | 28 bool PlatformSupportsLowEnergy() override; |
| 28 void InitWithDefaultAdapter() override; | 29 void InitWithDefaultAdapter() override; |
| 29 void InitWithoutDefaultAdapter() override; | 30 void InitWithoutDefaultAdapter() override; |
| 30 void InitWithFakeAdapter() override; | 31 void InitWithFakeAdapter() override; |
| 31 bool DenyPermission() override; | 32 bool DenyPermission() override; |
| 32 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; | 33 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; |
| 33 void SimulateGattConnection(BluetoothDevice* device) override; | 34 void SimulateGattConnection(BluetoothDevice* device) override; |
| 34 void SimulateGattConnectionError(BluetoothDevice* device, | 35 void SimulateGattConnectionError(BluetoothDevice* device, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Records that Java FakeBluetoothDevice connectGatt was called. | 74 // Records that Java FakeBluetoothDevice connectGatt was called. |
| 74 void OnFakeBluetoothDeviceConnectGattCalled( | 75 void OnFakeBluetoothDeviceConnectGattCalled( |
| 75 JNIEnv* env, | 76 JNIEnv* env, |
| 76 const base::android::JavaParamRef<jobject>& caller); | 77 const base::android::JavaParamRef<jobject>& caller); |
| 77 | 78 |
| 78 // Records that Java FakeBluetoothGatt disconnect was called. | 79 // Records that Java FakeBluetoothGatt disconnect was called. |
| 79 void OnFakeBluetoothGattDisconnect( | 80 void OnFakeBluetoothGattDisconnect( |
| 80 JNIEnv* env, | 81 JNIEnv* env, |
| 81 const base::android::JavaParamRef<jobject>& caller); | 82 const base::android::JavaParamRef<jobject>& caller); |
| 82 | 83 |
| 84 // Records that Java FakeBluetoothGatt close was called. |
| 85 void OnFakeBluetoothGattClose( |
| 86 JNIEnv* env, |
| 87 const base::android::JavaParamRef<jobject>& caller); |
| 88 |
| 83 // Records that Java FakeBluetoothGatt discoverServices was called. | 89 // Records that Java FakeBluetoothGatt discoverServices was called. |
| 84 void OnFakeBluetoothGattDiscoverServices( | 90 void OnFakeBluetoothGattDiscoverServices( |
| 85 JNIEnv* env, | 91 JNIEnv* env, |
| 86 const base::android::JavaParamRef<jobject>& caller); | 92 const base::android::JavaParamRef<jobject>& caller); |
| 87 | 93 |
| 88 // Records that Java FakeBluetoothGatt setCharacteristicNotification was | 94 // Records that Java FakeBluetoothGatt setCharacteristicNotification was |
| 89 // called. | 95 // called. |
| 90 void OnFakeBluetoothGattSetCharacteristicNotification( | 96 void OnFakeBluetoothGattSetCharacteristicNotification( |
| 91 JNIEnv* env, | 97 JNIEnv* env, |
| 92 const base::android::JavaParamRef<jobject>& caller); | 98 const base::android::JavaParamRef<jobject>& caller); |
| 93 | 99 |
| 94 // Records that Java FakeBluetoothGatt readCharacteristic was called. | 100 // Records that Java FakeBluetoothGatt readCharacteristic was called. |
| 95 void OnFakeBluetoothGattReadCharacteristic( | 101 void OnFakeBluetoothGattReadCharacteristic( |
| 96 JNIEnv* env, | 102 JNIEnv* env, |
| 97 const base::android::JavaParamRef<jobject>& caller); | 103 const base::android::JavaParamRef<jobject>& caller); |
| 98 | 104 |
| 99 // Records that Java FakeBluetoothGatt writeCharacteristic was called. | 105 // Records that Java FakeBluetoothGatt writeCharacteristic was called. |
| 100 void OnFakeBluetoothGattWriteCharacteristic( | 106 void OnFakeBluetoothGattWriteCharacteristic( |
| 101 JNIEnv* env, | 107 JNIEnv* env, |
| 102 const base::android::JavaParamRef<jobject>& caller, | 108 const base::android::JavaParamRef<jobject>& caller, |
| 103 const base::android::JavaParamRef<jbyteArray>& value); | 109 const base::android::JavaParamRef<jbyteArray>& value); |
| 104 | 110 |
| 105 // Records that Java FakeBluetoothGatt writeDescriptor was called. | 111 // Records that Java FakeBluetoothGatt writeDescriptor was called. |
| 106 void OnFakeBluetoothGattWriteDescriptor( | 112 void OnFakeBluetoothGattWriteDescriptor( |
| 107 JNIEnv* env, | 113 JNIEnv* env, |
| 108 const base::android::JavaParamRef<jobject>& caller, | 114 const base::android::JavaParamRef<jobject>& caller, |
| 109 const base::android::JavaParamRef<jbyteArray>& value); | 115 const base::android::JavaParamRef<jbyteArray>& value); |
| 110 | 116 |
| 111 base::android::ScopedJavaGlobalRef<jobject> j_fake_bluetooth_adapter_; | 117 base::android::ScopedJavaGlobalRef<jobject> j_fake_bluetooth_adapter_; |
| 118 |
| 119 int gatt_open_connections_ = 0; |
| 112 }; | 120 }; |
| 113 | 121 |
| 114 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 122 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
| 115 typedef BluetoothTestAndroid BluetoothTest; | 123 typedef BluetoothTestAndroid BluetoothTest; |
| 116 | 124 |
| 117 } // namespace device | 125 } // namespace device |
| 118 | 126 |
| 119 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ | 127 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_ANDROID_H_ |
| OLD | NEW |