OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
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_ | |
7 | |
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 | |
13 namespace content { | |
14 | |
15 // Implements fake adapters with named mock data set for use in tests as a | |
16 // result of layout tests calling testRunner.setBluetoothMockDataSet. | |
17 class LayoutTestBluetoothAdapterProvider { | |
18 public: | |
19 LayoutTestBluetoothAdapterProvider(); | |
20 ~LayoutTestBluetoothAdapterProvider(); | |
21 | |
22 // Calls |callback| with a fake BluetoothAdapter. |adapter|'s | |
23 // behavior depends on |fake_adapter_name|. | |
24 void GetBluetoothAdapter( | |
25 const std::string& fake_adapter_name, | |
26 const device::BluetoothAdapterFactory::AdapterCallback& callback); | |
27 | |
28 private: | |
29 // Provides "EmptyAdapter" fake BluetoothAdapter to |callback| with following | |
30 // characteristics: | |
31 // - |StartDiscoverySession| invokes |SuccessfulDiscoverySession|. | |
32 // - |GetDevices| returns an empty list of devices. | |
33 void GetEmptyAdapter( | |
34 const device::BluetoothAdapterFactory::AdapterCallback& callback); | |
35 | |
36 // Provides "SingleEmptyDevice" fake BluetoothAdapter to |callback with the | |
37 // following characteristics: | |
38 // - |StartDiscoverySession| invokes |SuccessfulDiscoverySessionCallback|. | |
39 // - |GetDevices| returns a list with an |EmptyDevice|. | |
40 void GetSingleEmptyDeviceAdapter( | |
41 const device::BluetoothAdapterFactory::AdapterCallback& callback); | |
42 | |
43 // Calls |callback| with a DiscoverySession with the following | |
44 // characteristics: | |
45 // - |Stop| will invoke |SuccessfulStopDiscoverySession|. | |
46 void SuccessfulDiscoverySession( | |
47 const device::BluetoothAdapter::DiscoverySessionCallback& callback, | |
48 const device::BluetoothAdapter::ErrorCallback& error_callback); | |
49 | |
50 // Calls |callback|. | |
51 static void SuccessfulDiscoverySessionStop( | |
52 const base::Closure& callback, | |
53 const base::Closure& error_callback); | |
54 | |
55 // Sets up an |EmptyDevice| with the following characeteristics: | |
56 // - |GetAddress| returns "Empty Mock Device instanceID". | |
57 // - |GetName| returns "Empty Mock Device name". | |
58 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see | |
59 // bluetooth.org/en-us/specification/assigned-numbers/baseband | |
60 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. | |
61 // - |GetVendorID| returns 0xFFFF. | |
62 // - |GetProductID| returns 1. | |
63 // - |GetDeviceID| returns 2. | |
64 // - |IsPaired| returns true. | |
65 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". | |
66 | |
scheib
2015/05/12 20:15:06
Has extra blank line here.
ortuno
2015/05/12 20:49:08
Done.
| |
67 void SetupEmptyDevice(); | |
68 | |
69 scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> adapter_; | |
70 scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> empty_device_; | |
71 }; | |
72 | |
73 } // namespace content | |
74 | |
75 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ | |
OLD | NEW |