| 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 998450a3a49b79e304583e73de3cb9a86d215947..93d169998520f38e26e82df36a37bddd9679b6b8 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
|
| @@ -48,6 +48,9 @@ class Fakes {
|
| // https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html#getTxPowerLevel()
|
| private static final int NO_TX_POWER = Integer.MIN_VALUE;
|
|
|
| + private static final String GAP_NAME = "FakeBluetoothDevice";
|
| + private static final String ADVERTISED_NAME = "FakeBluetooth";
|
| +
|
| /**
|
| * Sets the factory for LocationUtils to return an instance whose
|
| * hasAndroidLocationPermission and isSystemLocationSettingEnabled return
|
| @@ -114,11 +117,10 @@ class Fakes {
|
| uuids.add(ParcelUuid.fromString("00001800-0000-1000-8000-00805f9b34fb"));
|
| uuids.add(ParcelUuid.fromString("00001801-0000-1000-8000-00805f9b34fb"));
|
|
|
| - mFakeScanner.mScanCallback.onScanResult(
|
| - ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| - new FakeScanResult(new FakeBluetoothDevice(this, "01:00:00:90:1E:BE",
|
| - "FakeBluetoothDevice"),
|
| - TestRSSI.LOWEST, uuids, TestTxPower.LOWEST));
|
| + mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| + new FakeScanResult(
|
| + new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", GAP_NAME),
|
| + TestRSSI.LOWEST, ADVERTISED_NAME, uuids, TestTxPower.LOWEST));
|
| break;
|
| }
|
| case 2: {
|
| @@ -126,40 +128,38 @@ class Fakes {
|
| uuids.add(ParcelUuid.fromString("00001802-0000-1000-8000-00805f9b34fb"));
|
| uuids.add(ParcelUuid.fromString("00001803-0000-1000-8000-00805f9b34fb"));
|
|
|
| - mFakeScanner.mScanCallback.onScanResult(
|
| - ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| - new FakeScanResult(new FakeBluetoothDevice(this, "01:00:00:90:1E:BE",
|
| - "FakeBluetoothDevice"),
|
| - TestRSSI.LOWER, uuids, TestTxPower.LOWER));
|
| + mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| + new FakeScanResult(
|
| + new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", GAP_NAME),
|
| + TestRSSI.LOWER, null /* advertisedName */, uuids,
|
| + TestTxPower.LOWER));
|
| break;
|
| }
|
| case 3: {
|
| ArrayList<ParcelUuid> uuids = null;
|
| - mFakeScanner.mScanCallback.onScanResult(
|
| - ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| + mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| new FakeScanResult(
|
| new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", ""),
|
| - TestRSSI.LOW, uuids, NO_TX_POWER));
|
| + TestRSSI.LOW, null /* advertisedName */, uuids, NO_TX_POWER));
|
|
|
| break;
|
| }
|
| case 4: {
|
| ArrayList<ParcelUuid> uuids = null;
|
| - mFakeScanner.mScanCallback.onScanResult(
|
| - ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| + mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| new FakeScanResult(
|
| new FakeBluetoothDevice(this, "02:00:00:8B:74:63", ""),
|
| - TestRSSI.MEDIUM, uuids, NO_TX_POWER));
|
| + TestRSSI.MEDIUM, null /* advertisedName */, uuids,
|
| + NO_TX_POWER));
|
|
|
| break;
|
| }
|
| case 5: {
|
| ArrayList<ParcelUuid> uuids = null;
|
| - mFakeScanner.mScanCallback.onScanResult(
|
| - ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| + mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
|
| new FakeScanResult(
|
| new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", null),
|
| - TestRSSI.HIGH, uuids, NO_TX_POWER));
|
| + TestRSSI.HIGH, null /* advertisedName */, uuids, NO_TX_POWER));
|
| break;
|
| }
|
| }
|
| @@ -286,14 +286,16 @@ class Fakes {
|
| static class FakeScanResult extends Wrappers.ScanResultWrapper {
|
| private final FakeBluetoothDevice mDevice;
|
| private final int mRssi;
|
| + private final String mAdvertisedName;
|
| private final int mTxPower;
|
| private final ArrayList<ParcelUuid> mUuids;
|
|
|
| - FakeScanResult(
|
| - FakeBluetoothDevice device, int rssi, ArrayList<ParcelUuid> uuids, int txPower) {
|
| + FakeScanResult(FakeBluetoothDevice device, int rssi, String advertisedName,
|
| + ArrayList<ParcelUuid> uuids, int txPower) {
|
| super(null);
|
| mDevice = device;
|
| mRssi = rssi;
|
| + mAdvertisedName = advertisedName;
|
| mUuids = uuids;
|
| mTxPower = txPower;
|
| }
|
| @@ -309,6 +311,11 @@ class Fakes {
|
| }
|
|
|
| @Override
|
| + public String getScanRecord_getDeviceName() {
|
| + return mAdvertisedName;
|
| + }
|
| +
|
| + @Override
|
| public List<ParcelUuid> getScanRecord_getServiceUuids() {
|
| return mUuids;
|
| }
|
|
|