| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
_H_ | 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_ | 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "device/bluetooth/bluetooth_adapter_factory.h" | 9 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 10 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 // Returns "EmptyAdapter" fake BluetoothAdapter with the following | 25 // Returns "EmptyAdapter" fake BluetoothAdapter with the following |
| 26 // characteristics: | 26 // characteristics: |
| 27 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 27 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 28 // as argument. | 28 // as argument. |
| 29 // - |GetDevices| returns an empty list of devices. | 29 // - |GetDevices| returns an empty list of devices. |
| 30 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 30 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 31 GetEmptyAdapter(); | 31 GetEmptyAdapter(); |
| 32 | 32 |
| 33 // Returns a fake BluetoothAdapter that asserts that its |
| 34 // StartDiscoverySessionWithFilter() method is called with a filter consisting |
| 35 // of the standard battery, heart rate, and glucose services. |
| 36 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 37 // as argument. |
| 38 // - |GetDevices| returns an empty list of devices. |
| 39 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 40 GetScanFilterCheckingAdapter(); |
| 41 |
| 33 // Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following | 42 // Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following |
| 34 // characteristics: | 43 // characteristics: |
| 35 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 44 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 36 // as argument. | 45 // as argument. |
| 37 // - |GetDevices| returns a list with an |EmptyDevice|. | 46 // - |GetDevices| returns a list with an |EmptyDevice|. |
| 38 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 47 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 39 GetSingleEmptyDeviceAdapter(); | 48 GetSingleEmptyDeviceAdapter(); |
| 40 | 49 |
| 50 // Returns "MultiDeviceAdapter", a fake BluetoothAdapter with the following |
| 51 // characteristics: |
| 52 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 53 // as argument. |
| 54 // - |GetDevices| returns a list with 2 devices: |
| 55 // - GetUUIDs() returns a Heart Rate Service, |
| 56 // and GetName() returns "Heart Rate Device". |
| 57 // - GetUUIDs() returns a Glucose Service, |
| 58 // and GetName() returns "Glucose Device". |
| 59 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 60 GetMultiDeviceAdapter(); |
| 61 |
| 41 // Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the | 62 // Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the |
| 42 // following characteristics: | 63 // following characteristics: |
| 43 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 64 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 44 // as argument. | 65 // as argument. |
| 45 // - |GetDevices| returns a list with a |ConnectableDevice|. | 66 // - |GetDevices| returns a list with a |ConnectableDevice|. |
| 46 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 67 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 47 GetConnectableDeviceAdapter(); | 68 GetConnectableDeviceAdapter(); |
| 48 | 69 |
| 49 // Returns "UnconnectableDeviceAdapter" fake BluetoothAdapter with the | 70 // Returns "UnconnectableDeviceAdapter" fake BluetoothAdapter with the |
| 50 // following characteristics: | 71 // following characteristics: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 // bluetooth.org/en-us/specification/assigned-numbers/baseband | 87 // bluetooth.org/en-us/specification/assigned-numbers/baseband |
| 67 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. | 88 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. |
| 68 // - |GetVendorID| returns 0xFFFF. | 89 // - |GetVendorID| returns 0xFFFF. |
| 69 // - |GetProductID| returns 1. | 90 // - |GetProductID| returns 1. |
| 70 // - |GetDeviceID| returns 2. | 91 // - |GetDeviceID| returns 2. |
| 71 // - |IsPaired| returns true. | 92 // - |IsPaired| returns true. |
| 72 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". | 93 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". |
| 73 // - |GetGattServices| returns a list with two services "Generic Access" and | 94 // - |GetGattServices| returns a list with two services "Generic Access" and |
| 74 // "Generic Attribute". | 95 // "Generic Attribute". |
| 75 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 96 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 76 GetEmptyDevice(device::MockBluetoothAdapter* adapter); | 97 GetEmptyDevice(device::MockBluetoothAdapter* adapter, |
| 98 const std::string& device_name = "Empty Mock Device"); |
| 77 | 99 |
| 78 // Returns a fake |ConnectableDevice| with the same characteristics as | 100 // Returns a fake |ConnectableDevice| with the same characteristics as |
| 79 // |EmptyDevice| except: | 101 // |EmptyDevice| except: |
| 80 // - |CreateGattConnection| runs success callback with a | 102 // - |CreateGattConnection| runs success callback with a |
| 81 // fake BluetoothGattConnection as argument. | 103 // fake BluetoothGattConnection as argument. |
| 82 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 104 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 83 GetConnectableDevice(device::MockBluetoothAdapter* adapter); | 105 GetConnectableDevice(device::MockBluetoothAdapter* adapter); |
| 84 | 106 |
| 85 // Returns a fake |UnconnectableDevice| with the same characteristics as | 107 // Returns a fake |UnconnectableDevice| with the same characteristics as |
| 86 // |EmptyDevice| except: | 108 // |EmptyDevice| except: |
| 87 // - |CreateGattConnection| runs error callback with | 109 // - |CreateGattConnection| runs error callback with |
| 88 // |BluetoothDevice::ERROR_FAILED| as argument. | 110 // |BluetoothDevice::ERROR_FAILED| as argument. |
| 89 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 111 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 90 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter); | 112 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter); |
| 91 | 113 |
| 92 // Returns a fake BluetoothGattService with the following characteristics: | 114 // Returns a fake BluetoothGattService with the following characteristics: |
| 93 // - |GetIdentifier| returns |uuid|. | 115 // - |GetIdentifier| returns |uuid|. |
| 94 // - |GetUUID| returns BluetoothUUID(|uuid|). | 116 // - |GetUUID| returns BluetoothUUID(|uuid|). |
| 95 // - |IsLocal| returns false. | 117 // - |IsLocal| returns false. |
| 96 // - |IsPrimary| returns true. | 118 // - |IsPrimary| returns true. |
| 97 // - |GetDevice| returns |device|. | 119 // - |GetDevice| returns |device|. |
| 98 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> | 120 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> |
| 99 GetMockService(device::MockBluetoothDevice* device, const std::string& uuid); | 121 GetMockService(device::MockBluetoothDevice* device, const std::string& uuid); |
| 100 }; | 122 }; |
| 101 | 123 |
| 102 } // namespace content | 124 } // namespace content |
| 103 | 125 |
| 104 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
DER_H_ | 126 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
DER_H_ |
| OLD | NEW |