| Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| index bebec897c7f6f08bed5e74ab2c8d5697c7ec27c3..ffbfe38f0f8eb0c753c30e8f142dd6b5f40ae404 100644
|
| --- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| +++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
|
| @@ -8,6 +8,9 @@
|
| #include "base/bind_helpers.h"
|
| #include "base/format_macros.h"
|
| #include "base/location.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "base/strings/string_split.h"
|
| +#include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "device/bluetooth/bluetooth_adapter.h"
|
| @@ -20,6 +23,7 @@
|
| #include "device/bluetooth/test/mock_bluetooth_gatt_notify_session.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
|
|
| +using base::StringPiece;
|
| using device::BluetoothAdapter;
|
| using device::BluetoothDevice;
|
| using device::BluetoothGattCharacteristic;
|
| @@ -141,6 +145,20 @@ LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
|
| else if (fake_adapter_name == "")
|
| return NULL;
|
|
|
| + if (base::StartsWith(fake_adapter_name, "PowerAdapter",
|
| + base::CompareCase::SENSITIVE)) {
|
| + std::vector<StringPiece> args =
|
| + base::SplitStringPiece(fake_adapter_name, ":", base::KEEP_WHITESPACE,
|
| + base::SPLIT_WANT_NONEMPTY);
|
| + DCHECK(args.size() == 3) << "Should contain AdapterName:txPower:RSSI";
|
| +
|
| + int tx_power;
|
| + base::StringToInt(args[1], &tx_power);
|
| + int rssi;
|
| + base::StringToInt(args[2], &rssi);
|
| + return GetPowerDeviceAdapter(tx_power, rssi);
|
| + }
|
| +
|
| NOTREACHED() << fake_adapter_name;
|
| return NULL;
|
| }
|
| @@ -255,6 +273,21 @@ LayoutTestBluetoothAdapterProvider::GetEmptyAdapter() {
|
|
|
| // static
|
| scoped_refptr<NiceMockBluetoothAdapter>
|
| +LayoutTestBluetoothAdapterProvider::GetPowerDeviceAdapter(int tx_power,
|
| + int rssi) {
|
| + scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
|
| + scoped_ptr<NiceMockBluetoothDevice> device(GetHeartRateDevice(adapter.get()));
|
| +
|
| + ON_CALL(*device, GetInquiryTxPower()).WillByDefault(Return(tx_power));
|
| + ON_CALL(*device, GetInquiryRSSI()).WillByDefault(Return(rssi));
|
| +
|
| + adapter->AddMockDevice(device.Pass());
|
| +
|
| + return adapter;
|
| +}
|
| +
|
| +// static
|
| +scoped_refptr<NiceMockBluetoothAdapter>
|
| LayoutTestBluetoothAdapterProvider::GetGlucoseHeartRateAdapter() {
|
| scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
|
|
|
|
|