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 #include "device/bluetooth/test/bluetooth_test_android.h" | 5 #include "device/bluetooth/test/bluetooth_test_android.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "device/bluetooth/android/wrappers.h" | 8 #include "device/bluetooth/android/wrappers.h" |
9 #include "device/bluetooth/bluetooth_adapter_android.h" | 9 #include "device/bluetooth/bluetooth_adapter_android.h" |
| 10 #include "device/bluetooth/bluetooth_device_android.h" |
10 #include "jni/Fakes_jni.h" | 11 #include "jni/Fakes_jni.h" |
11 | 12 |
12 using base::android::AttachCurrentThread; | 13 using base::android::AttachCurrentThread; |
13 using base::android::ScopedJavaLocalRef; | 14 using base::android::ScopedJavaLocalRef; |
14 | 15 |
15 namespace device { | 16 namespace device { |
16 | 17 |
17 BluetoothTestAndroid::BluetoothTestAndroid() { | 18 BluetoothTestAndroid::BluetoothTestAndroid() { |
18 } | 19 } |
19 | 20 |
(...skipping 25 matching lines...) Expand all Loading... |
45 | 46 |
46 adapter_ = | 47 adapter_ = |
47 BluetoothAdapterAndroid::Create(j_fake_bluetooth_adapter_.obj()).get(); | 48 BluetoothAdapterAndroid::Create(j_fake_bluetooth_adapter_.obj()).get(); |
48 } | 49 } |
49 | 50 |
50 void BluetoothTestAndroid::DiscoverLowEnergyDevice(int device_ordinal) { | 51 void BluetoothTestAndroid::DiscoverLowEnergyDevice(int device_ordinal) { |
51 Java_FakeBluetoothAdapter_discoverLowEnergyDevice( | 52 Java_FakeBluetoothAdapter_discoverLowEnergyDevice( |
52 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj(), device_ordinal); | 53 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj(), device_ordinal); |
53 } | 54 } |
54 | 55 |
| 56 void BluetoothTestAndroid::CompleteGattConnection(BluetoothDevice* device) { |
| 57 BluetoothDeviceAndroid* device_android = |
| 58 static_cast<BluetoothDeviceAndroid*>(device); |
| 59 |
| 60 Java_FakeBluetoothDevice_connectionStateChange( |
| 61 AttachCurrentThread(), device_android->GetJavaObject().obj(), |
| 62 true /* success */, true /* connected */); |
| 63 } |
| 64 |
55 } // namespace device | 65 } // namespace device |
OLD | NEW |