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

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

Issue 1156573005: bluetooth: Browser-side implementation of getCharacteristic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-get-primary-service-initial
Patch Set: Fix histograms.xml and bad_messages.h merge conflict Created 5 years, 6 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
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 "device/bluetooth/bluetooth_adapter_factory.h" 9 #include "device/bluetooth/bluetooth_adapter_factory.h"
10 #include "device/bluetooth/test/mock_bluetooth_adapter.h" 10 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
11 #include "device/bluetooth/test/mock_bluetooth_device.h" 11 #include "device/bluetooth/test/mock_bluetooth_device.h"
12 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" 12 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h"
13 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h"
13 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" 14 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h"
15
14 namespace content { 16 namespace content {
15 17
16 // Implements fake adapters with named mock data set for use in tests as a 18 // Implements fake adapters with named mock data set for use in tests as a
17 // result of layout tests calling testRunner.setBluetoothMockDataSet. 19 // result of layout tests calling testRunner.setBluetoothMockDataSet.
18 class LayoutTestBluetoothAdapterProvider { 20 class LayoutTestBluetoothAdapterProvider {
19 public: 21 public:
20 // Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|. 22 // Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|.
21 static scoped_refptr<device::BluetoothAdapter> GetBluetoothAdapter( 23 static scoped_refptr<device::BluetoothAdapter> GetBluetoothAdapter(
22 const std::string& fake_adapter_name); 24 const std::string& fake_adapter_name);
23 25
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // - |GetName| returns "Empty Mock Device name". 66 // - |GetName| returns "Empty Mock Device name".
65 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see 67 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see
66 // bluetooth.org/en-us/specification/assigned-numbers/baseband 68 // bluetooth.org/en-us/specification/assigned-numbers/baseband
67 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. 69 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|.
68 // - |GetVendorID| returns 0xFFFF. 70 // - |GetVendorID| returns 0xFFFF.
69 // - |GetProductID| returns 1. 71 // - |GetProductID| returns 1.
70 // - |GetDeviceID| returns 2. 72 // - |GetDeviceID| returns 2.
71 // - |IsPaired| returns true. 73 // - |IsPaired| returns true.
72 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". 74 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801".
73 // - |GetGattServices| returns a list with two services "Generic Access" and 75 // - |GetGattServices| returns a list with two services "Generic Access" and
74 // "Generic Attribute". 76 // "Generic Attribute". "Generic Access" has a "Device Name" characteristic
77 // and "Generic Attribute" has a "Service Changed" characteristic.
75 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> 78 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
76 GetEmptyDevice(device::MockBluetoothAdapter* adapter); 79 GetEmptyDevice(device::MockBluetoothAdapter* adapter);
77 80
78 // Returns a fake |ConnectableDevice| with the same characteristics as 81 // Returns a fake |ConnectableDevice| with the same characteristics as
79 // |EmptyDevice| except: 82 // |EmptyDevice| except:
80 // - |CreateGattConnection| runs success callback with a 83 // - |CreateGattConnection| runs success callback with a
81 // fake BluetoothGattConnection as argument. 84 // fake BluetoothGattConnection as argument.
82 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> 85 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
83 GetConnectableDevice(device::MockBluetoothAdapter* adapter); 86 GetConnectableDevice(device::MockBluetoothAdapter* adapter);
84 87
85 // Returns a fake |UnconnectableDevice| with the same characteristics as 88 // Returns a fake |UnconnectableDevice| with the same characteristics as
86 // |EmptyDevice| except: 89 // |EmptyDevice| except:
87 // - |CreateGattConnection| runs error callback with 90 // - |CreateGattConnection| runs error callback with
88 // |BluetoothDevice::ERROR_FAILED| as argument. 91 // |BluetoothDevice::ERROR_FAILED| as argument.
89 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> 92 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
90 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter); 93 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter);
91 94
92 // Returns a fake BluetoothGattService with the following characteristics: 95 // Returns a fake BluetoothGattService with the following characteristics:
93 // - |GetIdentifier| returns |uuid|. 96 // - |GetIdentifier| returns |uuid|.
94 // - |GetUUID| returns BluetoothUUID(|uuid|). 97 // - |GetUUID| returns BluetoothUUID(|uuid|).
95 // - |IsLocal| returns false. 98 // - |IsLocal| returns false.
96 // - |IsPrimary| returns true. 99 // - |IsPrimary| returns true.
97 // - |GetDevice| returns |device|. 100 // - |GetDevice| returns |device|.
98 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>> 101 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>>
99 GetMockService(device::MockBluetoothDevice* device, const std::string& uuid); 102 GetGattService(device::MockBluetoothDevice* device, const std::string& uuid);
103
104 // Returns a fake BluetoothGattCharacteristic with the following
105 // characteristics:
106 // - |GetIdentifier| returns |uuid|.
107 // - |GetUUID| returns BluetoothUUID(|uuid|).
108 // - |IsLocal| returns false.
109 // - |GetService| returns |service|.
110 // - |IsNotifying| returns false.
111 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattCharacteristic>>
112 GetGattCharacteristic(device::MockBluetoothGattService* service,
113 const std::string& uuid);
100 }; 114 };
101 115
102 } // namespace content 116 } // namespace content
103 117
104 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ 118 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698