Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h

Issue 1132943002: bluetooth: Move mock creation out of BluetoothDispatcherHost to LayoutTestBluetoothAdapterProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-testing-layout-tests
Patch Set: Update documentation. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|.
20 static scoped_refptr<device::BluetoothAdapter> GetBluetoothAdapter(
21 const std::string& fake_adapter_name);
22
23 private:
24 // Returns "EmptyAdapter" fake BluetoothAdapter with the following
25 // characteristics:
26 // - |StartDiscoverySession| invokes |SuccessfulDiscoverySession|.
27 // - |GetDevices| returns an empty list of devices.
28 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
29 GetEmptyAdapter();
30
31 // Returns "SingleEmptyDevice" fake BluetoothAdapter with the following
32 // characteristics:
33 // - |StartDiscoverySession| invokes |SuccessfulDiscoverySession|.
34 // - |GetDevices| returns a list with an |EmptyDevice|.
35 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
36 GetSingleEmptyDeviceAdapter();
37
38 // Calls |callback| with a DiscoverySession with the following
39 // characteristics:
40 // - |Stop| will invoke |SuccessfulDiscoverySessionStop|.
41 static void SuccessfulDiscoverySession(
42 const device::BluetoothAdapter::DiscoverySessionCallback& callback,
43 const device::BluetoothAdapter::ErrorCallback& error_callback);
44
45 // Calls |callback|.
46 static void SuccessfulDiscoverySessionStop(
47 const base::Closure& callback,
48 const base::Closure& error_callback);
49
50 // Returns an |EmptyDevice| with the following characeteristics:
51 // - |GetAddress| returns "Empty Mock Device instanceID".
52 // - |GetName| returns "Empty Mock Device name".
53 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see
54 // bluetooth.org/en-us/specification/assigned-numbers/baseband
55 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|.
56 // - |GetVendorID| returns 0xFFFF.
57 // - |GetProductID| returns 1.
58 // - |GetDeviceID| returns 2.
59 // - |IsPaired| returns true.
60 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801".
61 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
62 GetEmptyDevice(device::MockBluetoothAdapter* adapter);
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698