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

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

Issue 1062393002: bluetooth: Use sequential_promise_test to stop test from running in parallel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | 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> 4 <script>
5 var promise_tests = Promise.resolve();
6 // Helper function to run promise tests one after the other.
7 // TODO(ortuno): Remove once https://github.com/w3c/testharness.js/pull/115/file s
8 // gets through.
9 function sequential_promise_test(func, name) {
10 var test = async_test(name);
11 promise_tests = promise_tests.then(function() {
12 return Promise.resolve(test.step(func, test, test))
13 .then(function() {
14 test.done();
15 })
16 .catch(test.step_func(
17 function(value) {
18 throw value;
19 }));
20 });
21 }
5 22
6 test(function(t) { assert_exists(window, "testRunner"); t.done(); }, 23 test(function(t) { assert_exists(window, "testRunner"); t.done(); },
7 "window.testRunner is required for the following tests."); 24 "window.testRunner is required for the following tests.");
8 25
9 async_test(function(t) { 26 sequential_promise_test(function(t) {
10 testRunner.setBluetoothMockDataSet('RejectRequestDevice_NotFoundError'); 27 testRunner.setBluetoothMockDataSet('RejectRequestDevice_NotFoundError');
11 navigator.bluetooth.requestDevice() 28 return navigator.bluetooth.requestDevice()
12 .then( 29 .then(function() {
13 t.step_func(function() { assert_unreached('Mock was set to reject.'); }), 30 assert_unreached('Mock was set to reject.');
14 t.step_func(function(e) { 31 },
32 function(e) {
15 assert_equals(e.name, 'NotFoundError'); 33 assert_equals(e.name, 'NotFoundError');
16 t.done(); 34 });
17 }));
18 }, 'Reject with NotFoundError.'); 35 }, 'Reject with NotFoundError.');
19 36
20 async_test(function(t) { 37 sequential_promise_test(function(t) {
21 testRunner.setBluetoothMockDataSet('RejectRequestDevice_SecurityError'); 38 testRunner.setBluetoothMockDataSet('RejectRequestDevice_SecurityError');
22 navigator.bluetooth.requestDevice() 39 return navigator.bluetooth.requestDevice()
23 .then( 40 .then(function() {
24 t.step_func(function() { assert_unreached('Mock was set to reject.'); }), 41 assert_unreached('Mock was set to reject.');
25 t.step_func(function(e) { 42 },
43 function(e) {
26 assert_equals(e.name, 'SecurityError'); 44 assert_equals(e.name, 'SecurityError');
27 t.done(); 45 });
28 }));
29 }, 'Reject with SecurityError.'); 46 }, 'Reject with SecurityError.');
30 47
31 async_test(function(t) { 48 sequential_promise_test(function() {
32 testRunner.setBluetoothMockDataSet('Single Empty Device'); 49 testRunner.setBluetoothMockDataSet('Single Empty Device');
33 navigator.bluetooth.requestDevice() 50 return navigator.bluetooth.requestDevice()
34 .then( 51 .then(function(device) {
35 t.step_func(function(device) { 52 assert_equals(device.constructor.name, "BluetoothDevice");
36 assert_equals(device.constructor.name, "BluetoothDevice"); 53 });
37 t.done();
38 }),
39 t.step_func(function() { assert_unreached('Mock was set to resolve.'); })) ;
40 }, 'Mock will resolve.'); 54 }, 'Mock will resolve.');
41
42 </script> 55 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698