| 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 aad6fe5f25b66b485fecd18dd64f7a7537ff2367..f74e692acb97e5310326869525612c045b8a32d0 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
|
| @@ -91,9 +91,8 @@ namespace content {
|
| scoped_refptr<BluetoothAdapter>
|
| LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
|
| const std::string& fake_adapter_name) {
|
| - if (fake_adapter_name == "EmptyAdapter")
|
| - return GetEmptyAdapter();
|
| - else if (fake_adapter_name == "SingleEmptyDeviceAdapter")
|
| + // Old Adapters
|
| + if (fake_adapter_name == "SingleEmptyDeviceAdapter")
|
| return GetSingleEmptyDeviceAdapter();
|
| else if (fake_adapter_name == "ConnectableDeviceAdapter")
|
| return GetConnectableDeviceAdapter();
|
| @@ -103,6 +102,13 @@ LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
|
| return GetScanFilterCheckingAdapter();
|
| else if (fake_adapter_name == "MultiDeviceAdapter")
|
| return GetMultiDeviceAdapter();
|
| + // New adapters
|
| + else if (fake_adapter_name == "BaseAdapter")
|
| + return GetBaseAdapter();
|
| + else if (fake_adapter_name == "EmptyAdapter")
|
| + return GetEmptyAdapter();
|
| + else if (fake_adapter_name == "FailStartDiscoveryAdapter")
|
| + return GetFailStartDiscoveryAdapter();
|
| else if (fake_adapter_name == "")
|
| return NULL;
|
|
|
| @@ -112,14 +118,10 @@ LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
|
|
|
| // static
|
| scoped_refptr<NiceMock<MockBluetoothAdapter>>
|
| -LayoutTestBluetoothAdapterProvider::GetEmptyAdapter() {
|
| +LayoutTestBluetoothAdapterProvider::GetBaseAdapter() {
|
| scoped_refptr<NiceMock<MockBluetoothAdapter>> adapter(
|
| new NiceMock<MockBluetoothAdapter>());
|
|
|
| - ON_CALL(*adapter, StartDiscoverySessionWithFilterRaw(_, _, _))
|
| - .WillByDefault(RunCallbackWithResult<1 /* success_callback */>(
|
| - []() { return GetDiscoverySession(); }));
|
| -
|
| // Using Invoke allows the adapter returned from this method to be futher
|
| // modified and have devices added to it. The call to ::GetDevices will
|
| // invoke ::GetConstMockDevices, returning all devices added up to that time.
|
| @@ -136,6 +138,43 @@ LayoutTestBluetoothAdapterProvider::GetEmptyAdapter() {
|
|
|
| // static
|
| scoped_refptr<NiceMock<MockBluetoothAdapter>>
|
| +LayoutTestBluetoothAdapterProvider::GetFailStartDiscoveryAdapter() {
|
| + scoped_refptr<NiceMock<MockBluetoothAdapter>> adapter(GetBaseAdapter());
|
| +
|
| + ON_CALL(*adapter, StartDiscoverySessionWithFilterRaw(_, _, _))
|
| + .WillByDefault(RunCallback<2 /* error_callback */>());
|
| +
|
| + return adapter.Pass();
|
| +}
|
| +
|
| +// static
|
| +scoped_refptr<NiceMock<MockBluetoothAdapter>>
|
| +LayoutTestBluetoothAdapterProvider::GetEmptyAdapter() {
|
| + scoped_refptr<NiceMock<MockBluetoothAdapter>> adapter(GetBaseAdapter());
|
| +
|
| + ON_CALL(*adapter, StartDiscoverySessionWithFilterRaw(_, _, _))
|
| + .WillByDefault(RunCallbackWithResult<1 /* success_callback */>(
|
| + []() { return GetDiscoverySession(); }));
|
| +
|
| + return adapter.Pass();
|
| +}
|
| +
|
| +// static
|
| +scoped_ptr<NiceMock<MockBluetoothDiscoverySession>>
|
| +LayoutTestBluetoothAdapterProvider::GetDiscoverySession() {
|
| + scoped_ptr<NiceMock<MockBluetoothDiscoverySession>> discovery_session(
|
| + new NiceMock<MockBluetoothDiscoverySession>());
|
| +
|
| + ON_CALL(*discovery_session, Stop(_, _))
|
| + .WillByDefault(RunCallback<0 /* success_callback */>());
|
| +
|
| + return discovery_session.Pass();
|
| +}
|
| +
|
| +// The functions after this haven't been updated to the new design yet.
|
| +
|
| +// static
|
| +scoped_refptr<NiceMock<MockBluetoothAdapter>>
|
| LayoutTestBluetoothAdapterProvider::GetScanFilterCheckingAdapter() {
|
| scoped_refptr<NiceMock<MockBluetoothAdapter>> adapter(
|
| new NiceMock<MockBluetoothAdapter>());
|
| @@ -228,18 +267,6 @@ LayoutTestBluetoothAdapterProvider::GetUnconnectableDeviceAdapter() {
|
| }
|
|
|
| // static
|
| -scoped_ptr<NiceMock<MockBluetoothDiscoverySession>>
|
| -LayoutTestBluetoothAdapterProvider::GetDiscoverySession() {
|
| - scoped_ptr<NiceMock<MockBluetoothDiscoverySession>> discovery_session(
|
| - new NiceMock<MockBluetoothDiscoverySession>());
|
| -
|
| - ON_CALL(*discovery_session, Stop(_, _))
|
| - .WillByDefault(RunCallback<0 /* success_callback */>());
|
| -
|
| - return discovery_session.Pass();
|
| -}
|
| -
|
| -// static
|
| scoped_ptr<NiceMock<MockBluetoothDevice>>
|
| LayoutTestBluetoothAdapterProvider::GetEmptyDevice(
|
| MockBluetoothAdapter* adapter,
|
|
|