browser_add_task.js (685B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 var test1Complete = false; 7 var test2Complete = false; 8 9 function executeWithTimeout() { 10 return new Promise(resolve => 11 executeSoon(function () { 12 ok(true, "we get here after a timeout"); 13 resolve(); 14 }) 15 ); 16 } 17 18 add_task(async function asyncTest_no1() { 19 await executeWithTimeout(); 20 test1Complete = true; 21 }); 22 23 add_task(async function asyncTest_no2() { 24 await executeWithTimeout(); 25 test2Complete = true; 26 }); 27 28 add_task(function () { 29 ok(test1Complete, "We have been through test 1"); 30 ok(test2Complete, "We have been through test 2"); 31 });