| OLD | NEW |
| 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 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid
er.h" | 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid
er.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 // Helper functions | 1792 // Helper functions |
| 1793 | 1793 |
| 1794 // static | 1794 // static |
| 1795 std::string LayoutTestBluetoothAdapterProvider::errorUUID(uint32_t alias) { | 1795 std::string LayoutTestBluetoothAdapterProvider::errorUUID(uint32_t alias) { |
| 1796 return base::StringPrintf("%08x-97e5-4cd7-b9f1-f5a427670c59", alias); | 1796 return base::StringPrintf("%08x-97e5-4cd7-b9f1-f5a427670c59", alias); |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 // static | 1799 // static |
| 1800 BluetoothUUID LayoutTestBluetoothAdapterProvider::connectErrorUUID( | |
| 1801 BluetoothDevice::ConnectErrorCode error_code) { | |
| 1802 // Case values listed in alphabetical order. | |
| 1803 // Associated UUIDs are defined in layout tests and should remain stable | |
| 1804 // even if BluetoothDevice enum values change. | |
| 1805 switch (error_code) { | |
| 1806 case BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID: | |
| 1807 return BluetoothUUID("0008"); | |
| 1808 case BluetoothDevice::ERROR_AUTH_CANCELED: | |
| 1809 return BluetoothUUID("0004"); | |
| 1810 case BluetoothDevice::ERROR_AUTH_FAILED: | |
| 1811 return BluetoothUUID("0003"); | |
| 1812 case BluetoothDevice::ERROR_AUTH_REJECTED: | |
| 1813 return BluetoothUUID("0005"); | |
| 1814 case BluetoothDevice::ERROR_AUTH_TIMEOUT: | |
| 1815 return BluetoothUUID("0006"); | |
| 1816 case BluetoothDevice::ERROR_CONNECTION_CONGESTED: | |
| 1817 return BluetoothUUID("0009"); | |
| 1818 case BluetoothDevice::ERROR_FAILED: | |
| 1819 return BluetoothUUID("0002"); | |
| 1820 case BluetoothDevice::ERROR_INPROGRESS: | |
| 1821 return BluetoothUUID("0001"); | |
| 1822 case BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION: | |
| 1823 return BluetoothUUID("000a"); | |
| 1824 case BluetoothDevice::ERROR_OFFSET_INVALID: | |
| 1825 return BluetoothUUID("000b"); | |
| 1826 case BluetoothDevice::ERROR_READ_NOT_PERMITTED: | |
| 1827 return BluetoothUUID("000c"); | |
| 1828 case BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED: | |
| 1829 return BluetoothUUID("000d"); | |
| 1830 case BluetoothDevice::ERROR_UNKNOWN: | |
| 1831 return BluetoothUUID("0000"); | |
| 1832 case BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: | |
| 1833 return BluetoothUUID("0007"); | |
| 1834 case BluetoothDevice::ERROR_WRITE_NOT_PERMITTED: | |
| 1835 return BluetoothUUID("000e"); | |
| 1836 case BluetoothDevice::NUM_CONNECT_ERROR_CODES: | |
| 1837 NOTREACHED(); | |
| 1838 return BluetoothUUID(); | |
| 1839 } | |
| 1840 NOTREACHED(); | |
| 1841 return BluetoothUUID(); | |
| 1842 } | |
| 1843 | |
| 1844 // static | |
| 1845 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { | 1800 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { |
| 1846 return BluetoothDevice::CanonicalizeAddress( | 1801 return BluetoothDevice::CanonicalizeAddress( |
| 1847 base::StringPrintf("%012" PRIx64, addr)); | 1802 base::StringPrintf("%012" PRIx64, addr)); |
| 1848 } | 1803 } |
| 1849 | 1804 |
| 1850 } // namespace content | 1805 } // namespace content |
| OLD | NEW |