| 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 <iterator> | 7 #include <iterator> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 BluetoothDevice* BluetoothTestAndroid::SimulateLowEnergyDevice( | 80 BluetoothDevice* BluetoothTestAndroid::SimulateLowEnergyDevice( |
| 81 int device_ordinal) { | 81 int device_ordinal) { |
| 82 TestBluetoothAdapterObserver observer(adapter_); | 82 TestBluetoothAdapterObserver observer(adapter_); |
| 83 Java_FakeBluetoothAdapter_simulateLowEnergyDevice( | 83 Java_FakeBluetoothAdapter_simulateLowEnergyDevice( |
| 84 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj(), device_ordinal); | 84 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj(), device_ordinal); |
| 85 return observer.last_device(); | 85 return observer.last_device(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void BluetoothTestAndroid::SimulateLocationServicesOff() { |
| 89 Java_Fakes_setLocationServicesState( |
| 90 AttachCurrentThread(), true /* hasPermission */, false /* isEnabled */); |
| 91 } |
| 92 |
| 88 void BluetoothTestAndroid::ForceIllegalStateException() { | 93 void BluetoothTestAndroid::ForceIllegalStateException() { |
| 89 Java_FakeBluetoothAdapter_forceIllegalStateException( | 94 Java_FakeBluetoothAdapter_forceIllegalStateException( |
| 90 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj()); | 95 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj()); |
| 91 } | 96 } |
| 92 | 97 |
| 93 void BluetoothTestAndroid::SimulateGattConnection(BluetoothDevice* device) { | 98 void BluetoothTestAndroid::SimulateGattConnection(BluetoothDevice* device) { |
| 94 BluetoothDeviceAndroid* device_android = | 99 BluetoothDeviceAndroid* device_android = |
| 95 static_cast<BluetoothDeviceAndroid*>(device); | 100 static_cast<BluetoothDeviceAndroid*>(device); |
| 96 | 101 |
| 97 Java_FakeBluetoothDevice_connectionStateChange( | 102 Java_FakeBluetoothDevice_connectionStateChange( |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 477 } |
| 473 | 478 |
| 474 void BluetoothTestAndroid::OnFakeAdapterStateChanged( | 479 void BluetoothTestAndroid::OnFakeAdapterStateChanged( |
| 475 JNIEnv* env, | 480 JNIEnv* env, |
| 476 const JavaParamRef<jobject>& caller, | 481 const JavaParamRef<jobject>& caller, |
| 477 const bool powered) { | 482 const bool powered) { |
| 478 adapter_->NotifyAdapterPoweredChanged(powered); | 483 adapter_->NotifyAdapterPoweredChanged(powered); |
| 479 } | 484 } |
| 480 | 485 |
| 481 } // namespace device | 486 } // namespace device |
| OLD | NEW |