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 "base/strings/utf_string_conversions.h" | |
|
Jeffrey Yasskin
2015/05/20 22:19:48
Do you still need this in the header?
ortuno
2015/05/20 23:35:20
Done.
| |
| 9 #include "device/bluetooth/bluetooth_adapter_factory.h" | 10 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 11 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 11 #include "device/bluetooth/test/mock_bluetooth_device.h" | 12 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 12 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" | 13 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 // Implements fake adapters with named mock data set for use in tests as a | 17 // Implements fake adapters with named mock data set for use in tests as a |
| 17 // result of layout tests calling testRunner.setBluetoothMockDataSet. | 18 // result of layout tests calling testRunner.setBluetoothMockDataSet. |
| 18 class LayoutTestBluetoothAdapterProvider { | 19 class LayoutTestBluetoothAdapterProvider { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 31 GetEmptyAdapter(); | 32 GetEmptyAdapter(); |
| 32 | 33 |
| 33 // Returns "SingleEmptyDevice" fake BluetoothAdapter with the following | 34 // Returns "SingleEmptyDevice" fake BluetoothAdapter with the following |
| 34 // characteristics: | 35 // characteristics: |
| 35 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | 36 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| |
| 36 // as argument. | 37 // as argument. |
| 37 // - |GetDevices| returns a list with an |EmptyDevice|. | 38 // - |GetDevices| returns a list with an |EmptyDevice|. |
| 38 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 39 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
| 39 GetSingleEmptyDeviceAdapter(); | 40 GetSingleEmptyDeviceAdapter(); |
| 40 | 41 |
| 41 // Returns a fake DiscoverySession with the following characteristics: | 42 // Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the |
| 43 // following characteristics: | |
| 44 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | |
| 45 // as argument. | |
| 46 // - |GetDevices| returns a list with a |ConnectableDevice|. | |
| 47 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | |
| 48 GetConnectableDeviceAdapter(); | |
| 49 | |
| 50 // Returns "UnconnectableDeviceAdapter" fake BluetoothAdapter with the | |
| 51 // following characteristics: | |
| 52 // - |StartDiscoverySession| runs the first argument with |DiscoverySession| | |
| 53 // as argument. | |
| 54 // - |GetDevices| returns a list with an |UnconnectableDevice|. | |
| 55 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | |
| 56 GetUnconnectableDeviceAdapter(); | |
| 57 | |
| 58 // Returns a fake |DiscoverySession| with the following characteristics: | |
| 42 // - |Stop| runs the first argument. | 59 // - |Stop| runs the first argument. |
| 43 static scoped_ptr<testing::NiceMock<device::MockBluetoothDiscoverySession>> | 60 static scoped_ptr<testing::NiceMock<device::MockBluetoothDiscoverySession>> |
| 44 GetDiscoverySession(); | 61 GetDiscoverySession(); |
| 45 | 62 |
| 46 // Returns an |EmptyDevice| with the following characeteristics: | 63 // Returns an |EmptyDevice| with the following characeteristics: |
| 47 // - |GetAddress| returns "Empty Mock Device instanceID". | 64 // - |GetAddress| returns "Empty Mock Device instanceID". |
| 48 // - |GetName| returns "Empty Mock Device name". | 65 // - |GetName| returns "Empty Mock Device name". |
| 49 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see | 66 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see |
| 50 // bluetooth.org/en-us/specification/assigned-numbers/baseband | 67 // bluetooth.org/en-us/specification/assigned-numbers/baseband |
| 51 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. | 68 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. |
| 52 // - |GetVendorID| returns 0xFFFF. | 69 // - |GetVendorID| returns 0xFFFF. |
| 53 // - |GetProductID| returns 1. | 70 // - |GetProductID| returns 1. |
| 54 // - |GetDeviceID| returns 2. | 71 // - |GetDeviceID| returns 2. |
| 55 // - |IsPaired| returns true. | 72 // - |IsPaired| returns true. |
| 56 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". | 73 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". |
| 57 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | 74 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> |
| 58 GetEmptyDevice(device::MockBluetoothAdapter* adapter); | 75 GetEmptyDevice(device::MockBluetoothAdapter* adapter); |
| 76 | |
| 77 // Returns a fake |ConnectableDevice| with the same characteristics as | |
| 78 // |EmptyDevice| except: | |
| 79 // - |CreateGattConnection| runs sucess callback with a | |
|
Jeffrey Yasskin
2015/05/20 22:19:48
sp: sucess
ortuno
2015/05/20 23:35:20
Done.
| |
| 80 // fake BluetoothGattConnection as argument. | |
| 81 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | |
| 82 GetConnectableDevice(device::MockBluetoothAdapter* adapter); | |
| 83 | |
| 84 // Returns a fake |UnconnectableDevice| with the same characteristics as | |
| 85 // |EmptyDevice| except: | |
| 86 // - |CreateGattConnection| runs error callback with | |
| 87 // |BluetoothDevice::ERROR_FAILED| as argument. | |
| 88 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> | |
| 89 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter); | |
| 59 }; | 90 }; |
| 60 | 91 |
| 61 } // namespace content | 92 } // namespace content |
| 62 | 93 |
| 63 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ | 94 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ |
| OLD | NEW |