Fix link in German terms of service.
[chromium-blink-merge.git] / content / shell / browser / layout_test / layout_test_bluetooth_adapter_provider.h
blobecf045af432cd8173fd91b77e3867cdb10eecc34
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_
6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_
8 #include "base/callback.h"
9 #include "device/bluetooth/bluetooth_adapter_factory.h"
10 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
11 #include "device/bluetooth/test/mock_bluetooth_device.h"
12 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h"
14 namespace content {
16 // Implements fake adapters with named mock data set for use in tests as a
17 // result of layout tests calling testRunner.setBluetoothMockDataSet.
18 class LayoutTestBluetoothAdapterProvider {
19 public:
20 // Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|.
21 static scoped_refptr<device::BluetoothAdapter> GetBluetoothAdapter(
22 const std::string& fake_adapter_name);
24 private:
25 // Returns "EmptyAdapter" fake BluetoothAdapter with the following
26 // characteristics:
27 // - |StartDiscoverySession| runs the first argument with |DiscoverySession|
28 // as argument.
29 // - |GetDevices| returns an empty list of devices.
30 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
31 GetEmptyAdapter();
33 // Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following
34 // characteristics:
35 // - |StartDiscoverySession| runs the first argument with |DiscoverySession|
36 // as argument.
37 // - |GetDevices| returns a list with an |EmptyDevice|.
38 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
39 GetSingleEmptyDeviceAdapter();
41 // Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the
42 // following characteristics:
43 // - |StartDiscoverySession| runs the first argument with |DiscoverySession|
44 // as argument.
45 // - |GetDevices| returns a list with a |ConnectableDevice|.
46 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
47 GetConnectableDeviceAdapter();
49 // Returns "UnconnectableDeviceAdapter" fake BluetoothAdapter with the
50 // following characteristics:
51 // - |StartDiscoverySession| runs the first argument with |DiscoverySession|
52 // as argument.
53 // - |GetDevices| returns a list with an |UnconnectableDevice|.
54 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
55 GetUnconnectableDeviceAdapter();
57 // Returns a fake |DiscoverySession| with the following characteristics:
58 // - |Stop| runs the first argument.
59 static scoped_ptr<testing::NiceMock<device::MockBluetoothDiscoverySession>>
60 GetDiscoverySession();
62 // Returns an |EmptyDevice| with the following characeteristics:
63 // - |GetAddress| returns "Empty Mock Device instanceID".
64 // - |GetName| returns "Empty Mock Device name".
65 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see
66 // bluetooth.org/en-us/specification/assigned-numbers/baseband
67 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|.
68 // - |GetVendorID| returns 0xFFFF.
69 // - |GetProductID| returns 1.
70 // - |GetDeviceID| returns 2.
71 // - |IsPaired| returns true.
72 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801".
73 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
74 GetEmptyDevice(device::MockBluetoothAdapter* adapter);
76 // Returns a fake |ConnectableDevice| with the same characteristics as
77 // |EmptyDevice| except:
78 // - |CreateGattConnection| runs success callback with a
79 // fake BluetoothGattConnection as argument.
80 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
81 GetConnectableDevice(device::MockBluetoothAdapter* adapter);
83 // Returns a fake |UnconnectableDevice| with the same characteristics as
84 // |EmptyDevice| except:
85 // - |CreateGattConnection| runs error callback with
86 // |BluetoothDevice::ERROR_FAILED| as argument.
87 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
88 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter);
91 } // namespace content
93 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_