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

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

Issue 1464443002: bluetooth: android: Add BluetoothDevice::ConnectErrorCode enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VI Created 4 years, 11 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // return the Heart Rate Service) 216 // return the Heart Rate Service)
217 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> 217 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
218 GetDelayedServicesDiscoveryAdapter(); 218 GetDelayedServicesDiscoveryAdapter();
219 219
220 // |FailingConnectionsAdapter| 220 // |FailingConnectionsAdapter|
221 // Inherits from |EmptyAdapter| 221 // Inherits from |EmptyAdapter|
222 // FailingConnectionsAdapter holds a device for each type of connection error 222 // FailingConnectionsAdapter holds a device for each type of connection error
223 // that can occur. This way we don’t need to create an adapter for each type 223 // that can occur. This way we don’t need to create an adapter for each type
224 // of error. Each of the devices has a service with a different UUID so that 224 // of error. Each of the devices has a service with a different UUID so that
225 // they can be accessed by using different filters. 225 // they can be accessed by using different filters.
226 // See errorUUID() declaration below. 226 // See connectErrorUUID() declaration below.
227 // Internal Structure: 227 // Internal Structure:
228 // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN) errorUUID(0x0) 228 // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN)
229 // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS) errorUUID(0x1) 229 // connectErrorUUID(0x0)
230 // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED) errorUUID(0x2) 230 // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS)
231 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED) errorUUID(0x3) 231 // connectErrorUUID(0x1)
232 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_CANCELED) errorUUID(0x4) 232 // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED)
233 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_REJECTED) errorUUID(0x5) 233 // connectErrorUUID(0x2)
234 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_TIMEOUT) errorUUID(0x6) 234 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED)
235 // connectErrorUUID(0x3)
236 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_CANCELED)
237 // connectErrorUUID(0x4)
238 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_REJECTED)
239 // connectErrorUUID(0x5)
240 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_TIMEOUT)
241 // connectErrorUUID(0x6)
235 // - UnconnectableDevice(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE) 242 // - UnconnectableDevice(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)
236 // errorUUID(0x7) 243 // connectErrorUUID(0x7)
244 // - UnconnectableDevice(BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID)
245 // connectErrorUUID(0x8)
246 // - UnconnectableDevice(BluetoothDevice::ERROR_CONNECTION_CONGESTED)
247 // connectErrorUUID(0x9)
248 // - UnconnectableDevice(BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION)
249 // connectErrorUUID(0xa)
250 // - UnconnectableDevice(BluetoothDevice::ERROR_OFFSET_INVALID)
251 // connectErrorUUID(0xb)
252 // - UnconnectableDevice(BluetoothDevice::ERROR_READ_NOT_PERMITTED)
253 // connectErrorUUID(0xc)
254 // - UnconnectableDevice(BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED)
255 // connectErrorUUID(0xd)
256 // - UnconnectableDevice(BluetoothDevice::ERROR_WRITE_NOT_PERMITTED)
257 // connectErrorUUID(0xe)
237 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> 258 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
238 GetFailingConnectionsAdapter(); 259 GetFailingConnectionsAdapter();
239 260
240 // |FailingGATTOperationsAdapter| 261 // |FailingGATTOperationsAdapter|
241 // Inherits from |EmptyAdapter| 262 // Inherits from |EmptyAdapter|
242 // FailingGATTOperationsAdapter holds a device with one 263 // FailingGATTOperationsAdapter holds a device with one
243 // service: ErrorsService. This service contains a characteristic for each 264 // service: ErrorsService. This service contains a characteristic for each
244 // type of GATT Error that can be thrown. Trying to write or read from these 265 // type of GATT Error that can be thrown. Trying to write or read from these
245 // characteristics results in the corresponding error being returned. 266 // characteristics results in the corresponding error being returned.
246 // GetProperties returns the following for all characteristics: 267 // GetProperties returns the following for all characteristics:
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // Returns: characteristic_identifier 525 // Returns: characteristic_identifier
505 // - IsActive: 526 // - IsActive:
506 // Returns: true 527 // Returns: true
507 // - Stop: 528 // - Stop:
508 // Stops calling GattCharacteristicValueChanged and runs callback. 529 // Stops calling GattCharacteristicValueChanged and runs callback.
509 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>> 530 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>>
510 GetBaseGATTNotifySession(const std::string& characteristic_identifier); 531 GetBaseGATTNotifySession(const std::string& characteristic_identifier);
511 532
512 // Helper functions: 533 // Helper functions:
513 534
535 // DEPRECATED: This is a poor practice as it exposes the specific
536 // enum values of this code base into the UUIDs used
537 // by the test data. Prefer methods such as
538 // connectErrorUUID.
514 // errorUUID(alias) returns a UUID with the top 32 bits of 539 // errorUUID(alias) returns a UUID with the top 32 bits of
515 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. 540 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|.
516 // For example, errorUUID(0xDEADBEEF) returns 541 // For example, errorUUID(0xDEADBEEF) returns
517 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs 542 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs
518 // were generated as a type 4 (random) UUID. 543 // were generated as a type 4 (random) UUID.
519 static std::string errorUUID(uint32_t alias); 544 static std::string errorUUID(uint32_t alias);
520 545
546 // Returns a stable test data UUID associated with a given
547 // BluetoothDevice::ConnectErrorCode.
548 static device::BluetoothUUID connectErrorUUID(
549 device::BluetoothDevice::ConnectErrorCode error_code);
550
521 // Function to turn an integer into an MAC address of the form 551 // Function to turn an integer into an MAC address of the form
522 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) 552 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef)
523 // returns "00:00:DE:AD:BE:EF". 553 // returns "00:00:DE:AD:BE:EF".
524 static std::string makeMACAddress(uint64_t addr); 554 static std::string makeMACAddress(uint64_t addr);
525 }; 555 };
526 556
527 } // namespace content 557 } // namespace content
528 558
529 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ 559 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698