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

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

Issue 1159523002: bluetooth: Browser side partial implementation of getPrimaryService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/sevice/service 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 13 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h"
14 namespace content { 14 namespace content {
15 15
16 // Implements fake adapters with named mock data set for use in tests as a 16 // Implements fake adapters with named mock data set for use in tests as a
17 // result of layout tests calling testRunner.setBluetoothMockDataSet. 17 // result of layout tests calling testRunner.setBluetoothMockDataSet.
18 class LayoutTestBluetoothAdapterProvider { 18 class LayoutTestBluetoothAdapterProvider {
19 public: 19 public:
20 // Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|. 20 // Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|.
21 static scoped_refptr<device::BluetoothAdapter> GetBluetoothAdapter( 21 static scoped_refptr<device::BluetoothAdapter> GetBluetoothAdapter(
22 const std::string& fake_adapter_name); 22 const std::string& fake_adapter_name);
23 23
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // - |GetAddress| returns "Empty Mock Device instanceID". 63 // - |GetAddress| returns "Empty Mock Device instanceID".
64 // - |GetName| returns "Empty Mock Device name". 64 // - |GetName| returns "Empty Mock Device name".
65 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see 65 // - |GetBluetoothClass| returns 0x1F00. "Unspecified Device Class": see
66 // bluetooth.org/en-us/specification/assigned-numbers/baseband 66 // bluetooth.org/en-us/specification/assigned-numbers/baseband
67 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|. 67 // - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH|.
68 // - |GetVendorID| returns 0xFFFF. 68 // - |GetVendorID| returns 0xFFFF.
69 // - |GetProductID| returns 1. 69 // - |GetProductID| returns 1.
70 // - |GetDeviceID| returns 2. 70 // - |GetDeviceID| returns 2.
71 // - |IsPaired| returns true. 71 // - |IsPaired| returns true.
72 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801". 72 // - |GetUUIDs| returns a list with two UUIDs: "1800" and "1801".
73 // - |GetGattServices| returns a list with two services "Generic Access" and
scheib 2015/05/28 23:09:16 EmptyDevice doesn't seem so empty if it has Servic
ortuno 2015/05/29 17:53:55 But it's already advertising two UUIDs. Also these
74 // "Generic Attribute".
73 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> 75 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
74 GetEmptyDevice(device::MockBluetoothAdapter* adapter); 76 GetEmptyDevice(device::MockBluetoothAdapter* adapter);
75 77
76 // Returns a fake |ConnectableDevice| with the same characteristics as 78 // Returns a fake |ConnectableDevice| with the same characteristics as
77 // |EmptyDevice| except: 79 // |EmptyDevice| except:
78 // - |CreateGattConnection| runs success callback with a 80 // - |CreateGattConnection| runs success callback with a
79 // fake BluetoothGattConnection as argument. 81 // fake BluetoothGattConnection as argument.
80 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> 82 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
81 GetConnectableDevice(device::MockBluetoothAdapter* adapter); 83 GetConnectableDevice(device::MockBluetoothAdapter* adapter);
82 84
83 // Returns a fake |UnconnectableDevice| with the same characteristics as 85 // Returns a fake |UnconnectableDevice| with the same characteristics as
84 // |EmptyDevice| except: 86 // |EmptyDevice| except:
85 // - |CreateGattConnection| runs error callback with 87 // - |CreateGattConnection| runs error callback with
86 // |BluetoothDevice::ERROR_FAILED| as argument. 88 // |BluetoothDevice::ERROR_FAILED| as argument.
87 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>> 89 static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
88 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter); 90 GetUnconnectableDevice(device::MockBluetoothAdapter* adapter);
91
92 // Returns a fake BluetoothGattService with the following characteristics:
93 // - |GetIdentifier| returns |uuid|.
94 // - |GetUUID| returns BluetoothUUID(|uuid|).
95 // - |IsLocal| returns false.
96 // - |IsPrimary| returns true.
97 // - |GetDevice| returns |device|.
98 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattService>>
99 GetMockService(device::MockBluetoothDevice* device, const std::string& uuid);
89 }; 100 };
90 101
91 } // namespace content 102 } // namespace content
92 103
93 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ 104 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698