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

Side by Side Diff: LayoutTests/bluetooth/getCharacteristic.html

Issue 1164393004: bluetooth: Layout tests for bluetooth error messages (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-read-value-impl
Patch Set: Fix error message test since message on browser side changed. 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
« no previous file with comments | « LayoutTests/bluetooth/connectGATT.html ('k') | LayoutTests/bluetooth/getPrimaryService.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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="bluetooth-helpers.js"></script> 4 <script src="bluetooth-helpers.js"></script>
5 <script> 5 <script>
6 test(function(t) { assert_exists(window, "testRunner"); t.done(); }, 6 test(function(t) { assert_exists(window, "testRunner"); t.done(); },
7 "window.testRunner is required for the following tests."); 7 "window.testRunner is required for the following tests.");
8 8
9 // Generic Access Service. 9 // Generic Access Service.
10 var serviceUUID = "00001800-0000-1000-8000-00805f9b34fb"; 10 var serviceUUID = "00001800-0000-1000-8000-00805f9b34fb";
11 // Device Name Characteristic. Belongs to Generic Access. 11 // Device Name Characteristic. Belongs to Generic Access.
12 var includedCharacteristicUUID = "00002a00-0000-1000-8000-00805f9b34fb"; 12 var includedCharacteristicUUID = "00002a00-0000-1000-8000-00805f9b34fb";
13 // Battery Level. Belongs to Battery Service. 13 // Battery Level. Belongs to Battery Service.
14 var nonIncludedCharacteristicUUID = "00002a19-0000-1000-8000-00805f9b34fb"; 14 var nonIncludedCharacteristicUUID = "00002a19-0000-1000-8000-00805f9b34fb";
15 15
16 sequential_promise_test(function() { 16 sequential_promise_test(function() {
17 testRunner.setBluetoothMockDataSet('ConnectableDeviceAdapter'); 17 testRunner.setBluetoothMockDataSet('ConnectableDeviceAdapter');
18 return navigator.bluetooth.requestDevice().then(function(device) { 18 return navigator.bluetooth.requestDevice().then(function(device) {
19 return device.connectGATT(); 19 return device.connectGATT();
20 }).then(function(gattServer) { 20 }).then(function(gattServer) {
21 return gattServer.getPrimaryService(serviceUUID); 21 return gattServer.getPrimaryService(serviceUUID);
22 }).then(function(service) { 22 }).then(function(service) {
23 testRunner.setBluetoothMockDataSet('EmptyAdapter'); 23 testRunner.setBluetoothMockDataSet('EmptyAdapter');
24 return service.getCharacteristic(includedCharacteristicUUID).then(function() { 24 return service.getCharacteristic(includedCharacteristicUUID).then(function() {
25 assert_unreached("Device went out of range, should fail."); 25 assert_unreached("Device went out of range, should fail.");
26 }, function(e) { 26 }, function(e) {
27 assert_equals(e.name, "NetworkError"); 27 assert_equals(e.name, "NetworkError");
28 assert_equals(e.message, 'Bluetooth Device is no longer in range.');
28 }); 29 });
29 }); 30 });
30 }, 'Device goes out of range. Reject with NetworkError.'); 31 }, 'Device goes out of range. Reject with NetworkError.');
31 32
32 sequential_promise_test(function() { 33 sequential_promise_test(function() {
33 testRunner.setBluetoothMockDataSet('ConnectableDeviceAdapter'); 34 testRunner.setBluetoothMockDataSet('ConnectableDeviceAdapter');
34 return navigator.bluetooth.requestDevice().then(function(device) { 35 return navigator.bluetooth.requestDevice().then(function(device) {
35 return device.connectGATT(); 36 return device.connectGATT();
36 }).then(function(gattServer) { 37 }).then(function(gattServer) {
37 return gattServer.getPrimaryService(serviceUUID); 38 return gattServer.getPrimaryService(serviceUUID);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 }).then(function(characteristics) { 70 }).then(function(characteristics) {
70 // TODO(ortuno): getCharacteristic should return the same object 71 // TODO(ortuno): getCharacteristic should return the same object
71 // if it was created earlier. 72 // if it was created earlier.
72 // https://crbug.com/495270 73 // https://crbug.com/495270
73 assert_not_equals(characteristics[0], characteristics[1], 74 assert_not_equals(characteristics[0], characteristics[1],
74 "Should return the same service as the first call."); 75 "Should return the same service as the first call.");
75 }); 76 });
76 }, 'Calls to get the same characteristic should return the same object.'); 77 }, 'Calls to get the same characteristic should return the same object.');
77 78
78 </script> 79 </script>
OLDNEW
« no previous file with comments | « LayoutTests/bluetooth/connectGATT.html ('k') | LayoutTests/bluetooth/getPrimaryService.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698