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

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: 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.h"
10 #include "device/bluetooth/bluetooth_adapter_factory.h"
11 #include "device/bluetooth/bluetooth_device.h"
12 #include "device/bluetooth/bluetooth_uuid.h"
13 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
14 #include "device/bluetooth/test/mock_bluetooth_device.h"
15 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h"
16
17 namespace content {
18
19 using device::BluetoothAdapter;
20 using device::BluetoothAdapterFactory;
21 using device::BluetoothDevice;
22 using device::BluetoothDiscoverySession;
23 using device::BluetoothUUID;
24 using device::MockBluetoothAdapter;
25 using device::MockBluetoothDevice;
26 using device::MockBluetoothDiscoverySession;
27
28 class LayoutTestBluetoothAdapterProvider {
scheib 2015/05/11 20:19:26 Class comment, along the lines of: Implements fake
ortuno 2015/05/12 19:33:20 Done.
29 public:
30 LayoutTestBluetoothAdapterProvider();
31 ~LayoutTestBluetoothAdapterProvider();
32 void GetBluetoothAdapter(
scheib 2015/05/11 20:19:26 Same comment as used in BrowserContext.
ortuno 2015/05/12 19:33:20 Done.
33 const base::Callback<
34 void(scoped_refptr<device::BluetoothAdapter> adapter)>& callback,
35 const std::string& adapter);
36
37 protected:
38 scoped_ptr<testing::NiceMock<MockBluetoothDevice>> empty_device_;
39
40 private:
scheib 2015/05/12 01:16:28 We can leave everything in protected, move the dat
ortuno 2015/05/12 19:33:20 Done.
41 /*
scheib 2015/05/11 20:19:26 Use // comment style for consistency. Though /* */
scheib 2015/05/12 01:16:28 Lead these comment blocks with the fake_adapter_na
ortuno 2015/05/12 19:33:20 Done.
42 Calls |callback| with a BluetoothAdapter with the following
43 characteristics:
44 - |StartDiscoverySession| invokes |SuccessfulDiscoverySession|
scheib 2015/05/11 20:19:26 Add periods to all sentence fragments comments in
ortuno 2015/05/12 19:33:20 Done.
45 - |GetDevices| returns an empty list of devices
46 */
47 void GetEmptyAdapter(
48 const BluetoothAdapterFactory::AdapterCallback& callback);
49 /*
50 Calls |callback| with a BluetoothAdapter with the following
51 characteristics:
52 - |StartDiscoverySession| invokes |SuccessfulDiscoverySessionCallback|
53 - |GetDevices| returns an list with an |Empty Device|
scheib 2015/05/11 20:19:26 "returns a list".
scheib 2015/05/12 01:16:28 In the fake adapter names you've gone with a Camel
ortuno 2015/05/12 19:33:20 Done.
54 */
55 void GetSingleEmptyDeviceAdapter(
56 const BluetoothAdapterFactory::AdapterCallback& callback);
57
58 /*
59 Calls |callback| with a DiscoverySession with the following
60 characteristics:
61 - |Stop| will invoke |SuccessfulStopDiscoverySession|
62 */
63 void SuccessfulDiscoverySessionCallback(
scheib 2015/05/12 01:16:28 How about just "SuccessfulDiscoverySession".
ortuno 2015/05/12 19:33:20 Done.
64 const BluetoothAdapter::DiscoverySessionCallback& callback,
65 const BluetoothAdapter::ErrorCallback& error_callback);
66
67 // Calls |callback|
scheib 2015/05/12 01:16:28 Just merge this method up to be covered by previou
ortuno 2015/05/12 19:33:20 Done.
68 static void SuccessfulStopDiscoverySessionCallback(
69 const base::Closure& callback,
70 const base::Closure& error_callback);
71 /*
72 Sets up an |Empty Device| with the following characeteristics:
73 - |GetAddress| returns "Empty Mock Device instanceID"
74 - |GetName| returns "Empty Mock Device name"
75 - |GetBluetoothClass| returns |kUnspecifiedDeviceClass|
76 - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|
77 - |GetVendorID| returns |0xFFFF|
78 - |GetProductID| returns 1
79 - |GetDeviceID| returns 2
80 - |IsPaired| returns true
81 - |GetUUIDs| returns a list with two UUIDs: |uuid1| and |uuid2|
scheib 2015/05/11 20:19:26 I like these method docs. At some point we'll move
ortuno 2015/05/12 19:33:20 Moved everything inline since we aren't using anyt
82 */
83 void SetUpMockEmptyDevice(MockBluetoothAdapter* adapter);
scheib 2015/05/11 20:19:26 Everything is a mock in this class, and 'Setup' is
ortuno 2015/05/12 19:33:20 Done.
84 scoped_ptr<BluetoothUUID> uuid1;
scheib 2015/05/11 20:19:26 FYI Naming style of members has an underscore suff
ortuno 2015/05/12 19:33:20 Done.
85 scoped_ptr<BluetoothUUID> uuid2;
86 };
87
88 } // namespace content
89
90 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698