Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: device/bluetooth/test/bluetooth_test_android.cc

Issue 1610053005: bluetooth: android: Fix a couple of crashes when adapter is turned on/off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on latest master Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 BluetoothDevice* BluetoothTestAndroid::DiscoverLowEnergyDevice( 76 BluetoothDevice* BluetoothTestAndroid::DiscoverLowEnergyDevice(
77 int device_ordinal) { 77 int device_ordinal) {
78 TestBluetoothAdapterObserver observer(adapter_); 78 TestBluetoothAdapterObserver observer(adapter_);
79 Java_FakeBluetoothAdapter_discoverLowEnergyDevice( 79 Java_FakeBluetoothAdapter_discoverLowEnergyDevice(
80 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj(), device_ordinal); 80 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj(), device_ordinal);
81 return observer.last_device(); 81 return observer.last_device();
82 } 82 }
83 83
84 void BluetoothTestAndroid::ForceIllegalStateException() {
85 Java_FakeBluetoothAdapter_forceIllegalStateException(
86 AttachCurrentThread(), j_fake_bluetooth_adapter_.obj());
87 }
88
84 void BluetoothTestAndroid::SimulateGattConnection(BluetoothDevice* device) { 89 void BluetoothTestAndroid::SimulateGattConnection(BluetoothDevice* device) {
85 BluetoothDeviceAndroid* device_android = 90 BluetoothDeviceAndroid* device_android =
86 static_cast<BluetoothDeviceAndroid*>(device); 91 static_cast<BluetoothDeviceAndroid*>(device);
87 92
88 Java_FakeBluetoothDevice_connectionStateChange( 93 Java_FakeBluetoothDevice_connectionStateChange(
89 AttachCurrentThread(), device_android->GetJavaObject().obj(), 94 AttachCurrentThread(), device_android->GetJavaObject().obj(),
90 0, // android.bluetooth.BluetoothGatt.GATT_SUCCESS 95 0, // android.bluetooth.BluetoothGatt.GATT_SUCCESS
91 true); // connected 96 true); // connected
92 } 97 }
93 98
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 350
346 void BluetoothTestAndroid::OnFakeBluetoothGattWriteDescriptor( 351 void BluetoothTestAndroid::OnFakeBluetoothGattWriteDescriptor(
347 JNIEnv* env, 352 JNIEnv* env,
348 const JavaParamRef<jobject>& caller, 353 const JavaParamRef<jobject>& caller,
349 const JavaParamRef<jbyteArray>& value) { 354 const JavaParamRef<jbyteArray>& value) {
350 gatt_write_descriptor_attempts_++; 355 gatt_write_descriptor_attempts_++;
351 base::android::JavaByteArrayToByteVector(env, value, &last_write_value_); 356 base::android::JavaByteArrayToByteVector(env, value, &last_write_value_);
352 } 357 }
353 358
354 } // namespace device 359 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698