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

Unified Diff: device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java

Issue 1711393002: bluetooth: android: register for adapter on/off events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
diff --git a/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java b/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
index 538f618d6aa7efeadd0f9e9cea26a499a4920c99..46f9c664a5a37ff8792a7882d4c1f1c23d2f3780 100644
--- a/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
+++ b/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
@@ -9,7 +9,11 @@ import android.annotation.TargetApi;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanSettings;
+import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+
import android.os.Build;
import android.os.ParcelUuid;
@@ -133,12 +137,14 @@ class Fakes {
@Override
public boolean disable() {
mPowered = false;
+ nativeOnFakeAdapterStateChanged(mNativeBluetoothTestAndroid, false);
return true;
}
@Override
public boolean enable() {
mPowered = true;
+ nativeOnFakeAdapterStateChanged(mNativeBluetoothTestAndroid, true);
return true;
}
@@ -191,6 +197,14 @@ class Fakes {
public boolean checkPermission(String permission) {
return mPermissions.contains(permission);
}
+
+ @Override
+ public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
+ return null;
+ }
+
+ @Override
+ public void unregisterReceiver(BroadcastReceiver receiver) {}
}
/**
@@ -715,6 +729,10 @@ class Fakes {
// ---------------------------------------------------------------------------------------------
// BluetoothTestAndroid C++ methods declared for access from java:
+ // Binds to BluetoothTestAndroid::OnFakeAdapterStateChanged.
+ private static native void nativeOnFakeAdapterStateChanged(
+ long nativeBluetoothTestAndroid, boolean powered);
+
// Binds to BluetoothTestAndroid::OnFakeBluetoothDeviceConnectGattCalled.
private static native void nativeOnFakeBluetoothDeviceConnectGattCalled(
long nativeBluetoothTestAndroid);

Powered by Google App Engine
This is Rietveld 408576698