| 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/test/mock_bluetooth_adapter.h" | 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_device.h" | 10 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // None. | 35 // None. |
| 36 // Mock Functions: | 36 // Mock Functions: |
| 37 // - GetDevices: | 37 // - GetDevices: |
| 38 // Returns a list of devices added to the adapter. | 38 // Returns a list of devices added to the adapter. |
| 39 // - GetDevice: | 39 // - GetDevice: |
| 40 // Returns a device matching the address provided if the device was | 40 // Returns a device matching the address provided if the device was |
| 41 // added to the adapter. | 41 // added to the adapter. |
| 42 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 42 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 43 GetBaseAdapter(); | 43 GetBaseAdapter(); |
| 44 | 44 |
| 45 // |PresentAdapter| |
| 46 // Inherits from |BaseAdapter| |
| 47 // Devices added: |
| 48 // None. |
| 49 // Mock Functions: |
| 50 // - IsPresent: Returns true |
| 51 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 52 GetPresentAdapter(); |
| 53 |
| 54 // |NotPresentAdapter| |
| 55 // Inherits from |BaseAdapter| |
| 56 // Devices added: |
| 57 // None. |
| 58 // Mock Functions: |
| 59 // - IsPresent: Returns false |
| 60 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 61 GetNotPresentAdapter(); |
| 62 |
| 63 // |PoweredAdapter| |
| 64 // Inherits from |PresentAdapter| |
| 65 // Devices added: |
| 66 // None. |
| 67 // Mock Functions: |
| 68 // - IsPowered: Returns true |
| 69 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 70 GetPoweredAdapter(); |
| 71 |
| 72 // |NotPoweredAdapter| |
| 73 // Inherits from |PresentAdapter| |
| 74 // Devices added: |
| 75 // None. |
| 76 // Mock Functions: |
| 77 // - IsPowered: Returns false |
| 78 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 79 GetNotPoweredAdapter(); |
| 80 |
| 45 // |ScanFilterCheckingAdapter| | 81 // |ScanFilterCheckingAdapter| |
| 46 // Inherits from |BaseAdapter| | 82 // Inherits from |PoweredAdapter| |
| 47 // BluetoothAdapter that asserts that its StartDiscoverySessionWithFilter() | 83 // BluetoothAdapter that asserts that its StartDiscoverySessionWithFilter() |
| 48 // method is called with a filter consisting of the standard battery, heart | 84 // method is called with a filter consisting of the standard battery, heart |
| 49 // rate, and glucose services. | 85 // rate, and glucose services. |
| 50 // Devices added: | 86 // Devices added: |
| 51 // - |BatteryDevice| | 87 // - |BatteryDevice| |
| 52 // Mock Functions: | 88 // Mock Functions: |
| 53 // - StartDiscoverySessionWithFilter: | 89 // - StartDiscoverySessionWithFilter: |
| 54 // - With correct arguments: Run success callback. | 90 // - With correct arguments: Run success callback. |
| 55 // - With incorrect arguments: Mock complains that function with | 91 // - With incorrect arguments: Mock complains that function with |
| 56 // correct arguments was never called and error callback is called. | 92 // correct arguments was never called and error callback is called. |
| 57 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 93 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 58 GetScanFilterCheckingAdapter(); | 94 GetScanFilterCheckingAdapter(); |
| 59 | 95 |
| 60 // |FailStartDiscoveryAdapter| | 96 // |FailStartDiscoveryAdapter| |
| 61 // Inherits from |BaseAdapter| | 97 // Inherits from |PoweredAdapter| |
| 62 // Devices added: | 98 // Devices added: |
| 63 // None. | 99 // None. |
| 64 // Mock Functions: | 100 // Mock Functions: |
| 65 // - StartDiscoverySessionWithFilter: | 101 // - StartDiscoverySessionWithFilter: |
| 66 // Run error callback. | 102 // Run error callback. |
| 67 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 103 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 68 GetFailStartDiscoveryAdapter(); | 104 GetFailStartDiscoveryAdapter(); |
| 69 | 105 |
| 70 // |EmptyAdapter| | 106 // |EmptyAdapter| |
| 71 // Inherits from |BaseAdapter| | 107 // Inherits from |PoweredAdapter| |
| 72 // Devices Added: | 108 // Devices Added: |
| 73 // None. | 109 // None. |
| 74 // Mock Functions: | 110 // Mock Functions: |
| 75 // - StartDiscoverySessionWithFilter: | 111 // - StartDiscoverySessionWithFilter: |
| 76 // Run success callback with |DiscoverySession|. | 112 // Run success callback with |DiscoverySession|. |
| 77 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 113 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 78 GetEmptyAdapter(); | 114 GetEmptyAdapter(); |
| 79 | 115 |
| 80 // |GlucoseHeartRateAdapter| | 116 // |GlucoseHeartRateAdapter| |
| 81 // Inherits from |EmptyAdapter| | 117 // Inherits from |EmptyAdapter| |
| (...skipping 27 matching lines...) Expand all Loading... |
| 109 // - Generic Access UUID (0x1800) | 145 // - Generic Access UUID (0x1800) |
| 110 // - Generic Access Service | 146 // - Generic Access Service |
| 111 // - Device Name Characteristic: | 147 // - Device Name Characteristic: |
| 112 // - Mock Functions: | 148 // - Mock Functions: |
| 113 // - Read: Calls success callback with device's name. | 149 // - Read: Calls success callback with device's name. |
| 114 // - Write: Calls success callback. | 150 // - Write: Calls success callback. |
| 115 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 151 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 116 GetGenericAccessAdapter(); | 152 GetGenericAccessAdapter(); |
| 117 | 153 |
| 118 // |FailingConnectionsAdapter| | 154 // |FailingConnectionsAdapter| |
| 119 // Inherits from |BaseAdapter| | 155 // Inherits from |EmptyAdapter| |
| 120 // FailingConnectionsAdapter holds a device for each type of connection error | 156 // FailingConnectionsAdapter holds a device for each type of connection error |
| 121 // that can occur. This way we don’t need to create an adapter for each type | 157 // that can occur. This way we don’t need to create an adapter for each type |
| 122 // of error. Each of the devices has a service with a different UUID so that | 158 // of error. Each of the devices has a service with a different UUID so that |
| 123 // they can be accessed by using different filters. | 159 // they can be accessed by using different filters. |
| 124 // See errorUUID() declaration below. | 160 // See errorUUID() declaration below. |
| 125 // Internal Structure: | 161 // Internal Structure: |
| 126 // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN) errorUUID(0x0) | 162 // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN) errorUUID(0x0) |
| 127 // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS) errorUUID(0x1) | 163 // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS) errorUUID(0x1) |
| 128 // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED) errorUUID(0x2) | 164 // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED) errorUUID(0x2) |
| 129 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED) errorUUID(0x3) | 165 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED) errorUUID(0x3) |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 407 |
| 372 // Function to turn an integer into an MAC address of the form | 408 // Function to turn an integer into an MAC address of the form |
| 373 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) | 409 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) |
| 374 // returns "00:00:DE:AD:BE:EF". | 410 // returns "00:00:DE:AD:BE:EF". |
| 375 static std::string makeMACAddress(uint64_t addr); | 411 static std::string makeMACAddress(uint64_t addr); |
| 376 }; | 412 }; |
| 377 | 413 |
| 378 } // namespace content | 414 } // namespace content |
| 379 | 415 |
| 380 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
DER_H_ | 416 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
DER_H_ |
| OLD | NEW |