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

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: Address scheib comments 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 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
Jeffrey Yasskin 2015/05/12 22:17:54 s/Provides "EmptyAdapter"/Provides the "emptyAdapt
ortuno 2015/05/13 17:14:50 Done.
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
Jeffrey Yasskin 2015/05/12 22:17:54 s/|callback/|callback|/
ortuno 2015/05/13 17:14:50 Done.
37 // following characteristics:
38 // - |StartDiscoverySession| invokes |SuccessfulDiscoverySessionCallback|.
Jeffrey Yasskin 2015/05/12 22:17:54 There's no "SuccessfulDiscoverySessionCallback" he
ortuno 2015/05/13 17:14:49 Outdated docs. Done.
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|.
Jeffrey Yasskin 2015/05/12 22:17:54 Is SuccessfulStopDiscoverySession() different from
ortuno 2015/05/13 17:14:49 Done.
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 void SetupEmptyDevice();
67
68 scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> adapter_;
69 scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> empty_device_;
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698