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

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

Issue 2727683003: bluetooth: Clean up connection errors (Closed)
Patch Set: format Created 3 years, 9 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 GetDelayedServicesDiscoveryAdapter(); 475 GetDelayedServicesDiscoveryAdapter();
476 476
477 // |FailingConnectionsAdapter| 477 // |FailingConnectionsAdapter|
478 // Inherits from |EmptyAdapter| 478 // Inherits from |EmptyAdapter|
479 // FailingConnectionsAdapter holds a device for each type of connection error 479 // FailingConnectionsAdapter holds a device for each type of connection error
480 // that can occur. This way we don’t need to create an adapter for each type 480 // that can occur. This way we don’t need to create an adapter for each type
481 // of error. Each of the devices has a service with a different UUID so that 481 // of error. Each of the devices has a service with a different UUID so that
482 // they can be accessed by using different filters. 482 // they can be accessed by using different filters.
483 // See connectErrorUUID() declaration below. 483 // See connectErrorUUID() declaration below.
484 // Internal Structure: 484 // Internal Structure:
485 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_CANCELED)
486 // connectErrorUUID(0x0)
487 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED)
488 // connectErrorUUID(0x1)
489 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_REJECTED)
490 // connectErrorUUID(0x2)
491 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_TIMEOUT)
492 // connectErrorUUID(0x3)
493 // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED)
494 // connectErrorUUID(0x4)
495 // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS)
496 // connectErrorUUID(0x5)
485 // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN) 497 // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN)
486 // connectErrorUUID(0x0)
487 // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS)
488 // connectErrorUUID(0x1)
489 // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED)
490 // connectErrorUUID(0x2)
491 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED)
492 // connectErrorUUID(0x3)
493 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_CANCELED)
494 // connectErrorUUID(0x4)
495 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_REJECTED)
496 // connectErrorUUID(0x5)
497 // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_TIMEOUT)
498 // connectErrorUUID(0x6) 498 // connectErrorUUID(0x6)
499 // - UnconnectableDevice(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE) 499 // - UnconnectableDevice(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)
500 // connectErrorUUID(0x7) 500 // connectErrorUUID(0x7)
501 // - UnconnectableDevice(BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID)
502 // connectErrorUUID(0x8)
503 // - UnconnectableDevice(BluetoothDevice::ERROR_CONNECTION_CONGESTED)
504 // connectErrorUUID(0x9)
505 // - UnconnectableDevice(BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION)
506 // connectErrorUUID(0xa)
507 // - UnconnectableDevice(BluetoothDevice::ERROR_OFFSET_INVALID)
508 // connectErrorUUID(0xb)
509 // - UnconnectableDevice(BluetoothDevice::ERROR_READ_NOT_PERMITTED)
510 // connectErrorUUID(0xc)
511 // - UnconnectableDevice(BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED)
512 // connectErrorUUID(0xd)
513 // - UnconnectableDevice(BluetoothDevice::ERROR_WRITE_NOT_PERMITTED)
514 // connectErrorUUID(0xe)
515 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> 501 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
516 GetFailingConnectionsAdapter(); 502 GetFailingConnectionsAdapter();
517 503
518 // |FailingGATTOperationsAdapter| 504 // |FailingGATTOperationsAdapter|
519 // Inherits from |EmptyAdapter| 505 // Inherits from |EmptyAdapter|
520 // FailingGATTOperationsAdapter holds a device with one 506 // FailingGATTOperationsAdapter holds a device with one
521 // service: ErrorsService. This service contains a characteristic for each 507 // service: ErrorsService. This service contains a characteristic for each
522 // type of GATT Error that can be thrown. Trying to write or read from these 508 // type of GATT Error that can be thrown. Trying to write or read from these
523 // characteristics results in the corresponding error being returned. 509 // characteristics results in the corresponding error being returned.
524 // GetProperties returns the following for all characteristics: 510 // GetProperties returns the following for all characteristics:
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 // Returns: true 827 // Returns: true
842 // - Stop: 828 // - Stop:
843 // Stops calling GattCharacteristicValueChanged and runs callback. 829 // Stops calling GattCharacteristicValueChanged and runs callback.
844 static std::unique_ptr< 830 static std::unique_ptr<
845 testing::NiceMock<device::MockBluetoothGattNotifySession>> 831 testing::NiceMock<device::MockBluetoothGattNotifySession>>
846 GetBaseGATTNotifySession( 832 GetBaseGATTNotifySession(
847 base::WeakPtr<device::BluetoothRemoteGattCharacteristic> characteristic); 833 base::WeakPtr<device::BluetoothRemoteGattCharacteristic> characteristic);
848 834
849 // Helper functions: 835 // Helper functions:
850 836
851 // DEPRECATED: This is a poor practice as it exposes the specific
852 // enum values of this code base into the UUIDs used
853 // by the test data. Prefer methods such as
854 // connectErrorUUID.
855 // errorUUID(alias) returns a UUID with the top 32 bits of 837 // errorUUID(alias) returns a UUID with the top 32 bits of
scheib 2017/03/07 06:20:22 Why are we removing connectErrorUUID? I'll read fu
ortuno 2017/03/08 01:46:10 There were actually no calls to connectErrorUUID D
scheib 2017/03/08 02:36:08 OK, wonder where they went. ;) It was certainly a
856 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. 838 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|.
857 // For example, errorUUID(0xDEADBEEF) returns 839 // For example, errorUUID(0xDEADBEEF) returns
858 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs 840 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs
859 // were generated as a type 4 (random) UUID. 841 // were generated as a type 4 (random) UUID.
860 static std::string errorUUID(uint32_t alias); 842 static std::string errorUUID(uint32_t alias);
861 843
862 // Returns a stable test data UUID associated with a given
863 // BluetoothDevice::ConnectErrorCode.
864 static device::BluetoothUUID connectErrorUUID(
865 device::BluetoothDevice::ConnectErrorCode error_code);
866
867 // Function to turn an integer into an MAC address of the form 844 // Function to turn an integer into an MAC address of the form
868 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) 845 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef)
869 // returns "00:00:DE:AD:BE:EF". 846 // returns "00:00:DE:AD:BE:EF".
870 static std::string makeMACAddress(uint64_t addr); 847 static std::string makeMACAddress(uint64_t addr);
871 }; 848 };
872 849
873 } // namespace content 850 } // namespace content
874 851
875 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ 852 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698