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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/connectGATT.html

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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/bluetooth-helpers.js"></script> 4 <script src="resources/bluetooth-helpers.js"></script>
5 <script> 5 <script>
6 'use strict'; 6 'use strict';
7 7
8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, 8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
9 'window.testRunner is required for the following tests.'); 9 'window.testRunner is required for the following tests.');
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }, { 62 }, {
63 testName: 'Authentication timed out when connecting.', 63 testName: 'Authentication timed out when connecting.',
64 uuid: errorUUID(0x6), 64 uuid: errorUUID(0x6),
65 error: new DOMException('Authentication timeout.', 65 error: new DOMException('Authentication timeout.',
66 'NetworkError') 66 'NetworkError')
67 }, { 67 }, {
68 testName: 'Tried to connect to an unsupported device.', 68 testName: 'Tried to connect to an unsupported device.',
69 uuid: errorUUID(0x7), 69 uuid: errorUUID(0x7),
70 error: new DOMException('Unsupported device.', 70 error: new DOMException('Unsupported device.',
71 'NetworkError') 71 'NetworkError')
72 }, {
73 testName: 'A write operation exceeds the maximum length of the attribute.',
74 uuid: errorUUID(0x8),
75 error: new DOMException('Attribute length invalid.',
76 'NetworkError')
77 }, {
78 testName: 'A remote device connection is congested.',
79 uuid: errorUUID(0x9),
80 error: new DOMException('Connection congested.',
81 'NetworkError')
82 }, {
83 testName: 'Insufficient encryption for a given operation.',
84 uuid: errorUUID(0xa),
85 error: new DOMException('Insufficient encryption.',
86 'NetworkError')
87 }, {
88 testName: 'A read or write operation was requested with an invalid offset.',
89 uuid: errorUUID(0xb),
90 error: new DOMException('Offset invalid.',
91 'NetworkError')
92 }, {
93 testName: 'GATT read operation is not permitted.',
94 uuid: errorUUID(0xc),
95 error: new DOMException('Read not permitted.',
96 'NetworkError')
97 }, {
98 testName: 'The given request is not supported.',
99 uuid: errorUUID(0xd),
100 error: new DOMException('Request not supported.',
101 'NetworkError')
102 }, {
103 testName: 'GATT write operation is not permitted.',
104 uuid: errorUUID(0xe),
105 error: new DOMException('Write not permitted.',
106 'NetworkError')
72 }].forEach(testSpec => { 107 }].forEach(testSpec => {
73 promise_test(() => { 108 promise_test(() => {
74 testRunner.setBluetoothMockDataSet('FailingConnectionsAdapter'); 109 testRunner.setBluetoothMockDataSet('FailingConnectionsAdapter');
75 return requestDeviceWithKeyDown({filters: [{services: [testSpec.uuid]}]}) 110 return requestDeviceWithKeyDown({filters: [{services: [testSpec.uuid]}]})
76 .then(device => { 111 .then(device => {
77 assert_promise_rejects_with_message( 112 assert_promise_rejects_with_message(
78 device.connectGATT(), 113 device.connectGATT(),
79 testSpec.error, 114 testSpec.error,
80 'Adapter failed to connect to device.'); 115 'Adapter failed to connect to device.');
81 }); 116 });
82 }, testSpec.testName); 117 }, testSpec.testName);
83 }); 118 });
84 119
85 promise_test(() => { 120 promise_test(() => {
86 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); 121 testRunner.setBluetoothMockDataSet('HeartRateAdapter');
87 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) 122 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
88 .then(device => device.connectGATT()) 123 .then(device => device.connectGATT())
89 .then(gattServer => assert_true(gattServer.connected)); 124 .then(gattServer => assert_true(gattServer.connected));
90 }, 'Device will connect'); 125 }, 'Device will connect');
91 </script> 126 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698