Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 // Returns "EmptyAdapter" fake BluetoothAdapter with the following | 27 // Returns "EmptyAdapter" fake BluetoothAdapter with the following |
| 28 // characteristics: | 28 // characteristics: |
| 29 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 29 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 30 // as argument. | 30 // as argument. |
| 31 // - |GetDevices| returns an empty list of devices. | 31 // - |GetDevices| returns an empty list of devices. |
| 32 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 32 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 33 GetEmptyAdapter(); | 33 GetEmptyAdapter(); |
| 34 | 34 |
| 35 // Returns a fake BluetoothAdapter that asserts that its | |
| 36 // StartDiscoverySessionWithFilter() method is called with a filter consisting | |
| 37 // of the standard battery, heart rate, and glucose services. | |
| 38 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | |
|
scheib
2015/06/15 23:47:21
Let's clarify language pattern used on these: "run
Jeffrey Yasskin
2015/06/16 00:48:10
Done.
| |
| 39 // as argument. | |
| 40 // - |GetDevices| returns an empty list of devices. | |
| 41 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | |
| 42 GetScanFilterCheckingAdapter(); | |
| 43 | |
| 35 // Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following | 44 // Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following |
| 36 // characteristics: | 45 // characteristics: |
| 37 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 46 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 38 // as argument. | 47 // as argument. |
| 39 // - |GetDevices| returns a list with an |EmptyDevice|. | 48 // - |GetDevices| returns a list with an |EmptyDevice|. |
| 40 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 49 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 41 GetSingleEmptyDeviceAdapter(); | 50 GetSingleEmptyDeviceAdapter(); |
| 42 | 51 |
| 52 // Returns "MultiDeviceAdapter", a fake BluetoothAdapter with the following | |
| 53 // characteristics: | |
| 54 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | |
| 55 // as argument. | |
| 56 // - |GetDevices| returns a list with 2 devices: | |
| 57 // - GetUUIDs() returns a Heart Rate Service, | |
| 58 // and GetName() returns "Heart Rate Device". | |
| 59 // - GetUUIDs() returns a Glucose Service, | |
| 60 // and GetName() returns "Glucose Device". | |
| 61 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | |
| 62 GetMultiDeviceAdapter(); | |
| 63 | |
| 43 // Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the | 64 // Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the |
| 44 // following characteristics: | 65 // following characteristics: |
| 45 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 66 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 46 // as argument. | 67 // as argument. |
| 47 // - |GetDevices| returns a list with a |ConnectableDevice|. | 68 // - |GetDevices| returns a list with a |ConnectableDevice|. |
| 48 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 69 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 49 GetConnectableDeviceAdapter(); | 70 GetConnectableDeviceAdapter(); |
| 50 | 71 |
| 51 // Returns "UnconnectableDeviceAdapter" fake BluetoothAdapter with the | 72 // Returns "UnconnectableDeviceAdapter" fake BluetoothAdapter with the |
| 52 // following characteristics: | 73 // following characteristics: |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 70 // - |GetVendorID| returns 0xFFFF. | 91 // - |GetVendorID| returns 0xFFFF. |
| 71 // - |GetProductID| returns 1. | 92 // - |GetProductID| returns 1. |
| 72 // - |GetDeviceID| returns 2. | 93 // - |GetDeviceID| returns 2. |
| 73 // - |IsPaired| returns true. | 94 // - |IsPaired| returns true. |
| 74 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". | 95 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". |
| 75 // - |GetGattServices| returns a list with one service "Generic Access". | 96 // - |GetGattServices| returns a list with one service "Generic Access". |
| 76 // "Generic Access" has a "Device Name" characteristic, with a value of | 97 // "Generic Access" has a "Device Name" characteristic, with a value of |
| 77 // "Empty Mock Device Name", and a "Reconnection Address" characteristic | 98 // "Empty Mock Device Name", and a "Reconnection Address" characteristic |
| 78 // which can't be read. | 99 // which can't be read. |
| 79 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 100 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 80 GetEmptyDevice(device::MockBluetoothAdapter* adapter); | 101 GetEmptyDevice(device::MockBluetoothAdapter* adapter, |
| 102 const std::string& device_name = "Empty Mock Device"); | |
| 81 | 103 |
| 82 // Returns a fake |ConnectableDevice| with the same characteristics as | 104 // Returns a fake |ConnectableDevice| with the same characteristics as |
| 83 // |EmptyDevice| except: | 105 // |EmptyDevice| except: |
| 84 // - |CreateGattConnection| runs success callback with a | 106 // - |CreateGattConnection| runs success callback with a |
| 85 // fake BluetoothGattConnection as argument. | 107 // fake BluetoothGattConnection as argument. |
| 86 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 108 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 87 GetConnectableDevice(device::MockBluetoothAdapter* adapter); | 109 GetConnectableDevice(device::MockBluetoothAdapter* adapter); |
| 88 | 110 |
| 89 // Returns a fake |UnconnectableDevice| with the same characteristics as | 111 // Returns a fake |UnconnectableDevice| with the same characteristics as |
| 90 // |EmptyDevice| except: | 112 // |EmptyDevice| except: |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 110 // - |GetService| returns |service|. | 132 // - |GetService| returns |service|. |
| 111 // - |IsNotifying| returns false. | 133 // - |IsNotifying| returns false. |
| 112 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattCharacteristic>> | 134 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattCharacteristic>> |
| 113 GetGattCharacteristic(device::MockBluetoothGattService* service, | 135 GetGattCharacteristic(device::MockBluetoothGattService* service, |
| 114 const std::string& uuid); | 136 const std::string& uuid); |
| 115 }; | 137 }; |
| 116 | 138 |
| 117 } // namespace content | 139 } // namespace content |
| 118 | 140 |
| 119 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ | 141 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ |
| OLD | NEW |