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..7ee3df78bee899ded7f3cbd26bf1bc8dbafeafef 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,19 @@ 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() == 2); |
+ |
+ int power; |
+ base::StringToInt(args[1], &power); |
+ |
+ return GetPowerDeviceAdapter(power); |
+ } |
+ |
NOTREACHED() << fake_adapter_name; |
return NULL; |
} |
@@ -255,6 +272,20 @@ LayoutTestBluetoothAdapterProvider::GetEmptyAdapter() { |
// static |
scoped_refptr<NiceMockBluetoothAdapter> |
+LayoutTestBluetoothAdapterProvider::GetPowerDeviceAdapter(int power) { |
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter()); |
+ scoped_ptr<NiceMockBluetoothDevice> device(GetHeartRateDevice(adapter.get())); |
+ |
+ ON_CALL(*device, GetInquiryTxPower()).WillByDefault(Return(power)); |
+ ON_CALL(*device, GetInquiryRSSI()).WillByDefault(Return(power)); |
scheib
2015/10/29 17:37:25
We should return different numbers, validating the
ortuno
2015/10/29 20:21:42
Done.
|
+ |
+ adapter->AddMockDevice(device.Pass()); |
+ |
+ return adapter; |
+} |
+ |
+// static |
+scoped_refptr<NiceMockBluetoothAdapter> |
LayoutTestBluetoothAdapterProvider::GetGlucoseHeartRateAdapter() { |
scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter()); |